aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs
diff options
context:
space:
mode:
authorGravatar Mark Walters <markwalters1009@gmail.com>2012-12-18 19:27:57 +0000
committerGravatar David Bremner <bremner@debian.org>2012-12-21 09:54:30 -0400
commitfff2ea2ba9c11e16e1b54b04482ef49779e4826b (patch)
tree51fc36a420a69127f16ce1339685dd2bd9a31861 /emacs
parent8ba60168897e81133c85d9f4928b96ad4a4b6ffd (diff)
emacs: show: modify insert-part-header to save the button text
This just make notmuch-show-insert-part-header save the basic button text for parts as an attribute. This makes it simpler for the button action (added in a later patch) to reword the label as appropriate (eg append "(not shown)" or not as appropriate).
Diffstat (limited to 'emacs')
-rw-r--r--emacs/notmuch-show.el18
1 files changed, 9 insertions, 9 deletions
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 4bdd5af1..5248fba6 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -483,17 +483,17 @@ message at DEPTH in the current thread."
(fset 'notmuch-show-part-button-map notmuch-show-part-button-map)
(defun notmuch-show-insert-part-header (nth content-type declared-type &optional name comment)
- (let ((button))
+ (let ((button)
+ (base-label (concat (when name (concat name ": "))
+ declared-type
+ (unless (string-equal declared-type content-type)
+ (concat " (as " content-type ")"))
+ comment)))
+
(setq button
(insert-button
- (concat "[ "
- (if name (concat name ": ") "")
- declared-type
- (if (not (string-equal declared-type content-type))
- (concat " (as " content-type ")")
- "")
- (or comment "")
- " ]")
+ (concat "[ " base-label " ]")
+ :base-label base-label
:type 'notmuch-show-part-button-type
:notmuch-part nth
:notmuch-filename name