X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=emacs%2Fnotmuch-show.el;h=7913a129fd02533843211230eb19227635f580a0;hp=9c174e25e85576640a549f78924f6377bd91a566;hb=1650fd39ceec895c29f8fa9d8dd94d9bcbf374a0;hpb=4f04d2734f5e6a765aac05dbb205565774782123 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 9c174e25..7913a129 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -222,12 +222,30 @@ same as that of the previous message." 'face 'notmuch-tag-face) ")")))))) +(defun notmuch-show-clean-address (address) + "Clean a single email address for display." + (let* ((parsed (mail-header-parse-address address)) + (address (car parsed)) + (name (cdr parsed))) + ;; Remove double quotes. They might be required during transport, + ;; but we don't need to see them. + (when name + (setq name (replace-regexp-in-string "\"" "" name))) + ;; If the address is 'foo@bar.com ' then show just + ;; 'foo@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 (plist-get headers :From)) " (" date ") (" @@ -538,7 +556,7 @@ current buffer, if possible." (with-temp-buffer (let ((coding-system-for-read 'no-conversion)) (call-process notmuch-command nil t nil - "part" (format "--part=%s" part-number) message-id) + "show" "--format=raw" (format "--part=%s" part-number) message-id) (buffer-string)))) (defun notmuch-show-get-bodypart-content (msg part nth)