Remove double quotes and flatten "f...@bar.com <f...@bar.com>" to "f...@bar.com". --- emacs/notmuch-show.el | 30 ++++++++++++++++++++++++++++-- 1 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 07cf846..2838968 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -26,6 +26,7 @@ (require 'message) (require 'mm-decode) (require 'mailcap) +(require 'mail-parse) (require 'notmuch-lib) (require 'notmuch-query) @@ -204,12 +205,26 @@ same as that of the previous message." 'face 'notmuch-tag-face) ")")))))) +(defun notmuch-show-clean-address (parsed-address) + "Clean a single email address for display." + (let ((address (car parsed-address)) + (name (cdr parsed-address))) + ;; If the address is 'f...@bar.com <f...@bar.com>' then show just + ;; 'f...@bar.com'. + (when (string= name address) + (setq name nil)) + + (if (not name) + address + (concat name " <" address ">")))) + (defun notmuch-show-insert-headerline (headers date tags depth) "Insert a notmuch style headerline based on HEADERS for a message at DEPTH in the current thread." (let ((start (point))) (insert (notmuch-show-spaces-n depth) - (plist-get headers :From) + (notmuch-show-clean-address + (mail-header-parse-address (plist-get headers :From))) " (" date ") (" @@ -220,7 +235,18 @@ message at DEPTH in the current thread." (defun notmuch-show-insert-header (header header-value) "Insert a single header." - (insert header ": " header-value "\n")) + (insert header ": " + (cond + ((or (string= "To" header) + (string= "Cc" header) + (string= "Bcc" header) + (string= "From" header)) + (mapconcat 'notmuch-show-clean-address + (mail-header-parse-addresses header-value) + ", ")) + (t + header-value)) + "\n")) (defun notmuch-show-insert-headers (headers) "Insert the headers of the current message." -- 1.7.2.3 _______________________________________________ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch