X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-show.el;h=1ac80cac9cba3559a002da14c78b4a6835047ff3;hb=39408d0f7d71334c539327db5bbfe248cbab8e82;hp=81ee87a8b8e8cd8b27d0eba312c8b5abe55065ba;hpb=47792533b37b24d353aa351c303562860509441b;p=notmuch diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 81ee87a8..1ac80cac 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -44,6 +44,8 @@ (declare-function notmuch-foreach-mime-part "notmuch" (function mm-handle)) (declare-function notmuch-count-attachments "notmuch" (mm-handle)) (declare-function notmuch-save-attachments "notmuch" (mm-handle &optional queryp)) +(declare-function notmuch-tree "notmuch-tree" + (&optional query query-context target buffer-name open-target)) (defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date") "Headers that should be shown in a message, in this order. @@ -157,6 +159,15 @@ indentation." (make-variable-buffer-local 'notmuch-show-indent-content) (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 '(("Gmane" . "http://mid.gmane.org/") ("MARC" . "http://marc.info/?i=") @@ -407,7 +418,8 @@ unchanged ADDRESS if parsing fails." message at DEPTH in the current thread." (let ((start (point))) (insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth)) - (notmuch-show-clean-address (plist-get headers :From)) + (notmuch-sanitize + (notmuch-show-clean-address (plist-get headers :From))) " (" date ") (" @@ -417,7 +429,7 @@ message at DEPTH in the current thread." (defun notmuch-show-insert-header (header header-value) "Insert a single header." - (insert header ": " header-value "\n")) + (insert header ": " (notmuch-sanitize header-value) "\n")) (defun notmuch-show-insert-headers (headers) "Insert the headers of the current message." @@ -1156,7 +1168,7 @@ function is used." (jit-lock-register #'notmuch-show-buttonise-links) ;; Set the header line to the subject of the first message. - (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-subject))) + (setq header-line-format (notmuch-sanitize (notmuch-show-strip-re (notmuch-show-get-subject)))) (run-hooks 'notmuch-show-hook)))) @@ -1229,6 +1241,7 @@ reset based on the original query." (define-key map "t" 'notmuch-show-stash-to) (define-key map "l" 'notmuch-show-stash-mlarchive-link) (define-key map "L" 'notmuch-show-stash-mlarchive-link-and-go) + (define-key map "?" 'notmuch-subkeymap-help) map) "Submap for stash commands") (fset 'notmuch-show-stash-map notmuch-show-stash-map) @@ -1239,6 +1252,7 @@ reset based on the original query." (define-key map "v" 'notmuch-show-view-part) (define-key map "o" 'notmuch-show-interactively-view-part) (define-key map "|" 'notmuch-show-pipe-part) + (define-key map "?" 'notmuch-subkeymap-help) map) "Submap for part commands") (fset 'notmuch-show-part-map notmuch-show-part-map) @@ -1246,6 +1260,7 @@ reset based on the original query." (defvar notmuch-show-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map notmuch-common-keymap) + (define-key map "Z" 'notmuch-tree-from-show-current-query) (define-key map (kbd "") 'widget-backward) (define-key map (kbd "M-TAB") 'notmuch-show-previous-button) (define-key map (kbd "") 'notmuch-show-previous-button) @@ -1322,6 +1337,13 @@ All currently available key bindings: (setq buffer-read-only t truncate-lines t)) +(defun notmuch-tree-from-show-current-query () + "Call notmuch tree with the current query" + (interactive) + (notmuch-tree notmuch-show-thread-id + notmuch-show-query-context + (notmuch-show-get-message-id))) + (defun notmuch-show-move-to-message-top () (goto-char (notmuch-show-message-top))) @@ -2078,8 +2100,16 @@ 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))) + ;; 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 - (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))))) (defun notmuch-show-part-button-default (&optional button)