Re: [PATCH] emacs: use the originating buffer's working directory for pipe
[notmuch-archives.git] / 85 / 5bde5c77ef367b8acaf38f6c64a06f9637a70f
1 Return-Path: <tomi.ollila@iki.fi>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id C17AE431FBD\r
6         for <notmuch@notmuchmail.org>; Sun,  2 Mar 2014 04:11:40 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id fgRBpnhN4d7g for <notmuch@notmuchmail.org>;\r
16         Sun,  2 Mar 2014 04:11:31 -0800 (PST)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 866EF431FBC\r
19         for <notmuch@notmuchmail.org>; Sun,  2 Mar 2014 04:11:31 -0800 (PST)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id 8D8B81000B3;\r
22         Sun,  2 Mar 2014 14:11:14 +0200 (EET)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
25 Subject: Re: [PATCH] emacs: use the originating buffer's working directory for\r
26         pipe\r
27 In-Reply-To: <1393679870-29557-1-git-send-email-jani@nikula.org>\r
28 References: <1393679870-29557-1-git-send-email-jani@nikula.org>\r
29 User-Agent: Notmuch/0.17+112~g4e0c1d5 (http://notmuchmail.org) Emacs/24.3.1\r
30         (x86_64-unknown-linux-gnu)\r
31 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
32         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
33         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
34 Date: Sun, 02 Mar 2014 14:11:14 +0200\r
35 Message-ID: <m238j0yf4t.fsf@guru.guru-group.fi>\r
36 MIME-Version: 1.0\r
37 Content-Type: text/plain\r
38 X-BeenThere: notmuch@notmuchmail.org\r
39 X-Mailman-Version: 2.1.13\r
40 Precedence: list\r
41 List-Id: "Use and development of the notmuch mail system."\r
42         <notmuch.notmuchmail.org>\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
46 List-Post: <mailto:notmuch@notmuchmail.org>\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
50 X-List-Received-Date: Sun, 02 Mar 2014 12:11:40 -0000\r
51 \r
52 On Sat, Mar 01 2014, Jani Nikula <jani@nikula.org> wrote:\r
53 \r
54 > Currently notmuch-show-pipe-message runs the command in the working\r
55 > directory of the *notmuch-pipe* buffer if it exists, and the current\r
56 > buffer's working directory (which is inherited to the new\r
57 > *notmuch-pipe* buffer) otherwise. This is all very surprising to the\r
58 > user, and it's difficult to know or change where the command will be\r
59 > run.\r
60 >\r
61 > Always use the current show buffer's working directory for piping. The\r
62 > user can check that with M-x pwd and change it with M-x cd. This is\r
63 > consistent with notmuch-show-pipe-part.\r
64 \r
65 LGTM.\r
66 \r
67 Tomi\r
68 \r
69 \r
70 >\r
71 > ---\r
72 >\r
73 > Mark also suggested printing the working directory in the prompt for\r
74 > the command to pipe to, but when I tried it I thought the prompt\r
75 > became too crowded with that. It's also less important now that the\r
76 > current buffer's working directory is used consistently.\r
77 > ---\r
78 >  emacs/notmuch-show.el | 6 +++++-\r
79 >  1 file changed, 5 insertions(+), 1 deletion(-)\r
80 >\r
81 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
82 > index 88752f171930..b8782ddb632e 100644\r
83 > --- a/emacs/notmuch-show.el\r
84 > +++ b/emacs/notmuch-show.el\r
85 > @@ -1781,10 +1781,14 @@ message."\r
86 >        (setq shell-command\r
87 >           (concat notmuch-command " show --format=raw "\r
88 >                   (shell-quote-argument (notmuch-show-get-message-id)) " | " command)))\r
89 > -    (let ((buf (get-buffer-create (concat "*notmuch-pipe*"))))\r
90 > +    (let ((cwd default-directory)\r
91 > +       (buf (get-buffer-create (concat "*notmuch-pipe*"))))\r
92 >        (with-current-buffer buf\r
93 >       (setq buffer-read-only nil)\r
94 >       (erase-buffer)\r
95 > +     ;; Use the originating buffer's working directory instead of\r
96 > +     ;; that of the pipe buffer.\r
97 > +     (cd cwd)\r
98 >       (let ((exit-code (call-process-shell-command shell-command nil buf)))\r
99 >         (goto-char (point-max))\r
100 >         (set-buffer-modified-p nil)\r
101 > -- \r
102 > 1.8.5.3\r
103 >\r
104 > _______________________________________________\r
105 > notmuch mailing list\r
106 > notmuch@notmuchmail.org\r
107 > http://notmuchmail.org/mailman/listinfo/notmuch\r