]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-show.el
emacs: Fix notmuch-show-pipe-message to use notmuch-command variable
[notmuch] / emacs / notmuch-show.el
index 105532716c1cf6e5e9a79c2160fe11eb10539e70..ae483dde5cd0041304aa6c3f8f6e21948afee95d 100644 (file)
@@ -85,10 +85,10 @@ any given message."
 (defmacro with-current-notmuch-show-message (&rest body)
   "Evaluate body with current buffer set to the text of current message"
   `(save-excursion
-     (let ((filename (notmuch-show-get-filename)))
-       (let ((buf (generate-new-buffer (concat "*notmuch-msg-" filename "*"))))
+     (let ((id (notmuch-show-get-message-id)))
+       (let ((buf (generate-new-buffer (concat "*notmuch-msg-" id "*"))))
          (with-current-buffer buf
-           (insert-file-contents filename nil nil nil t)
+           (call-process notmuch-command nil t nil "show" "--format=raw" id)
            ,@body)
         (kill-buffer buf)))))
 
@@ -586,7 +586,6 @@ function is used. "
       "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
 
-;;;###autoload
 (defun notmuch-show-mode ()
   "Major mode for viewing a thread with notmuch.
 
@@ -918,7 +917,11 @@ any effects from previous calls to
 (defun notmuch-show-view-raw-message ()
   "View the file holding the current message."
   (interactive)
-  (view-file (notmuch-show-get-filename)))
+  (let ((id (notmuch-show-get-message-id)))
+    (let ((buf (get-buffer-create (concat "*notmuch-raw-" id "*"))))
+      (switch-to-buffer buf)
+      (save-excursion
+       (call-process notmuch-command nil t nil "show" "--format=raw" id)))))
 
 (defun notmuch-show-pipe-message (entire-thread command)
   "Pipe the contents of the current message (or thread) to the given command.
@@ -934,18 +937,19 @@ than only the current message."
   (let (shell-command)
     (if entire-thread
        (setq shell-command 
-             (concat "notmuch show --format=mbox "
+             (concat notmuch-command " show --format=mbox "
                      (shell-quote-argument
                       (mapconcat 'identity (notmuch-show-get-message-ids-for-open-messages) " OR "))
                      " | " command))
       (setq shell-command
-           (concat command " < " (shell-quote-argument (notmuch-show-get-filename)))))
+           (concat notmuch-command " show --format=raw "
+                   (shell-quote-argument (notmuch-show-get-message-id)) " | " command)))
     (start-process-shell-command "notmuch-pipe-command" "*notmuch-pipe*" shell-command)))
 
 (defun notmuch-show-add-tags-worker (current-tags add-tags)
   "Add to `current-tags' with any tags from `add-tags' not
 currently present and return the result."
-  (let ((result-tags (copy-seq current-tags)))
+  (let ((result-tags (copy-sequence current-tags)))
     (mapc (lambda (add-tag)
            (unless (member add-tag current-tags)
              (setq result-tags (push add-tag result-tags))))
@@ -955,7 +959,7 @@ currently present and return the result."
 (defun notmuch-show-del-tags-worker (current-tags del-tags)
   "Remove any tags in `del-tags' from `current-tags' and return
 the result."
-  (let ((result-tags (copy-seq current-tags)))
+  (let ((result-tags (copy-sequence current-tags)))
     (mapc (lambda (del-tag)
            (setq result-tags (delete del-tag result-tags)))
          del-tags)