From f46b70ad06e1575409a6bf18efcf8165e61cc2ba Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 23 Apr 2021 01:22:39 +0100 Subject: notmuch: prettier tree index --- email.org | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'email.org') diff --git a/email.org b/email.org index c7ff6a4..eaac4c2 100644 --- a/email.org +++ b/email.org @@ -523,15 +523,17 @@ :config (defun jao-mail-clean-address (fun address) - (let ((address (if (string-match ".+ updates on arXiv.org: \\(.+\\)" - address) - (with-temp-buffer - (insert (match-string 1 address)) - (let ((shr-width 1000)) - (shr-render-region (point-min) (point-max))) - (buffer-string)) - address))) - (funcall fun address))) + (let ((address (if (string-match ".+ updates on arXiv.org: \\(.+\\)" + address) + (with-temp-buffer + (insert (match-string 1 address)) + (let ((shr-width 1000)) + (shr-render-region (point-min) (point-max))) + (buffer-string)) + (replace-regexp-in-string "^ElDiario.es - ElDiario.es" + "ElDiario.es" + address)))) + (funcall fun address))) (advice-add 'notmuch-clean-address :around #'jao-mail-clean-address) @@ -549,13 +551,13 @@ (setq notmuch-tree-result-format '(("date" . "%12s ") ("authors" . "%-35s") - ((("tree" . "%s ")("subject" . "%s")) . " %-95s") + ((("tree" . "%s ")("subject" . "%s")) . " %-100s") ("tags" . " (%s)")) notmuch-search-result-format '(("date" . "%12s ") ("count" . "%-7s ") ("authors" . "%-35s") - ("subject" . "%-95s") + ("subject" . "%-100s") ("tags" . "(%s)")) notmuch-unthreaded-result-format notmuch-tree-result-format) @@ -574,11 +576,12 @@ (defun jao-notmuch--format-field (fun field &rest args) (let ((rs (apply fun field args))) - (if (and (stringp field) (string= field "tree")) - (thread-last (replace-regexp-in-string "►" "➤" rs) - (replace-regexp-in-string "╰" "├")) - ;; (thread-last (replace-regexp-in-string "►" "➤" rs) - rs))) + (cond ((and (stringp field) (string= field "tree")) + (propertize (replace-regexp-in-string "►" ">" rs) ;; "➤" + 'face + '(:family "Source Code Pro" :foreground "grey60"))) + ((not (stringp field)) (truncate-string-to-width rs 100)) + (t rs)))) (advice-add 'notmuch-tree-format-field :around #'jao-notmuch--format-field) -- cgit v1.2.3