Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id C17AE431FBD for ; Sun, 2 Mar 2014 04:11:40 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fgRBpnhN4d7g for ; Sun, 2 Mar 2014 04:11:31 -0800 (PST) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id 866EF431FBC for ; Sun, 2 Mar 2014 04:11:31 -0800 (PST) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id 8D8B81000B3; Sun, 2 Mar 2014 14:11:14 +0200 (EET) From: Tomi Ollila To: Jani Nikula , notmuch@notmuchmail.org Subject: Re: [PATCH] emacs: use the originating buffer's working directory for pipe In-Reply-To: <1393679870-29557-1-git-send-email-jani@nikula.org> References: <1393679870-29557-1-git-send-email-jani@nikula.org> User-Agent: Notmuch/0.17+112~g4e0c1d5 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Mar 2014 12:11:40 -0000 On Sat, Mar 01 2014, Jani Nikula wrote: > 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. LGTM. Tomi > > --- > > Mark also suggested printing the working directory in the prompt for > the command to pipe to, but when I tried it I thought the prompt > became too crowded with that. It's also less important now that the > current buffer's working directory is used consistently. > --- > emacs/notmuch-show.el | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index 88752f171930..b8782ddb632e 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) > -- > 1.8.5.3 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch