Re: [PATCH] emacs: use the originating buffer's working directory for pipe
authorTomi Ollila <tomi.ollila@iki.fi>
Sun, 2 Mar 2014 12:11:14 +0000 (14:11 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:00:18 +0000 (10:00 -0800)
85/5bde5c77ef367b8acaf38f6c64a06f9637a70f [new file with mode: 0644]

diff --git a/85/5bde5c77ef367b8acaf38f6c64a06f9637a70f b/85/5bde5c77ef367b8acaf38f6c64a06f9637a70f
new file mode 100644 (file)
index 0000000..c8527b9
--- /dev/null
@@ -0,0 +1,107 @@
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id C17AE431FBD\r
+       for <notmuch@notmuchmail.org>; Sun,  2 Mar 2014 04:11:40 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id fgRBpnhN4d7g for <notmuch@notmuchmail.org>;\r
+       Sun,  2 Mar 2014 04:11:31 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id 866EF431FBC\r
+       for <notmuch@notmuchmail.org>; Sun,  2 Mar 2014 04:11:31 -0800 (PST)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+       by guru.guru-group.fi (Postfix) with ESMTP id 8D8B81000B3;\r
+       Sun,  2 Mar 2014 14:11:14 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] emacs: use the originating buffer's working directory for\r
+       pipe\r
+In-Reply-To: <1393679870-29557-1-git-send-email-jani@nikula.org>\r
+References: <1393679870-29557-1-git-send-email-jani@nikula.org>\r
+User-Agent: Notmuch/0.17+112~g4e0c1d5 (http://notmuchmail.org) Emacs/24.3.1\r
+       (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+       $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+       !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Sun, 02 Mar 2014 14:11:14 +0200\r
+Message-ID: <m238j0yf4t.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 02 Mar 2014 12:11:40 -0000\r
+\r
+On Sat, Mar 01 2014, Jani Nikula <jani@nikula.org> wrote:\r
+\r
+> Currently notmuch-show-pipe-message runs the command in the working\r
+> directory of the *notmuch-pipe* buffer if it exists, and the current\r
+> buffer's working directory (which is inherited to the new\r
+> *notmuch-pipe* buffer) otherwise. This is all very surprising to the\r
+> user, and it's difficult to know or change where the command will be\r
+> run.\r
+>\r
+> Always use the current show buffer's working directory for piping. The\r
+> user can check that with M-x pwd and change it with M-x cd. This is\r
+> consistent with notmuch-show-pipe-part.\r
+\r
+LGTM.\r
+\r
+Tomi\r
+\r
+\r
+>\r
+> ---\r
+>\r
+> Mark also suggested printing the working directory in the prompt for\r
+> the command to pipe to, but when I tried it I thought the prompt\r
+> became too crowded with that. It's also less important now that the\r
+> current buffer's working directory is used consistently.\r
+> ---\r
+>  emacs/notmuch-show.el | 6 +++++-\r
+>  1 file changed, 5 insertions(+), 1 deletion(-)\r
+>\r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index 88752f171930..b8782ddb632e 100644\r
+> --- a/emacs/notmuch-show.el\r
+> +++ b/emacs/notmuch-show.el\r
+> @@ -1781,10 +1781,14 @@ message."\r
+>        (setq shell-command\r
+>          (concat notmuch-command " show --format=raw "\r
+>                  (shell-quote-argument (notmuch-show-get-message-id)) " | " command)))\r
+> -    (let ((buf (get-buffer-create (concat "*notmuch-pipe*"))))\r
+> +    (let ((cwd default-directory)\r
+> +      (buf (get-buffer-create (concat "*notmuch-pipe*"))))\r
+>        (with-current-buffer buf\r
+>      (setq buffer-read-only nil)\r
+>      (erase-buffer)\r
+> +    ;; Use the originating buffer's working directory instead of\r
+> +    ;; that of the pipe buffer.\r
+> +    (cd cwd)\r
+>      (let ((exit-code (call-process-shell-command shell-command nil buf)))\r
+>        (goto-char (point-max))\r
+>        (set-buffer-modified-p nil)\r
+> -- \r
+> 1.8.5.3\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r