From cd3d1bdb283a11970993c6e7226072e5e9d9ca1e Mon Sep 17 00:00:00 2001 From: Marc Coquand Date: Sun, 6 Oct 2024 21:22:16 +0300 Subject: . --- emacs | 275 +++++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 137 insertions(+), 138 deletions(-) diff --git a/emacs b/emacs index 87d7068..80b27c5 100644 --- a/emacs +++ b/emacs @@ -1,5 +1,3 @@ -(set-face-attribute 'default nil :height 150) -(set-frame-font "Iosevka SS13 Extended" nil t) (menu-bar-mode -1) (tool-bar-mode -1) @@ -8,9 +6,16 @@ (pixel-scroll-precision-mode) (tab-bar-mode) (delete-selection-mode 1) - +(column-number-mode) +(line-number-mode) +(display-time-mode) (fset 'yes-or-no-p 'y-or-n-p) +(set-face-attribute 'default nil :height 150) +(set-frame-font "Iosevka SS13 Extended" nil t) + +;; Put Emacs auto-save and backup files to /tmp +(defconst emacs-tmp-dir (expand-file-name (format "emacs%d" (user-uid)) temporary-file-directory)) (setq inhibit-startup-screen t @@ -19,57 +24,62 @@ undo-limit 10000000 undo-outer-limit 20000000 completion-cycle-threshold 5 - + shr-max-image-proportion 0.3 ;; X integration x-select-enable-clipboard t x-select-enable-primary t - ring-bell-function 'ignore) -(display-time-mode) -(line-number-mode) -(column-number-mode) -(setq-default fill-column 80) -(setq-default frame-title-format '("%b")) - -;; Put Emacs auto-save and backup files to /tmp -(defconst emacs-tmp-dir (expand-file-name (format "emacs%d" (user-uid)) temporary-file-directory)) -(setq - backup-by-copying t - delete-old-versions t - kept-new-versions 6 - kept-old-versions 2 - version-control t - make-backup-files nil - auto-save-list-file-prefix emacs-tmp-dir - auto-save-file-name-transforms `((".*" ,emacs-tmp-dir t)) ; Change autosave dir to tmp - backup-directory-alist `((".*" . ,emacs-tmp-dir))) - -;; Packages -(setq package-list '( - magit - nix-mode - go-mode - devdocs - rec-mode - almost-mono-themes - markdown-mode - yasnippet - avy - yasnippet-snippets - tldr - elfeed - yasnippet-snippets - mastodon - lem - expand-region)) - -(require 'package) - -;; list the repositories containing them -(setq package-archives '(("elpa" . "https://elpa.gnu.org") + ring-bell-function 'ignore + + ;; Backups + backup-by-copying t + delete-old-versions t + kept-new-versions 6 + kept-old-versions 2 + version-control t + make-backup-files nil + auto-save-list-file-prefix emacs-tmp-dir + auto-save-file-name-transforms `((".*" ,emacs-tmp-dir t)) ; Change autosave dir to tmp + backup-directory-alist `((".*" . ,emacs-tmp-dir)) + + ;; Package list + package-list '( + magit + nix-mode + go-mode + devdocs + rec-mode + almost-mono-themes + markdown-mode + yasnippet + avy + yasnippet-snippets + tldr + elfeed + elfeed-protocol + yasnippet-snippets + mastodon + lem + expand-region) + package-archives '(("elpa" . "https://elpa.gnu.org") ("gnu" . "http://elpa.gnu.org/packages/") ("melpa" . "https://melpa.org/packages/") ("melpa-stable" . "https://stable.melpa.org/packages/"))) +(setq-default fill-column 80 + grep-template (string-join '("ugrep" + "--color=never" + "--ignore-binary" + "--ignore-case" + "--include=" + "--line-number" + "--null" + "--recursive" + "--regexp=") + " ") + frame-title-format '("%b")) + + + ;; activate all thpe packages (in particular autoloads) (package-initialize) @@ -82,8 +92,6 @@ (unless (package-installed-p package) (package-install package))) -;; Avy - (use-package avy :ensure t :config @@ -168,7 +176,14 @@ ;; Html -(add-to-list 'auto-mode-alist '("\\.njk\\'" . html-mode)) +(use-package sgml-mode + :init + (add-to-list 'auto-mode-alist '("\\.njk\\'" . html-mode)) + :hook + ((html-mode . (lambda() + (setq sgml-basic-offset 8 + indent-tabs-mode t))))) + ;; Markdown (use-package markdown-mode @@ -181,21 +196,20 @@ (markdown-mode . markdown-toggle-markup-hiding) (markdown-mode . visual-line-mode))) - - -;; Pairs -(electric-pair-mode 1) -(global-set-key (kbd "M-{") 'insert-pair) -(global-set-key (kbd "M-\"") 'insert-pair) -(global-set-key (kbd "M-\'") 'insert-pair) -(global-set-key (kbd "M-<") 'insert-pair) -(global-set-key (kbd "M-[") 'insert-pair) - -;; IDO -(ido-mode t) +(use-package elec-pair + :init + (electric-pair-mode 1) + :config + (global-set-key (kbd "M-{") 'insert-pair) + (global-set-key (kbd "M-\"") 'insert-pair) + (global-set-key (kbd "M-\'") 'insert-pair) + (global-set-key (kbd "M-<") 'insert-pair) + (global-set-key (kbd "M-[") 'insert-pair)) +(use-package ido + :init + (ido-mode t)) -;; Eglot (use-package nix-mode :ensure t :hook @@ -216,58 +230,35 @@ (nix-mode . eglot-ensure) (go-mode . eglot-ensure)) - - - (use-package go-mode :ensure t :hook ((before-save . eglot-format-buffer))) - -;; HTML -(add-hook 'html-mode-hook - (lambda() - (setq sgml-basic-offset 8) - (setq indent-tabs-mode t))) - (add-to-list 'load-path "~/.emacs.d/elisp") -(add-to-list 'custom-theme-load-path "~/.emacs.d/themes") -(setq-default grep-template (string-join '("ugrep" - "--color=never" - "--ignore-binary" - "--ignore-case" - "--include=" - "--line-number" - "--null" - "--recursive" - "--regexp=") - " ")) - -(require 'secrets) -(require 'auth-source-pass (auth-source-pass-enable)) - - -(global-set-key - "\C-cef" - (lambda () - (interactive) - (erc :server - "irc.libera.chat" :port "6667" :nick "mccd" - :password (shell-command-to-string "pass show libera.chat")))) - -(setq shr-max-image-proportion 0.3 - mastodon-active-user "marcc" - mastodon-instance-url "https://fosstodon.org") +(use-package erc + :config + (setq erc-autojoin-channels-alist + '(("Libera.Chat" "#emacs" "#permacomputing" "oldcomputerchallenge" "lobsters" "netbsd"))) + + (global-set-key + "\C-cef" + (lambda () + (interactive) + (erc :server + "irc.libera.chat" :port "6667" :nick "mccd" + :password (shell-command-to-string "pass show libera.chat"))))) ;; Org (use-package org :ensure t :init - (global-set-key (kbd "C-c l") #'org-store-link) - (global-set-key (kbd "C-c a") #'org-agenda) - (global-set-key (kbd "C-c c") #'org-capture) - (global-set-key (kbd "C-c s") #'project-find-regexp) + (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode)) + (org-babel-do-load-languages + 'org-babel-load-languages + '((shell . t))) + + :config (setq org-agenda-files '("~/personal-db/notes") org-refile-targets '((nil :maxlevel . 2) @@ -294,19 +285,14 @@ entry (file+headline "~/personal-db/notes/inbox.org" "Notes") "** %?\n%T" :empty-lines 1))) - - (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode)) - - (org-babel-do-load-languages - 'org-babel-load-languages - '((shell . t))) - - - :config (set-face-attribute 'org-block nil :inherit 'fixed-pitch) (set-face-attribute 'org-code nil :inherit 'fixed-pitch) (set-face-attribute 'org-table nil :inherit 'fixed-pitch) - + (global-set-key (kbd "C-c l") #'org-store-link) + (global-set-key (kbd "C-c a") #'org-agenda) + (global-set-key (kbd "C-c c") #'org-capture) + (global-set-key (kbd "C-c s") #'project-find-regexp) + :hook ((org-mode . auto-save-mode)) (org-mode . org-indent-mode) @@ -396,7 +382,7 @@ (mu4e-trash-folder . "/home/Trash") (mu4e-sent-messages-behavior . sent) - (mu4e-maildir-shortcuts . +ppp (mu4e-maildir-shortcuts . (("/home/INBOX" . ?i) ("/home/Archive/Done" . ?d) ("/home/Archive" . ?a) @@ -422,33 +408,46 @@ ("/work/INBOX" . ?i)))))))) -;; Lem - -(setq lem-instance-url "https://lemmy.sdf.org") +(use-package lem + :ensure t + :config + (setq lem-instance-url "https://lemmy.sdf.org")) -;; Elfeed -(require 'elfeed) -;; curl recommend -(setq elfeed-use-curl t) -(elfeed-set-timeout 36000) -(setq elfeed-curl-extra-arguments '("--insecure")) ;necessary for https without a trust certificate +(use-package elfeed-protocol + :ensure t + :init + (elfeed-protocol-enable)) -;; setup feeds -(setq elfeed-protocol-fever-update-unread-only t) -(setq elfeed-protocol-fever-fetch-category-as-tag t) -(setq elfeed-protocol-feeds '(("fever+https://freshrss@rss.mccd.space" - :api-url "https://rss.mccd.space/api/fever.php" - :password (shell-command-to-string "pass show mccd/freshrss")))) -;; enable elfeed-protocol -(setq elfeed-protocol-enabled-protocols '(fever)) -(elfeed-protocol-enable) -(global-set-key (kbd "C-x w") 'elfeed) +(use-package elfeed + :ensure t + :config + (setq elfeed-use-curl t + ;; setup feeds + elfeed-protocol-fever-update-unread-only t + elfeed-protocol-fever-fetch-category-as-tag t + elfeed-protocol-feeds '(("fever+https://freshrss@rss.mccd.space" + :api-url "https://rss.mccd.space/api/fever.php" + :password (shell-command-to-string "pass show mccd/freshrss"))) + ;; enable elfeed-protocol + elfeed-protocol-enabled-protocols '(fever) + elfeed-curl-extra-arguments '("--insecure")) ;necessary for https without a trust certificate + (elfeed-set-timeout 36000) + (global-set-key (kbd "C-x w") 'elfeed)) + +(use-package mastodon + :ensure t + :config + (setq + mastodon-active-user "marcc" + mastodon-instance-url "https://fosstodon.org")) ;; Eww -(setq - browse-url-browser-function 'eww-browse-url ; Use eww as the default browser - shr-width 70 ; Fold text to 70 columns - ) +(use-package eww + :config + (setq + browse-url-browser-function 'eww-browse-url ; Use eww as the default browser + shr-width 70)) + (custom-set-faces ;; custom-set-faces was added by Custom. -- cgit v1.2.3