summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinwit <inwit@sindominio.net>2022-07-20 18:24:36 +0200
committerinwit <inwit@sindominio.net>2022-07-20 18:24:36 +0200
commit90c1125661426eabe7fa2e40a6ed82ee0d2f0b99 (patch)
treeaece40a0f0962b0daa8c7cd96d28d14140df16f5
parentac6f9ab57df422d5956a95fa5857008709816a7f (diff)
Show recipient in unthreaded sent messages list
-rw-r--r--emacstips.mdwn30
1 files changed, 30 insertions, 0 deletions
diff --git a/emacstips.mdwn b/emacstips.mdwn
index 5864177..3e7444c 100644
--- a/emacstips.mdwn
+++ b/emacstips.mdwn
@@ -967,3 +967,33 @@ discouraged type list. For example:
This would discourage text/html and multipart/related generally, but discourage
text/plain should the message be sent from whatever@mail.address.com.
+
+## See the recipient address instead of your address when listing sent messages
+
+If you like to see your sent messages in unthreaded view, by default you will
+see your address in the authors column, which is maybe not what you want. The
+following code allows for showing the recipients if your email address (an
+arbitrary address, whatever@mail.address.com in the example) is included in the
+From field.
+
+ (defun my/notmuch-unthreaded-show-recipient-if-sent (format-string result)
+ (let* ((headers (plist-get result :headers))
+ (to (plist-get headers :To))
+ (author (plist-get headers :From))
+ (face (if (plist-get result :match)
+ 'notmuch-tree-match-author-face
+ 'notmuch-tree-no-match-author-face)))
+ (propertize
+ (format format-string
+ (if (string-match "whatever@mail.address.com" author)
+ (concat "↦ " (notmuch-tree-clean-address to))
+ (notmuch-tree-clean-address to)
+ author))
+ 'face face)))
+
+ (setq notmuch-unthreaded-result-format
+ '(("date" . "%12s ")
+ (my/notmuch-unthreaded-show-recipient-if-sent . "%-20.20s")
+ ((("subject" . "%s"))
+ . " %-54s ")
+ ("tags" . "(%s)")))