[PATCH v2 3/3] emacs: show make default part button toggle view when sensible

Mark Walters markwalters1009 at gmail.com
Sun Dec 2 16:58:37 PST 2012


When the part has no filename it is reasonable to guess it is not a
part for saving or other normal attachment things so default to
toggling viewability. Possibly this should be customisable but the 4
main actions (save, view, open with, toggle viewability) all force
that particular action so it is easy for the user to get round if we
do make a mistake.
---
 emacs/notmuch-show.el |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 9a33d28..c8c1657 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1988,7 +1988,12 @@ the user (see `notmuch-show-stash-mlarchive-link-alist')."
 
 (defun notmuch-show-part-button-default (&optional button)
   (interactive)
-  (notmuch-show-part-button-internal button notmuch-show-part-button-default-action))
+  (let* ((button (or button (button-at (point))))
+	 (filename (and button (button-get button :notmuch-filename)))
+	 (handler (if filename
+		      notmuch-show-part-button-default-action
+		    #'notmuch-show-internally-show-part)))
+    (notmuch-show-part-button-internal button handler)))
 
 (defun notmuch-show-part-button-save (&optional button)
   (interactive)
-- 
1.7.9.1



More information about the notmuch mailing list