mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 20:08:10 +01:00
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.
This commit is contained in:
parent
ed720f4e6d
commit
ec13bd12e3
1 changed files with 5 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue