mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
emacs: show: stop stderr appearing in buffer
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. Also we can't easily tell when we have got all the error output so can't wait until the process is complete. One solution would be to create a new buffer for the stderr of each attachment viewed. Again, since we can't tell when the process has finished, we can't close these buffers automatically so this will leave lots of buffers around. Thus we add a debug variable notmuch-show-attachment-debug: it this is non-nil we create a new buffer for each viewer; if this variable is nil we just use a temp buffer which means all error output is discarded (this is the same behaviour as with emacs pre 24.3).
This commit is contained in:
parent
42ff2d3a0d
commit
9c25d4bbf0
1 changed files with 18 additions and 1 deletions
|
@ -159,6 +159,15 @@ indentation."
|
||||||
(make-variable-buffer-local 'notmuch-show-indent-content)
|
(make-variable-buffer-local 'notmuch-show-indent-content)
|
||||||
(put 'notmuch-show-indent-content 'permanent-local t)
|
(put 'notmuch-show-indent-content 'permanent-local t)
|
||||||
|
|
||||||
|
(defvar notmuch-show-attachment-debug nil
|
||||||
|
"If t log stdout and stderr from attachment handlers
|
||||||
|
|
||||||
|
When set to nil (the default) stdout and stderr from attachment
|
||||||
|
handlers is discarded. When set to t the stdout and stderr from
|
||||||
|
each attachment handler is logged in buffers with names beginning
|
||||||
|
\" *notmuch-part*\". This option requires emacs version at least
|
||||||
|
24.3 to work.")
|
||||||
|
|
||||||
(defcustom notmuch-show-stash-mlarchive-link-alist
|
(defcustom notmuch-show-stash-mlarchive-link-alist
|
||||||
'(("Gmane" . "http://mid.gmane.org/")
|
'(("Gmane" . "http://mid.gmane.org/")
|
||||||
("MARC" . "http://marc.info/?i=")
|
("MARC" . "http://marc.info/?i=")
|
||||||
|
@ -2089,8 +2098,16 @@ caller is responsible for killing this buffer as appropriate."
|
||||||
This ensures that the temporary buffer created for the mm-handle
|
This ensures that the temporary buffer created for the mm-handle
|
||||||
is destroyed when FN returns."
|
is destroyed when FN returns."
|
||||||
(let ((handle (notmuch-show-current-part-handle)))
|
(let ((handle (notmuch-show-current-part-handle)))
|
||||||
|
;; emacs 24.3+ puts stdout/stderr into the calling buffer so we
|
||||||
|
;; call it from a temp-buffer, unless
|
||||||
|
;; notmuch-show-attachment-debug is non-nil in which case we put
|
||||||
|
;; it in " *notmuch-part*".
|
||||||
(unwind-protect
|
(unwind-protect
|
||||||
(funcall fn handle)
|
(if notmuch-show-attachment-debug
|
||||||
|
(with-current-buffer (generate-new-buffer " *notmuch-part*")
|
||||||
|
(funcall fn handle))
|
||||||
|
(with-temp-buffer
|
||||||
|
(funcall fn handle)))
|
||||||
(kill-buffer (mm-handle-buffer handle)))))
|
(kill-buffer (mm-handle-buffer handle)))))
|
||||||
|
|
||||||
(defun notmuch-show-part-button-default (&optional button)
|
(defun notmuch-show-part-button-default (&optional button)
|
||||||
|
|
Loading…
Reference in a new issue