[PATCH (alternative)] emacs: show: tweak handling of prefix-arg

Mark Walters markwalters1009 at gmail.com
Wed Oct 2 08:50:13 PDT 2013


Currently notmuch-show looks at the prefix-arg directly via
current-prefix-arg. This changes it to use the interactive
specification.
---

This alternative patch would avoid the problem described in
id:1380718788-18165-1-git-send-email-markwalters1009 at gmail.com It
changes notmuch-show to use more standard interactive calls to get the
prefix arg.

In fact my preference is for an even simpler solution: just remove the
prefix-arg functionality here. My main reason is that I would like to
use the prefix arg as the entry to pick (once pick is in mainline); it
would also simplify the code in notmuch-show. Of course it would remove
a little functionality.

What do people think?

Best wishes

Mark




 emacs/notmuch-show.el |    9 +++++----
 emacs/notmuch.el      |    5 +++--
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 5d7e24b..f7fa6da 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1080,13 +1080,13 @@ buttons for a corresponding notmuch search."
 	(make-text-button (first link) (second link)
 			  :type 'notmuch-button-type
 			  'action `(lambda (arg)
-				     (notmuch-show ,(third link)))
+				     (notmuch-show ,(third link) current-prefix-arg))
 			  'follow-link t
 			  'help-echo "Mouse-1, RET: search for this message"
 			  'face goto-address-mail-face)))))
 
 ;;;###autoload
-(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name)
+(defun notmuch-show (thread-id &optional prefix parent-buffer query-context buffer-name)
   "Run \"notmuch show\" with the given thread ID and display results.
 
 The optional PARENT-BUFFER is the notmuch-search buffer from
@@ -1102,7 +1102,8 @@ The optional BUFFER-NAME provides the name of the buffer in
 which the message thread is shown. If it is nil (which occurs
 when the command is called interactively) the argument to the
 function is used."
-  (interactive "sNotmuch show: ")
+  (interactive "sNotmuch show: 
+P")
   (let ((buffer-name (generate-new-buffer-name
 		      (or buffer-name
 			  (concat "*notmuch-" thread-id "*")))))
@@ -1114,7 +1115,7 @@ function is used."
     ;; `notmuch-show-elide-non-matching-messages' in this buffer. If
     ;; there is a prefix argument, invert the default.
     (setq notmuch-show-elide-non-matching-messages notmuch-show-only-matching-messages)
-    (if current-prefix-arg
+    (if prefix
 	(setq notmuch-show-elide-non-matching-messages (not notmuch-show-elide-non-matching-messages)))
 
     (setq notmuch-show-thread-id thread-id
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 0ff248b..5dda21f 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -486,13 +486,14 @@ If BARE is set then do not prefix with \"thread:\""
   "Return a list of authors for the current region"
   (notmuch-search-properties-in-region :subject beg end))
 
-(defun notmuch-search-show-thread ()
+(defun notmuch-search-show-thread (&optional prefix)
   "Display the currently selected thread."
-  (interactive)
+  (interactive "P")
   (let ((thread-id (notmuch-search-find-thread-id))
 	(subject (notmuch-search-find-subject)))
     (if (> (length thread-id) 0)
 	(notmuch-show thread-id
+		      prefix
 		      (current-buffer)
 		      notmuch-search-query-string
 		      ;; Name the buffer based on the subject.
-- 
1.7.9.1



More information about the notmuch mailing list