summaryrefslogtreecommitdiffhomepage
path: root/notmuch.org
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-09-01 02:04:32 +0100
committerjao <jao@gnu.org>2021-09-01 02:04:32 +0100
commit71290eea7350ddbc57f9ae0813dae6233d45b4d1 (patch)
tree04dfd18495ec99acb6f012822c7a293c45a0a80f /notmuch.org
parent6d6f596043e5cf190a2d40534cfc70ffeabb9536 (diff)
downloadelibs-71290eea7350ddbc57f9ae0813dae6233d45b4d1.tar.gz
elibs-71290eea7350ddbc57f9ae0813dae6233d45b4d1.tar.bz2
notmuch: using the latest jao-notmuch thingies
Diffstat (limited to 'notmuch.org')
-rw-r--r--notmuch.org39
1 files changed, 31 insertions, 8 deletions
diff --git a/notmuch.org b/notmuch.org
index a0af9b5..3494938 100644
--- a/notmuch.org
+++ b/notmuch.org
@@ -295,20 +295,43 @@
* tree
#+begin_src emacs-lisp
(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 ")
+ ("authors" . "%-35s")
+ (jao-notmuch--msg-ticks)
+ (jao-notmuch--tree-subject)
+ ("tags" . " (%s)"))
+ notmuch-unthreaded-result-format notmuch-tree-result-format
+ notmuch-tree-thread-symbols
+ '((prefix . "─") (top . "─") (top-tee . "┬")
+ (vertical . "│") (vertical-tee . "├") (bottom . "╰")
+ (arrow . "")))
+
:config
+
(let ((fg (face-attribute 'jao-themes-dimm :foreground)))
(dolist (f '(notmuch-tree-match-tree-face
notmuch-tree-no-match-tree-face))
(set-face-attribute f nil :family "Fira Code" :foreground fg)))
- (defun jao-notmuch--format-field (fun field fmt msg)
- (let ((rs (funcall fun field fmt msg)))
- (cond ((and (stringp field) (string= field "tree"))
- (replace-regexp-in-string "►" "" rs)) ;; "→"
- (t (truncate-string-to-width rs 102 nil nil t)))))
-
- (advice-add 'notmuch-tree-format-field :around #'jao-notmuch--format-field)
-
(jao-notmuch-tree-setup "T")
:bind (:map notmuch-tree-mode-map