aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs
diff options
context:
space:
mode:
authorGravatar Jani Nikula <jani@nikula.org>2014-03-01 15:17:50 +0200
committerGravatar David Bremner <david@tethera.net>2014-03-04 20:00:50 -0400
commitec13bd12e3335d0ceb878d403d11004bbe330c8e (patch)
treef2bf70a46cd2d8744d068f26e20655fc1d864824 /emacs
parented720f4e6d18c80381e0e84ff3b5571474c92512 (diff)
emacs: use the originating buffer's working directory for pipe
Currently notmuch-show-pipe-message runs the command in the working directory of the *notmuch-pipe* buffer if it exists, and the current buffer's working directory (which is inherited to the new *notmuch-pipe* buffer) otherwise. This is all very surprising to the user, and it's difficult to know or change where the command will be run. Always use the current show buffer's working directory for piping. The user can check that with M-x pwd and change it with M-x cd. This is consistent with notmuch-show-pipe-part.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/notmuch-show.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 88752f17..b8782ddb 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1781,10 +1781,14 @@ message."
(setq shell-command
(concat notmuch-command " show --format=raw "
(shell-quote-argument (notmuch-show-get-message-id)) " | " command)))
- (let ((buf (get-buffer-create (concat "*notmuch-pipe*"))))
+ (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)