From 4f7050f5a08e9624e19950e28d9a6ec6d4b1f1c1 Mon Sep 17 00:00:00 2001 From: jao Date: Sun, 12 Sep 2021 02:28:41 +0100 Subject: notmuch: separate formatters and co. --- notmuch.org | 103 +++++++++++++++++++++++++++++------------------------------- 1 file changed, 50 insertions(+), 53 deletions(-) (limited to 'notmuch.org') diff --git a/notmuch.org b/notmuch.org index 435a617..463bcac 100644 --- a/notmuch.org +++ b/notmuch.org @@ -112,15 +112,16 @@ notmuch-show-mark-read-tags '("-new" "-unread") notmuch-tag-formats (let ((d `(:foreground ,(face-attribute 'jao-themes-dimm :foreground))) - (e `(:foreground ,(face-attribute 'jao-themes-error :foreground)))) + (e `(:foreground ,(face-attribute 'jao-themes-error :foreground) + :weight bold))) `(("unread") ("signed") ("new" "N") ("replied" "โ†ฉ" (propertize tag 'face '(:family "Fira Code"))) ("sent" "S") ("attachment" "๐Ÿ“Ž") - ("deleted" "ร—ร—ร—" (propertize tag 'face '(:underline nil ,@e))) - ("flagged" "*" (propertize tag 'face ',e)) + ("deleted" "๐Ÿ—™" (propertize tag 'face '(:underline nil ,@e))) + ("flagged" "!" (propertize tag 'face ',e)) ("jao" "j") ("bigml" "b") ("feeds" "f"))) @@ -302,35 +303,19 @@ (use-package notmuch-tree :init - (defun jao-notmuch--truncate (x) - (truncate-string-to-width (format "%-102s" x) 102 nil nil t)) - - (defun jao-notmuch--msg-ticks (_ msg) - (let ((headers (plist-get msg :headers))) - (cond ((string-match-p jao-mails-regexp (or (plist-get headers :To) "")) - (propertize " ยป" 'face 'notmuch-tree-match-tree-face)) - ((string-match-p jao-mails-regexp (or (plist-get headers :Cc) "")) - (propertize " ยฌ" 'face 'notmuch-tree-match-tree-face)) - (t " ")))) - - (defun jao-notmuch--tree-subject (_ msg) - (thread-first '(("tree" . " %s") ("subject" . " %s")) - (notmuch-tree-format-field-list msg) - (jao-notmuch--truncate))) - (setq notmuch-tree-result-format - '(("date" . "%12s ") + `(("date" . "%12s ") ("authors" . "%-35s") - (jao-notmuch--msg-ticks . "%s") - (jao-notmuch--tree-subject . "%s") - ("tags" . " (%s)")) + (jao-notmuch-msg-ticks . ,jao-mails-regexp) + (jao-notmuch-tree-and-subject . "%>-102s") + (jao-notmuch-format-tags . " (%s)")) notmuch-unthreaded-result-format notmuch-search-result-format consult-notmuch-result-format - '((jao-notmuch--msg-ticks) + `((jao-notmuch-msg-ticks . ,jao-mails-regexp) ("date" . "%12s ") ("authors" . "%-35s") ("subject" . " %-100s") - ("tags" . " (%s)")) + (jao-notmuch-format-tags . " (%s)")) notmuch-tree-thread-symbols '((prefix . "โ”€") (top . "โ”€") (top-tee . "โ”ฌ") (vertical . "โ”‚") (vertical-tee . "โ”œ") (bottom . "โ•ฐ") @@ -345,35 +330,44 @@ (jao-notmuch-tree-setup "T") + (defun jao-notmuch-tree--forward (&optional prev) + (interactive) + (forward-line (if prev -1 1)) + (jao-notmuch-tree-scroll-or-next)) + + (defun jao-notmuch-tree--backward () + (interactive) + (jao-notmuch-tree--forward t)) + :bind (:map notmuch-tree-mode-map - (("b" . jao-notmuch-browse-urls) - ("C" . jao-notmuch-echo-count) - ("d" . jao-notmuch-tree-delete-message) - ("D" . jao-notmuch-tree-delete-thread) - ("h" . jao-notmuch-goto-message-buffer) - ("H" . jao-notmuch-click-message-buffer) - ("i" . jao-notmuch-show-images) - ("K" . jao-notmuch-tag-jump-and-next) - ("k" . jao-notmuch-tree-read-thread) - ("n" . jao-notmuch-tree-next) - ("N" . jao-notmuch-tree-next-thread) - ("O" . notmuch-tree-toggle-order) - ("o" . jao-notmuch-tree-widen-search) - ("p" . jao-notmuch-tree-previous) - ("P" . jao-notmuch-tree-previous-thread) - ("r" . notmuch-tree-reply) - ("R" . notmuch-tree-reply-sender) - ("s" . jao-notmuch-tree-spam) - ("u" . jao-notmuch-tree-flag) - ("v" . notmuch-tree-scroll-message-window) - ("V" . notmuch-tree-scroll-message-window-back) - ("<" . jao-notmuch-tree-beginning-of-buffer) - (">" . jao-notmuch-tree-end-of-buffer) - ("/" . notmuch-tree-view-raw-message) - ("." . jao-notmuch-toggle-mime-parts) - ("=" . jao-notmuch-tree-toggle-message) - ("RET" . jao-notmuch-tree-show-or-scroll) - ("SPC" . jao-notmuch-tree-scroll-or-next)))) + (("b" . jao-notmuch-browse-urls) + ("C" . jao-notmuch-echo-count) + ("d" . jao-notmuch-tree-delete-message) + ("D" . jao-notmuch-tree-delete-thread) + ("h" . jao-notmuch-goto-message-buffer) + ("H" . jao-notmuch-click-message-buffer) + ("i" . jao-notmuch-show-images) + ("K" . jao-notmuch-tag-jump-and-next) + ("k" . jao-notmuch-tree-read-thread) + ("n" . jao-notmuch-tree-next) + ("N" . jao-notmuch-tree--forward) + ("O" . notmuch-tree-toggle-order) + ("o" . jao-notmuch-tree-widen-search) + ("p" . jao-notmuch-tree-previous) + ("P" . jao-notmuch-tree--backward) + ("r" . notmuch-tree-reply) + ("R" . notmuch-tree-reply-sender) + ("s" . jao-notmuch-tree-spam) + ("u" . jao-notmuch-tree-flag) + ("v" . notmuch-tree-scroll-message-window) + ("V" . notmuch-tree-scroll-message-window-back) + ("<" . jao-notmuch-tree-beginning-of-buffer) + (">" . jao-notmuch-tree-end-of-buffer) + ("/" . notmuch-tree-view-raw-message) + ("." . jao-notmuch-toggle-mime-parts) + ("=" . jao-notmuch-tree-toggle-message) + ("RET" . jao-notmuch-tree-show-or-scroll) + ("SPC" . jao-notmuch-tree-scroll-or-next)))) #+end_src * consult #+begin_src emacs-lisp @@ -424,6 +418,9 @@ (link (concat "notmuch:" id)) (description (format "Mail: %s" (notmuch-show-get-subject)))) + (if (derived-mode-p 'notmuch-show-mode) + (notmuch-show-archive-message) + (notmuch-tree-archive-message)) (org-store-link-props :type "notmuch" :link link -- cgit v1.2.3