summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil Orbekk <kj@orbekk.com>2023-10-31 21:23:30 -0400
committerKjetil Orbekk <kj@orbekk.com>2023-10-31 21:23:30 -0400
commitba32751a0f9d013ce98f5db0cbef0a6cc6653e72 (patch)
tree006246708bcc993e35c3db34daa332e261e519a0
parent274ea7e40a7dfcce4a7d09efb1f2d507416b3905 (diff)
email fixes
-rw-r--r--emacs/.config/emacs-kj/init.el5
-rw-r--r--emacs/.config/emacs-kj/lisp/kj-email.el26
2 files changed, 27 insertions, 4 deletions
diff --git a/emacs/.config/emacs-kj/init.el b/emacs/.config/emacs-kj/init.el
index dc4e2da..77c68f9 100644
--- a/emacs/.config/emacs-kj/init.el
+++ b/emacs/.config/emacs-kj/init.el
@@ -79,10 +79,9 @@
(dolist (mode '(calendar-mode-hook
eshell-mode-hook
term-mode-hook
- comint-mode-hook
- notmuch-show-mode))
+ comint-mode-hook))
(add-hook mode
- (lambda (&rest args)
+ (defun kj/disable-trailing-whitespace ()
(setq show-trailing-whitespace nil))))
;; Deletes trailing whitespace on changed lines only.
diff --git a/emacs/.config/emacs-kj/lisp/kj-email.el b/emacs/.config/emacs-kj/lisp/kj-email.el
index f398eb2..87e75bd 100644
--- a/emacs/.config/emacs-kj/lisp/kj-email.el
+++ b/emacs/.config/emacs-kj/lisp/kj-email.el
@@ -14,9 +14,11 @@
notmuch-hello-tag-list-make-query "tag:unread"
notmuch-archive-tags '("-inbox" "-unread")
notmuch-fcc-dirs nil
- notmuch-show-logo nil)
+ notmuch-show-logo nil
+ notmuch-show-indent-messages-width 0)
(add-hook 'message-mode-hook 'turn-off-auto-fill)
(add-hook 'message-mode-hook 'visual-line-mode)
+ (add-hook 'notmuch-show-hook 'kj/disable-trailing-whitespace)
(defun kj/confirm-empty-subject ()
"Allow user to quit when current message subject is empty."
@@ -37,6 +39,28 @@
(:name "all mail" :query "*" :key "a" :search-type tree)
)))
+ (setq kj/notmuch-wash-citation-regexp "\\(^[[:space:]]*\\)\\(>+\\)\\(.*\n+\\)")
+
+ (defun kj/notmuch-wash-citations-by-depth (_msg _depth)
+ (goto-char (point-min))
+ (beginning-of-line)
+ (while (and (< (point) (point-max))
+ (re-search-forward kj/notmuch-wash-citation-regexp nil t))
+
+ (let ((maxlevel 1))
+ (while (intern-soft (format "message-cited-text-%d" maxlevel))
+ (setq maxlevel (1+ maxlevel)))
+ (setq maxlevel (1- maxlevel))
+
+ (let* ((cite-start (match-beginning 0))
+ (cite-end (match-end 0))
+ (cite-level (min (length (match-string 2))
+ maxlevel))
+ (cited-text-face (intern (format "message-cited-text-%d" cite-level))))
+ (overlay-put (make-overlay cite-start cite-end)
+ 'face cited-text-face)))))
+ (add-hook 'notmuch-show-insert-text/plain-hook #'kj/notmuch-wash-citations-by-depth 90)
+
(defun kj/notmuch-tree-by-tag (tag)
(interactive
(list (notmuch-select-tag-with-completion "Notmuch search tag: ")))