From 538e15f7078a7b886b52a4a90647b3e6fee49b84 Mon Sep 17 00:00:00 2001 From: Daneel Date: Sat, 28 Feb 2026 20:39:20 +0100 Subject: [PATCH] config: consolidate mu4e into single block, fix key conflicts - Merge 3 separate (after! mu4e) blocks into one - Fix key conflict: bookmark Today was ?t, same as maildir Trash New: Today=?d, Trash shortcut=?T (uppercase) - Remove duplicate mu4e-view-mode-hook (gnus-article-prepare-hook suffices) - Move sendmail + message-cite settings into the single block - Add inline comments explaining gnus-cite-* vs message-cited-text-* duplication (separate face systems, same visual intent) - Minor: group settings with section comments for readability --- config.el | 102 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 57 insertions(+), 45 deletions(-) diff --git a/config.el b/config.el index 55a3ecb..b9ea9ce 100644 --- a/config.el +++ b/config.el @@ -683,6 +683,7 @@ Skip for beamer exports — beamer uses adjustbox on plain tabular." (expand-file-name "/opt/homebrew/opt/mu/share/emacs/site-lisp/mu/mu4e")) (after! mu4e + ;; --- Mailbox layout --- (setq mu4e-maildir "~/.mail" mu4e-get-mail-command "mbsync personal" mu4e-update-interval 300 @@ -691,8 +692,10 @@ Skip for beamer exports — beamer uses adjustbox on plain tabular." mu4e-sent-folder "/personal/Sent" mu4e-drafts-folder "/personal/Drafts" mu4e-trash-folder "/personal/Trash" - mu4e-refile-folder "/personal/Archive" - mu4e-headers-show-threads t + mu4e-refile-folder "/personal/Archive") + + ;; --- Headers view --- + (setq mu4e-headers-show-threads t mu4e-headers-include-related t mu4e-use-fancy-chars t mu4e-headers-mark-for-thread t @@ -710,25 +713,63 @@ Skip for beamer exports — beamer uses adjustbox on plain tabular." mu4e-headers-thread-last-child-prefix '("└>" . "└▶ ") mu4e-headers-thread-duplicate-prefix '("=" . "≡ ")) - ;; Bookmarks — unread excludes Trash/Archive/Sent/Drafts/Spam + ;; --- Bookmarks --- + ;; Keys: u=Unread i=Inbox d=Today w=Week + ;; Note: ?d for Today avoids conflict with maildir shortcut ?t=Trash (setq mu4e-bookmarks '((:name "Unread" :query "flag:unread AND NOT maildir:/personal/Trash AND NOT maildir:/personal/Archive AND NOT maildir:/personal/Sent AND NOT maildir:/personal/Drafts AND NOT maildir:/personal/Spam" :key ?u) (:name "Inbox" :query "maildir:/personal/INBOX" :key ?i) - (:name "Today" :query "date:today AND NOT maildir:/personal/Trash AND NOT maildir:/personal/Archive AND NOT maildir:/personal/Sent" :key ?t) + (:name "Today" :query "date:today AND NOT maildir:/personal/Trash AND NOT maildir:/personal/Archive AND NOT maildir:/personal/Sent" :key ?d) (:name "Week" :query "date:7d..now AND NOT maildir:/personal/Trash AND NOT maildir:/personal/Archive AND NOT maildir:/personal/Sent" :key ?w))) - ;; Do not cite sender's signature in replies - (setq message-cite-function #'message-cite-original-without-signature) + ;; --- Maildir shortcuts (jump with 'j') --- + ;; Keys: i=INBOX s=Sent T=Trash a=Archive + ;; ?T (uppercase) for Trash avoids conflict with bookmark ?t (was Today) + (setq mu4e-maildir-shortcuts + '(("/personal/INBOX" . ?i) + ("/personal/Sent" . ?s) + ("/personal/Trash" . ?T) + ("/personal/Archive" . ?a))) - ;; Signature from file - (setq message-signature-file (expand-file-name "~/.mail/signature") - message-signature t) + ;; --- Sending --- + (setq sendmail-program "msmtp" + message-send-mail-function #'message-send-mail-with-sendmail + mail-specify-envelope-from t + message-sendmail-envelope-from 'header) - ;; Move cursor past headers to message body when opening a message + ;; --- Compose / reply --- + ;; message-cite-function is a message-mode setting but configured here + ;; because it only matters in the context of mu4e replies. + (setq message-cite-function #'message-cite-original-without-signature + message-signature-file (expand-file-name "~/.mail/signature") + message-signature t) + + ;; --- Citation colors --- + ;; gnus-cite-* : colors in the view (read) buffer + ;; message-cited-text-*: colors in the compose (reply) buffer + ;; Both use the same Dracula palette for visual consistency. + ;; Duplicate face names are intentional — gnus and message-mode + ;; use separate face systems even though they render the same content. + (setq gnus-cite-face-list + '(gnus-cite-1 gnus-cite-2 gnus-cite-3 gnus-cite-4)) + (custom-set-faces! + '(gnus-cite-1 :foreground "#8be9fd" :italic t) ; cyan — level 1 + '(gnus-cite-2 :foreground "#bd93f9" :italic t) ; purple — level 2 + '(gnus-cite-3 :foreground "#6272a4" :italic t) ; blue — level 3 + '(gnus-cite-4 :foreground "#44475a" :italic t) ; grey — level 4+ + '(message-cited-text-1 :foreground "#8be9fd" :italic t) + '(message-cited-text-2 :foreground "#bd93f9" :italic t) + '(message-cited-text-3 :foreground "#6272a4" :italic t) + '(message-cited-text-4 :foreground "#44475a" :italic t)) + + ;; --- View: skip to message body --- + ;; gnus-article-prepare-hook fires when the article buffer is ready, + ;; covering both the initial render and navigation between messages. + ;; No need for mu4e-view-mode-hook (that fires earlier, before content). (defun my/mu4e-view-goto-body () - "Position cursor at the start of the message body, skipping headers." + "Position cursor at message body, skipping RFC 2822 headers." (run-with-idle-timer 0.05 nil (lambda () @@ -736,23 +777,15 @@ Skip for beamer exports — beamer uses adjustbox on plain tabular." (with-current-buffer buf (goto-char (point-min)) (while (and (not (eobp)) - (looking-at "^\\([A-Za-z-]+:\\|[ \t]\\)")) + (looking-at "^\([A-Za-z-]+:\|[ \t]\)")) (forward-line 1)) - (while (and (not (eobp)) (looking-at "^\\s-*$")) + (while (and (not (eobp)) (looking-at "^\s-*$")) (forward-line 1))))))) (add-hook 'gnus-article-prepare-hook #'my/mu4e-view-goto-body) - (add-hook 'mu4e-view-mode-hook #'my/mu4e-view-goto-body) - ;; Maildir shortcuts - (setq mu4e-maildir-shortcuts - '(("/personal/INBOX" . ?i) - ("/personal/Sent" . ?s) - ("/personal/Trash" . ?t) - ("/personal/Archive" . ?a))) - - ;; Cursor on subject column after j/k navigation + ;; --- Headers: keep cursor on subject column after j/k --- (defun my/mu4e-goto-subject (&rest _) - "Move cursor to the start of the subject text in a mu4e headers line." + "Move cursor to the start of the subject text in a headers line." (when (derived-mode-p 'mu4e-headers-mode) (let* ((msg (mu4e-message-at-point t)) (subject (when msg (mu4e-message-field msg :subject)))) @@ -764,31 +797,10 @@ Skip for beamer exports — beamer uses adjustbox on plain tabular." (advice-add 'mu4e-headers-next :after #'my/mu4e-goto-subject) (advice-add 'mu4e-headers-prev :after #'my/mu4e-goto-subject) - ;; zT = toggle thread view (T alone marks thread for bulk action) + ;; zT = toggle thread view (plain T marks the thread for bulk action) (evil-define-key 'normal mu4e-headers-mode-map (kbd "zT") #'mu4e-headers-toggle-threading)) -(after! mu4e - (setq sendmail-program "msmtp" - message-send-mail-function #'message-send-mail-with-sendmail - mail-specify-envelope-from t - message-sendmail-envelope-from 'header)) - -;; Citation colors — visually separate quoted text from your reply -(after! mu4e - (setq gnus-cite-face-list - '(gnus-cite-1 gnus-cite-2 gnus-cite-3 gnus-cite-4)) - (custom-set-faces! - '(gnus-cite-1 :foreground "#8be9fd" :italic t) - '(gnus-cite-2 :foreground "#bd93f9" :italic t) - '(gnus-cite-3 :foreground "#6272a4" :italic t) - '(gnus-cite-4 :foreground "#44475a" :italic t) - '(message-cited-text-1 :foreground "#8be9fd" :italic t) - '(message-cited-text-2 :foreground "#bd93f9" :italic t) - '(message-cited-text-3 :foreground "#6272a4" :italic t) - '(message-cited-text-4 :foreground "#44475a" :italic t))) - - ;;; ============================================================ ;;; RSS — ELFEED ;;; ============================================================