Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 46 / 6ec8f5e7c92b4913c297a6a7455fba799e4239
1 Return-Path: <markwalters1009@gmail.com>\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 8B7F5431FBC\r
6         for <notmuch@notmuchmail.org>; Wed, 13 Nov 2013 01:03:51 -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: 2.723\r
10 X-Spam-Level: **\r
11 X-Spam-Status: No, score=2.723 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
14         FREEMAIL_REPLY=2.499, HS_INDEX_PARAM=0.023, RCVD_IN_DNSWL_LOW=-0.7]\r
15         autolearn=disabled\r
16 Received: from olra.theworths.org ([127.0.0.1])\r
17         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
18         with ESMTP id tjYwgbe2iU3J for <notmuch@notmuchmail.org>;\r
19         Wed, 13 Nov 2013 01:03:47 -0800 (PST)\r
20 Received: from mail-bk0-f43.google.com (mail-bk0-f43.google.com\r
21         [209.85.214.43]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
22         (No client certificate requested)\r
23         by olra.theworths.org (Postfix) with ESMTPS id F3B16431FB6\r
24         for <notmuch@notmuchmail.org>; Wed, 13 Nov 2013 01:03:46 -0800 (PST)\r
25 Received: by mail-bk0-f43.google.com with SMTP id mz13so170640bkb.30\r
26         for <notmuch@notmuchmail.org>; Wed, 13 Nov 2013 01:03:44 -0800 (PST)\r
27 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
28         h=from:to:cc:subject:date:message-id;\r
29         bh=WhM6SV1kOLWMIjZYEPq1Sobvyl0BWy3YptJ2AGxwWXQ=;\r
30         b=HmR6QOpT9d19Manruuq3LhqjyedHCPGSxOcZRbztUMKTMeTr1iNHYlY0pNN3RJzl51\r
31         vEJtixaUe5lSTV7cBQwGPWj22WPOj+1/6B8pVfgKmqK9mCVBWWzAjEntDNaDtNhEwAdV\r
32         7khD5HLWwYxSvESRiiJ1TommLLRKf7OulhAM5B3cMXHtApRDhv/mKQ5qmdlg0F4obVOE\r
33         JmgcPll93kAStYUWbKgH80iKI+vi8Ubx0aIlOP3vHQrfgqZKJIMYtXyqalTccqIgn9mE\r
34         mJ/sd5RA+v/boRL96BQ3Lj19WCJs3q4U1dRizlmR3xkLj37r0JzzVoJteEt5YGl8uzMN\r
35         xxCA==\r
36 X-Received: by 10.204.102.71 with SMTP id f7mr416071bko.57.1384333421849;\r
37         Wed, 13 Nov 2013 01:03:41 -0800 (PST)\r
38 Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
39         by mx.google.com with ESMTPSA id\r
40         kk2sm21457381bkb.10.2013.11.13.01.03.41 for <multiple recipients>\r
41         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
42         Wed, 13 Nov 2013 01:03:41 -0800 (PST)\r
43 From: Mark Walters <markwalters1009@gmail.com>\r
44 To: notmuch@notmuchmail.org\r
45 Subject: [PATCH] emacs: show: stop stderr appearing in buffer\r
46 Date: Wed, 13 Nov 2013 09:03:37 +0000\r
47 Message-Id: <1384333417-13832-1-git-send-email-markwalters1009@gmail.com>\r
48 X-Mailer: git-send-email 1.7.9.1\r
49 X-BeenThere: notmuch@notmuchmail.org\r
50 X-Mailman-Version: 2.1.13\r
51 Precedence: list\r
52 List-Id: "Use and development of the notmuch mail system."\r
53         <notmuch.notmuchmail.org>\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
55         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
57 List-Post: <mailto:notmuch@notmuchmail.org>\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
60         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
61 X-List-Received-Date: Wed, 13 Nov 2013 09:03:51 -0000\r
62 \r
63 In emacs 24.3+ the stdout/stderr from externally displaying an\r
64 attachment gets inserted into the show buffer. This is caused by\r
65 changes in mm-display-external in mm-decode.el.\r
66 \r
67 Ideally, we would put this output in the notmuch errors buffer but the\r
68 handler is called asynchronously so we don't know when the output will\r
69 appear. Thus if we put it straight into the errors buffer it could get\r
70 interleaved with other errors. Also we can't easily tell when we\r
71 have got all the error output so can't wait until the process is complete.\r
72 \r
73 One solution would be to create a new buffer for the stderr of each\r
74 attachment viewed. Again, since we can't tell when the process has\r
75 finished, we can't close these buffers automatically so this will\r
76 leave lots of buffers around.\r
77 \r
78 Thus we add a debug variable notmuch-show-attachment-debug: it this is\r
79 non-nil we create a new buffer for each viewer; if this variable is\r
80 nil we just use a temp buffer which means all error output is\r
81 discarded (this is the same behaviour as with emacs pre 24.3).\r
82 ---\r
83 \r
84 This is a new version of\r
85 id:1378502198-7980-1-git-send-email-markwalters1009@gmail.com I don't\r
86 think there was complete consensus on the right thing to do here but\r
87 most people wanted at least the option of seeing the stderr/stdout.\r
88 \r
89 This keeps the default behaviour the same as before, but adds a debug\r
90 variable to put the stderr/stdout in its own buffer.\r
91 \r
92 Note: I always use emacs 23 so this is not heavily tested.\r
93 \r
94 Best wishes\r
95 \r
96 Mark\r
97 \r
98 \r
99  emacs/notmuch-show.el |   12 +++++++++++-\r
100  1 files changed, 11 insertions(+), 1 deletions(-)\r
101 \r
102 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
103 index f00273a..f9a3344 100644\r
104 --- a/emacs/notmuch-show.el\r
105 +++ b/emacs/notmuch-show.el\r
106 @@ -159,6 +159,8 @@ indentation."\r
107  (make-variable-buffer-local 'notmuch-show-indent-content)\r
108  (put 'notmuch-show-indent-content 'permanent-local t)\r
109  \r
110 +(defvar notmuch-show-attachment-debug nil)\r
111 +\r
112  (defcustom notmuch-show-stash-mlarchive-link-alist\r
113    '(("Gmane" . "http://mid.gmane.org/")\r
114      ("MARC" . "http://marc.info/?i=")\r
115 @@ -2089,8 +2091,16 @@ caller is responsible for killing this buffer as appropriate."\r
116  This ensures that the temporary buffer created for the mm-handle\r
117  is destroyed when FN returns."\r
118    (let ((handle (notmuch-show-current-part-handle)))\r
119 +    ;; emacs 24.3+ puts stdout/stderr into the calling buffer so we\r
120 +    ;; call it from a temp-buffer, unless\r
121 +    ;; notmuch-show-attachment-debug is non-nil in which case we put\r
122 +    ;; it in " *notmuch-part*".\r
123      (unwind-protect\r
124 -       (funcall fn handle)\r
125 +       (if notmuch-show-attachment-debug\r
126 +           (with-current-buffer (generate-new-buffer " *notmuch-part*")\r
127 +             (funcall fn handle))\r
128 +         (with-temp-buffer\r
129 +           (funcall fn handle)))\r
130        (kill-buffer (mm-handle-buffer handle)))))\r
131  \r
132  (defun notmuch-show-part-button-default (&optional button)\r
133 -- \r
134 1.7.9.1\r
135 \r