[PATCH v1 2/3] emacs: Minor re-work of `notmuch-show-pipe-message'

David Edmondson dme at dme.org
Fri May 9 01:22:22 PDT 2014


Stylistic only - no functional change.
---
 emacs/notmuch-show.el | 59 +++++++++++++++++++++++++--------------------------
 1 file changed, 29 insertions(+), 30 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 2ed221a..62c0be6 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1784,36 +1784,35 @@ If ENTIRE-THREAD is non-nil (or when invoked with a prefix
 argument), COMMAND will receive all open messages in the current
 thread (formatted as an mbox) rather than only the current
 message."
-  (interactive (let ((query-string (if current-prefix-arg
-				       "Pipe all open messages to command: "
-				     "Pipe message to command: ")))
-		 (list current-prefix-arg (read-string query-string))))
-  (let (shell-command)
-    (if entire-thread
-	(setq shell-command
-	      (concat notmuch-command " show --format=mbox --exclude=false "
-		      (shell-quote-argument
-		       (mapconcat 'identity (notmuch-show-get-message-ids-for-open-messages) " OR "))
-		      " | " command))
-      (setq shell-command
-	    (concat notmuch-command " show --format=raw "
-		    (shell-quote-argument (notmuch-show-get-message-id)) " | " command)))
-    (let ((cwd default-directory)
-	  (buf (get-buffer-create (concat "*notmuch-pipe*"))))
-      (with-current-buffer buf
-	(setq buffer-read-only nil)
-	(erase-buffer)
-	;; Use the originating buffer's working directory instead of
-	;; that of the pipe buffer.
-	(cd cwd)
-	(let ((exit-code (call-process-shell-command shell-command nil buf)))
-	  (goto-char (point-max))
-	  (set-buffer-modified-p nil)
-	  (setq buffer-read-only t)
-	  (unless (zerop exit-code)
-	    (switch-to-buffer-other-window buf)
-	    (message (format "Command '%s' exited abnormally with code %d"
-			     shell-command exit-code))))))))
+  (interactive (let ((prompt (if current-prefix-arg
+				 "Pipe all open messages to command: "
+			       "Pipe message to command: ")))
+		 (list current-prefix-arg (read-string prompt))))
+
+  (let ((shell-command
+	 (concat notmuch-command " show"
+		 (if entire-thread
+		     (concat " --format=mbox --exclude=false "
+			     (mapconcat #'shell-quote-argument (notmuch-show-get-message-ids-for-open-messages) " OR "))
+		   (concat " --format=raw "
+			   (shell-quote-argument (notmuch-show-get-message-id))))
+		 " | " command))
+	(cwd default-directory)
+	(buf (get-buffer-create (concat "*notmuch-pipe*"))))
+    (with-current-buffer buf
+      (setq buffer-read-only nil)
+      (erase-buffer)
+      ;; Use the originating buffer's working directory instead of
+      ;; that of the pipe buffer.
+      (cd cwd)
+      (let ((exit-code (call-process-shell-command shell-command nil buf)))
+	(goto-char (point-max))
+	(set-buffer-modified-p nil)
+	(setq buffer-read-only t)
+	(unless (zerop exit-code)
+	  (switch-to-buffer-other-window buf)
+	  (message (format "Command '%s' exited abnormally with code %d"
+			   shell-command exit-code)))))))
 
 (defun notmuch-show-tag-message (&rest tag-changes)
   "Change tags for the current message.
-- 
2.0.0.rc0



More information about the notmuch mailing list