[PATCH 1/2] emacs: remove some code duplication in notmuch-show
Dmitry Kurochkin
dmitry.kurochkin at gmail.com
Fri Nov 25 14:23:30 PST 2011
Add optional props argument to `notmuch-show-get-header'. Use it to
get headers in `notmuch-show-insert-part-multipart/signed' and
`notmuch-show-insert-part-multipart/encrypted'.
---
emacs/notmuch-show.el | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 7be88f8..bcc436f 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -450,8 +450,7 @@ current buffer, if possible."
(button-put button 'face '(:foreground "blue"))
;; add signature status button if sigstatus provided
(if (plist-member part :sigstatus)
- (let* ((headers (plist-get msg :headers))
- (from (plist-get headers :From))
+ (let* ((from (notmuch-show-get-header :From msg))
(sigstatus (car (plist-get part :sigstatus))))
(notmuch-crypto-insert-sigstatus-button sigstatus from))
;; if we're not adding sigstatus, tell the user how they can get it
@@ -477,8 +476,7 @@ current buffer, if possible."
(notmuch-crypto-insert-encstatus-button encstatus)
;; add signature status button if sigstatus specified
(if (plist-member part :sigstatus)
- (let* ((headers (plist-get msg :headers))
- (from (plist-get headers :From))
+ (let* ((from (notmuch-show-get-header :From msg))
(sigstatus (car (plist-get part :sigstatus))))
(notmuch-crypto-insert-sigstatus-button sigstatus from))))
;; if we're not adding encstatus, tell the user how they can get it
@@ -1079,9 +1077,9 @@ All currently available key bindings:
"Return the filename of the current message."
(notmuch-show-get-prop :filename))
-(defun notmuch-show-get-header (header)
+(defun notmuch-show-get-header (header &optional props)
"Return the named header of the current message, if any."
- (plist-get (notmuch-show-get-prop :headers) header))
+ (plist-get (notmuch-show-get-prop :headers props) header))
(defun notmuch-show-get-cc ()
(notmuch-show-get-header :Cc))
--
1.7.7.3
More information about the notmuch
mailing list