Re: [feature request] emacs: use `notmuch insert` for FCC
[notmuch-archives.git] / 06 / e44aa918fd92b296e1c4f42e5b5ef3231922be
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 C6A29431FC4\r
6         for <notmuch@notmuchmail.org>; Wed, 13 Nov 2013 13:58:55 -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.023\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.023 tagged_above=-999 required=5\r
12         tests=[HS_INDEX_PARAM=0.023] 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 ndsECL78fGTJ for <notmuch@notmuchmail.org>;\r
16         Wed, 13 Nov 2013 13:58:47 -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 7AEA5429E25\r
19         for <notmuch@notmuchmail.org>; Wed, 13 Nov 2013 13:58:46 -0800 (PST)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id A4040100033;\r
22         Wed, 13 Nov 2013 23:58:41 +0200 (EET)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
25 Subject: Re: [PATCH] emacs: show: stop stderr appearing in buffer\r
26 In-Reply-To: <1384333417-13832-1-git-send-email-markwalters1009@gmail.com>\r
27 References: <1384333417-13832-1-git-send-email-markwalters1009@gmail.com>\r
28 User-Agent: Notmuch/0.16+119~g219c55f (http://notmuchmail.org) Emacs/24.3.1\r
29         (x86_64-unknown-linux-gnu)\r
30 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
31         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
32         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
33 Date: Wed, 13 Nov 2013 23:58:41 +0200\r
34 Message-ID: <m2bo1oyne6.fsf@guru.guru-group.fi>\r
35 MIME-Version: 1.0\r
36 Content-Type: text/plain\r
37 X-BeenThere: notmuch@notmuchmail.org\r
38 X-Mailman-Version: 2.1.13\r
39 Precedence: list\r
40 List-Id: "Use and development of the notmuch mail system."\r
41         <notmuch.notmuchmail.org>\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
43         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
45 List-Post: <mailto:notmuch@notmuchmail.org>\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
48         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
49 X-List-Received-Date: Wed, 13 Nov 2013 21:58:56 -0000\r
50 \r
51 On Wed, Nov 13 2013, Mark Walters <markwalters1009@gmail.com> wrote:\r
52 \r
53 > In emacs 24.3+ the stdout/stderr from externally displaying an\r
54 > attachment gets inserted into the show buffer. This is caused by\r
55 > changes in mm-display-external in mm-decode.el.\r
56 >\r
57 > Ideally, we would put this output in the notmuch errors buffer but the\r
58 > handler is called asynchronously so we don't know when the output will\r
59 > appear. Thus if we put it straight into the errors buffer it could get\r
60 > interleaved with other errors. Also we can't easily tell when we\r
61 > have got all the error output so can't wait until the process is complete.\r
62 >\r
63 > One solution would be to create a new buffer for the stderr of each\r
64 > attachment viewed. Again, since we can't tell when the process has\r
65 > finished, we can't close these buffers automatically so this will\r
66 > leave lots of buffers around.\r
67 >\r
68 > Thus we add a debug variable notmuch-show-attachment-debug: it this is\r
69 > non-nil we create a new buffer for each viewer; if this variable is\r
70 > nil we just use a temp buffer which means all error output is\r
71 > discarded (this is the same behaviour as with emacs pre 24.3).\r
72 > ---\r
73 \r
74 This patch looks tolerable to me. +1\r
75 \r
76 Tomi\r
77 \r
78 >\r
79 > This is a new version of\r
80 > id:1378502198-7980-1-git-send-email-markwalters1009@gmail.com I don't\r
81 > think there was complete consensus on the right thing to do here but\r
82 > most people wanted at least the option of seeing the stderr/stdout.\r
83 >\r
84 > This keeps the default behaviour the same as before, but adds a debug\r
85 > variable to put the stderr/stdout in its own buffer.\r
86 >\r
87 > Note: I always use emacs 23 so this is not heavily tested.\r
88 >\r
89 > Best wishes\r
90 >\r
91 > Mark\r
92 >\r
93 >\r
94 >  emacs/notmuch-show.el |   12 +++++++++++-\r
95 >  1 files changed, 11 insertions(+), 1 deletions(-)\r
96 >\r
97 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
98 > index f00273a..f9a3344 100644\r
99 > --- a/emacs/notmuch-show.el\r
100 > +++ b/emacs/notmuch-show.el\r
101 > @@ -159,6 +159,8 @@ indentation."\r
102 >  (make-variable-buffer-local 'notmuch-show-indent-content)\r
103 >  (put 'notmuch-show-indent-content 'permanent-local t)\r
104 >  \r
105 > +(defvar notmuch-show-attachment-debug nil)\r
106 > +\r
107 >  (defcustom notmuch-show-stash-mlarchive-link-alist\r
108 >    '(("Gmane" . "http://mid.gmane.org/")\r
109 >      ("MARC" . "http://marc.info/?i=")\r
110 > @@ -2089,8 +2091,16 @@ caller is responsible for killing this buffer as appropriate."\r
111 >  This ensures that the temporary buffer created for the mm-handle\r
112 >  is destroyed when FN returns."\r
113 >    (let ((handle (notmuch-show-current-part-handle)))\r
114 > +    ;; emacs 24.3+ puts stdout/stderr into the calling buffer so we\r
115 > +    ;; call it from a temp-buffer, unless\r
116 > +    ;; notmuch-show-attachment-debug is non-nil in which case we put\r
117 > +    ;; it in " *notmuch-part*".\r
118 >      (unwind-protect\r
119 > -     (funcall fn handle)\r
120 > +     (if notmuch-show-attachment-debug\r
121 > +         (with-current-buffer (generate-new-buffer " *notmuch-part*")\r
122 > +           (funcall fn handle))\r
123 > +       (with-temp-buffer\r
124 > +         (funcall fn handle)))\r
125 >        (kill-buffer (mm-handle-buffer handle)))))\r
126 >  \r
127 >  (defun notmuch-show-part-button-default (&optional button)\r
128 > -- \r
129 > 1.7.9.1\r
130 >\r
131 > _______________________________________________\r
132 > notmuch mailing list\r
133 > notmuch@notmuchmail.org\r
134 > http://notmuchmail.org/mailman/listinfo/notmuch\r