From 8d2b7bd80aeca69b44565ff80ee0349e5fc550b1 Mon Sep 17 00:00:00 2001 From: Marc Coquand Date: Wed, 13 Nov 2024 10:40:33 +0200 Subject: . --- home/dots/.emacs | 319 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 164 insertions(+), 155 deletions(-) diff --git a/home/dots/.emacs b/home/dots/.emacs index 3998622..c3469f8 100644 --- a/home/dots/.emacs +++ b/home/dots/.emacs @@ -1,70 +1,46 @@ ;; -*- lexical-binding: t; -*- (add-to-list 'load-path "~/.emacs.d/elisp") -(fset 'yes-or-no-p 'y-or-n-p) -(setq - default-frame-alist '((font . "Iosevka SS13 Extended") - (height . 150) - (line-spacing . 0.5)) - ;; undo - undo-limit 10000000 - undo-outer-limit 20000000 - tab-always-indent 'complete - text-mode-ispell-word-completion nil - - ;; Package list - package-list '(almost-mono-themes - avy - corfu - devdocs - diminish - ednc - eldoc-box - elfeed - elfeed-protocol - enwc - emms - expand-region - exwm - geiser - geiser-guile - git-gutter - git-gutter-fringe - go-mode - guix - pdf-tools - magit - markdown-mode - mastodon - nix-mode - nov - org-remark - pass - pinentry - rec-mode - tldr - transpose-frame - yasnippet - yasnippet-snippets - ws-butler) - - package-archives '(("elpa" . "https://elpa.gnu.org") - ("gnu" . "http://elpa.gnu.org/packages/") - ("melpa" . "https://melpa.org/packages/") - ("non-gnu" . "https://elpa.nongnu.org/nongnu/") - ("melpa-stable" . "https://stable.melpa.org/packages/"))) - - -(read-extended-command-predicate #'command-completion-default-include-p) -;; UI -(menu-bar-mode -1) -(tool-bar-mode -1) - -(setq-default fill-column 80 - line-spacing 5 - cursor-type 'box - frame-title-format '("%b")) - -(set-cursor-color "#ff0000") + +(setq package-list + '(almost-mono-themes + avy + corfu + devdocs + diminish + ednc + eldoc-box + elfeed + elfeed-protocol + enwc + emms + expand-region + exwm + geiser + geiser-guile + git-gutter + git-gutter-fringe + go-mode + guix + pdf-tools + magit + markdown-mode + mastodon + nix-mode + nov + org-remark + pass + pinentry + rec-mode + tldr + transpose-frame + yasnippet + yasnippet-snippets + ws-butler) + package-archives '(("elpa" . "https://elpa.gnu.org") + ("gnu" . "http://elpa.gnu.org/packages/") + ("melpa" . "https://melpa.org/packages/") + ("non-gnu" . "https://elpa.nongnu.org/nongnu/") + ("melpa-stable" . "https://stable.melpa.org/packages/"))) (package-initialize) @@ -126,12 +102,11 @@ ;;(shell-command "xkbset -feedback sticky -twokey latchlock") ;;(shell-command "xkbset exp 64 '=sticky' '=twokey' '=latchlock'") (push ?\C-\\ exwm-input-prefix-keys) - :config - (setq - ring-bell-function 'ignore - default-directory "/home/mccd/" - focus-follows-mouse t - mouse-autoselect-window t) + :custom + (ring-bell-function 'ignore) + (default-directory "/home/mccd/") + (focus-follows-mouse t) + (mouse-autoselect-window t) :hook (;; Make sure titles match X window (exwm-update-title . (lambda () @@ -150,9 +125,30 @@ :config (exwm-randr-mode)) - (use-package diminish :ensure t) +(use-package emacs + :init + (fset 'yes-or-no-p 'y-or-n-p) + (menu-bar-mode -1) + (tool-bar-mode -1) + (setq-default fill-column 80 + line-spacing 5 + cursor-type 'box + frame-title-format '("%b")) + + (set-cursor-color "#ff0000") + :custom + (default-frame-alist '((font . "Iosevka SS13 Extended") + (height . 150) + (line-spacing . 0.5))) + ;; undo + (undo-limit 10000000) + (undo-outer-limit 20000000) + (tab-always-indent 'complete) + (text-mode-ispell-word-completion nil) + (read-extended-command-predicate #'command-completion-default-include-p )) + (use-package tab-bar :init (tab-bar-mode) @@ -212,7 +208,7 @@ ;; (corfu-quit-at-boundary nil) ;; Never quit at completion boundary ;; (corfu-quit-no-match nil) ;; Never quit, even if there is no match ;; (corfu-preview-current nil) ;; Disable current candidate preview - ;; (corfu-preselect 'prompt) ;; Preselect the prompt + (corfu-preselect 'prompt) ;; Preselect the prompt ;; (corfu-on-exact-match nil) ;; Configure handling of exact matches ;; Recommended: Enable Corfu globally. This is recommended since Dabbrev can @@ -298,6 +294,11 @@ (:map scheme-mode-map ("C-." . nil))) +(defun mccd/store-remarks () + (concat "~/personal-db/notes/" + (file-name-base (org-remark-notes-file-name-function)) + "-remark.org")) + (use-package org-remark :diminish org-remark-mode :diminish org-remark-global-tracking-mode @@ -314,19 +315,16 @@ ;; Alternative way to enable `org-remark-global-tracking-mode' in ;; `after-init-hook'. ;; :hook (after-init . org-remark-global-tracking-mode) + :custom + (org-remark-icon-notes nil) + (org-remark-use-org-id t) + (org-remark-notes-file-name #'mccd/store-remarks) :init ;; It is recommended that `org-remark-global-tracking-mode' be ;; enabled when Emacs initializes. Alternatively, you can put it to ;; `after-init-hook' as in the comment above (org-remark-global-tracking-mode +1) :config - (defun mccd/store-remarks () - (concat "~/personal-db/notes/" - (file-name-base (org-remark-notes-file-name-function)) - "-remark.org")) - (setq org-remark-icon-notes nil - org-remark-use-org-id t - org-remark-notes-file-name #'mccd/store-remarks) (use-package org-remark-info :after info :config (org-remark-info-mode +1)) (use-package org-remark-eww :after eww :config (org-remark-eww-mode +1)) (use-package org-remark-nov :after nov :config (org-remark-nov-mode +1))) @@ -382,26 +380,28 @@ ("u" . up-list) ("b" . backward-sexp) ("a" . beginning-of-defun)) + :custom + (repeat-on-final-keystroke t) + (set-mark-command-repeat-pop t) + (repeat-exit-key (kbd "")) :config - (setq repeat-on-final-keystroke t - set-mark-command-repeat-pop t - repeat-exit-key (kbd "")) (repeat-mode 1)) (use-package eww - :config - (setq eww-auto-rename-buffer t - eww-buffer-name-length 20) + :custom + (eww-auto-rename-buffer t) + (eww-buffer-name-length 20) :bind ((:map eww-mode-map ("+" . image-increase-size)))) (use-package enwc :ensure t + :custom + (enwc-default-backend 'nm) + (enwc-wired-device "lo") + (enwc-wireless-device "wlp61s0") :init - (setq enwc-default-backend 'nm - enwc-wired-device "lo" - enwc-wireless-device "wlp61s0") (defun list-notifications () (mapconcat #'ednc-format-notification (ednc-notifications) "")) @@ -426,7 +426,6 @@ ("s" . git-gutter:stage-hunk) ("r" . git-gutter:revert-hunk) ("p" . git-gutter:previous-hunk)) - :config :ensure t) (use-package git-gutter-fringe @@ -434,16 +433,16 @@ (use-package org-crypt :ensure nil + :custom + (auth-source-debug t) + (epg-gpg-program "gpg2") :init (setenv "GPG_AGENT_INFO" nil) - (setq auth-source-debug t - epg-gpg-program "gpg2") (org-crypt-use-before-save-magic)) (use-package grep - :config - (setq-default - grep-template (string-join + :custom + (grep-template (string-join '("ugrep" "--color=never" "--ignore-binary" @@ -462,10 +461,10 @@ (use-package epa-file + :custom + (epa-pinentry-mode 'loopback) :init - (epa-file-enable) - (setq - epa-pinentry-mode 'loopback)) + (epa-file-enable)) (use-package exwm-mff :demand t @@ -484,9 +483,9 @@ (use-package avy :ensure t + :custom + (avy-timeout-seconds 0.2) :config - (setq - avy-timeout-seconds 0.2) (global-set-key (kbd "M-o") 'avy-goto-char-timer) (set-face-attribute 'avy-lead-face nil :inherit 'fixed-pitch) (set-face-attribute 'avy-lead-face-0 nil :inherit 'fixed-pitch) @@ -609,6 +608,7 @@ :init (add-to-list 'auto-mode-alist '("\\.njk\\'" . html-mode)) (add-to-list 'auto-mode-alist '("\\.tmpl\\'" . html-mode)) + (add-to-list 'auto-mode-alist '("\\.js.tmpl\\'" . javascript-mode)) :config (define-key html-mode-map (kbd "M-") nil) (define-key html-mode-map (kbd "M-o") nil) @@ -627,13 +627,14 @@ :ensure t :demand t :diminish eldoc-mode - :config - (setq eldoc-print-after-edit t - echo-area-display-truncation-message nil - eldoc-echo-area-prefer-doc-buffer 'maybe - eldoc-echo-area-use-multiline-p nil) + :custom + (eldoc-print-after-edit t) + (echo-area-display-truncation-message nil) + (eldoc-echo-area-prefer-doc-buffer 'maybe) + (eldoc-echo-area-use-multiline-p nil) :hook (prog-mode . eldoc-mode)) + (use-package eldoc-box :ensure t :demand t @@ -671,6 +672,8 @@ :hook ((diary-mode . variable-pitch-mode) (diary-fancy-display-mode . variable-pitch-mode)) + :custom + (calendar-week-start-day 1) :config (global-set-key (kbd "C-c d") 'calendar) (calendar-set-date-style 'european) @@ -698,9 +701,9 @@ (go-mode . eglot-ensure)) (use-package tab-line - :config - (setq tab-line-close-button nil - tab-line-new-button-show nil) + :custom + (tab-line-close-button nil) + (tab-line-new-button-show nil) :bind (:map eww-mode-map ("M-" . eww-open-in-new-buffer)) @@ -731,16 +734,16 @@ (use-package erc :ensure t - :config - (setq erc-autojoin-channels-alist - '(("Libera.Chat" - "#emacs" - "#permacomputing" - "#oldcomputerchallenge" - "#go-nuts" - "#netbsd" - "#nonguix" - "#guix"))) + :custom + (erc-autojoin-channels-alist + '(("Libera.Chat" + "#emacs" + "#permacomputing" + "#oldcomputerchallenge" + "#go-nuts" + "#netbsd" + "#nonguix" + "#guix"))) :init (global-set-key "\C-ceo" @@ -774,30 +777,26 @@ ;; Org (use-package org :ensure t - :init - (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode)) - (org-babel-do-load-languages - 'org-babel-load-languages - '((shell . t) - (rec .t))) - :config - (setq org-refile-targets - '((nil :maxlevel . 4) - (org-agenda-files :maxlevel . 4)) - org-default-notes-file "~/personal-db/notes/todo.org" - org-hide-emphasis-markers t - org-agenda-include-diary nil - org-agenda-remove-tags t - org-link-keep-stored-after-insertion t - org-startup-folded t - org-agenda-inhibit-startup nil - ;; Add /New Heading at the end for use - org-refile-allow-creating-parent-nodes 'confirm - org-outline-path-complete-in-steps nil - org-refile-use-outline-path 'file - ;; Otherwise looks weird in variable-pitch-mode - org-log-done 'time - org-capture-templates + :custom + (org-refile-targets + '((nil :maxlevel . 4) + (org-agenda-files :maxlevel . 4))) + (org-default-notes-file "~/personal-db/notes/todo.org") + (org-hide-emphasis-markers t) + (org-agenda-include-diary nil) + (org-agenda-remove-tags t) + (org-link-keep-stored-after-insertion t) + (org-startup-folded t) + (org-todo-keywords + '((sequence "TODO" "DONE"))) + (org-agenda-inhibit-startup nil) + ;; Add /New Heading at the end for use + (org-refile-allow-creating-parent-nodes 'confirm) + (org-outline-path-complete-in-steps nil) + (org-refile-use-outline-path 'file) + ;; Otherwise looks weird in variable-pitch-mode + (org-log-done 'time) + (org-capture-templates '(("t" "Todo" entry (file "~/personal-db/notes/todo.org") "* TODO %?\n%i\n%a\n " @@ -840,6 +839,13 @@ entry (file "~/personal-db/notes/inbox.org") "* %?\n%U\n" :empty-lines 1))) + :init + (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode)) + (org-babel-do-load-languages + 'org-babel-load-languages + '((shell . t) + (rec .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) @@ -870,10 +876,11 @@ (org-mode . visual-line-mode) (org-mode . variable-pitch-mode))) + (use-package org-id :after org - :config - (setq org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id)) + :custom + (org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id)) (use-package autorevert :diminish auto-revert-mode) @@ -887,17 +894,18 @@ :demand t ;; Taken from https://igormelo.org/you_dont_need_org_alert.html ;; Enables notifications for org + :custom + (appt-message-warning-time 15) + (appt-display-interval 5) + (appt-display-mode-line nil) + (appt-disp-window-function + (lambda (remaining new-time msg) + (notifications-notify + :title (format "Scheduled for %s minutes" remaining) + :body msg + :urgency 'critical))) :config - (setq appt-message-warning-time 15 - appt-display-interval 5 - appt-display-mode-line nil - appt-disp-window-function (lambda (remaining new-time msg) - (notifications-notify - :title (format "Scheduled for %s minutes" remaining) - :body msg - :urgency 'critical))) - - (define-advice appt-activate (:after (&optional _arg) hold-your-horses) + (define-advice appt-activate (:after (&optional _arg) hold-your-horses) "`appt-activate' is too eager, rein it in." (remove-hook 'write-file-functions #'appt-update-list) (when (timerp appt-timer) @@ -1077,10 +1085,11 @@ ;; Requires mpv (use-package emms :ensure t + :custom + (emms-shop-format "on: %s") :init (add-hook 'emms-player-started-hook 'emms-show) :config - (setq emms-shop-format "on: %s") (emms-all) (emms-default-players)) -- cgit v1.2.3