]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: show: modify insert-part-header to save the button text
authorMark Walters <markwalters1009@gmail.com>
Tue, 18 Dec 2012 19:27:57 +0000 (19:27 +0000)
committerDavid Bremner <bremner@debian.org>
Fri, 21 Dec 2012 13:54:30 +0000 (09:54 -0400)
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).

emacs/notmuch-show.el

index 4bdd5af1a66771cee5ed0529cdbdb394fd5d02dc..5248fba6533c3e6dd2ad7cbf828810c656324b7a 100644 (file)
@@ -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