[PATCH] emacs: show: stop stderr appearing in buffer
Mark Walters
markwalters1009 at gmail.com
Fri Sep 6 14:16:38 PDT 2013
In emacs 24.3+ the stdout/stderr from externally displaying an
attachment gets inserted into the show buffer. This is caused by
changes in mm-display-external in mm-decode.el.
Ideally, we would put this output in the notmuch errors buffer but the
handler is called asynchronously so we don't know when the output will
appear. Thus if we put it straight into the errors buffer it could get
interleaved with other errors, otoh we can't easily tell when we
have got all the error output so can't wait until the process is complete.
This patch just takes the simplest approach and discards the error
output (which means the behaviour is the same as it was with emacs pre
24.3).
---
As I say above it would be nice to capture the error output but it
does not appear to be simple. This is probably worth applying in the
meantime as we definitely don't want the stderr/stdout appearing in
the show buffer.
The bug is easy to reproduce: make a script which outputs to stderr or
stdout and call it on any part with ". o scriptname" (in fact even
". o ls" will do!)
Best wishes
Mark
emacs/notmuch-show.el | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 904b98e..42438ba 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -2044,9 +2044,12 @@ caller is responsible for killing this buffer as appropriate."
This ensures that the temporary buffer created for the mm-handle
is destroyed when FN returns."
(let ((handle (notmuch-show-current-part-handle)))
- (unwind-protect
- (funcall fn handle)
- (kill-buffer (mm-handle-buffer handle)))))
+ ;; emacs 24.3+ puts stdout/stderr into the calling buffer so we
+ ;; call it from a temp-buffer.
+ (with-temp-buffer
+ (unwind-protect
+ (funcall fn handle)
+ (kill-buffer (mm-handle-buffer handle))))))
(defun notmuch-show-part-button-default (&optional button)
(interactive)
--
1.7.9.1
More information about the notmuch
mailing list