X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-show.el;h=f00273a959eaf35cfac60c91127b000244cf2716;hb=6ff607d6a01b78db123e9751fdeddd65d76da11d;hp=8ba81676f10245ee0f5d6a2b1539a14340df902b;hpb=99d474c484d89d3436c910f1ac447640c533e811;p=notmuch diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 8ba81676..f00273a9 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. @@ -407,7 +409,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 +420,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 +1159,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)))) @@ -1246,6 +1249,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 +1326,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))) @@ -1782,23 +1793,28 @@ TAG-CHANGES is a list of tag operations for `notmuch-tag'." (notmuch-tag (notmuch-show-get-message-id) tag-changes) (notmuch-show-set-tags new-tags)))) -(defun notmuch-show-tag (&optional tag-changes) +(defun notmuch-show-tag (tag-changes) "Change tags for the current message. See `notmuch-tag' for information on the format of TAG-CHANGES." - (interactive) - (let* ((tag-changes (notmuch-tag (notmuch-show-get-message-id) tag-changes)) - (current-tags (notmuch-show-get-tags)) + (interactive (list (notmuch-read-tag-changes (notmuch-show-get-tags) + "Tag message"))) + (notmuch-tag (notmuch-show-get-message-id) tag-changes) + (let* ((current-tags (notmuch-show-get-tags)) (new-tags (notmuch-update-tags current-tags tag-changes))) (unless (equal current-tags new-tags) (notmuch-show-set-tags new-tags)))) -(defun notmuch-show-tag-all (&optional tag-changes) +(defun notmuch-show-tag-all (tag-changes) "Change tags for all messages in the current show buffer. See `notmuch-tag' for information on the format of TAG-CHANGES." - (interactive) - (setq tag-changes (notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)) + (interactive + (list (let (tags) + (notmuch-show-mapc + (lambda () (setq tags (append (notmuch-show-get-tags) tags)))) + (notmuch-read-tag-changes tags "Tag thread")))) + (notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes) (notmuch-show-mapc (lambda () (let* ((current-tags (notmuch-show-get-tags)) @@ -1806,19 +1822,21 @@ See `notmuch-tag' for information on the format of TAG-CHANGES." (unless (equal current-tags new-tags) (notmuch-show-set-tags new-tags)))))) -(defun notmuch-show-add-tag () +(defun notmuch-show-add-tag (tag-changes) "Change tags for the current message (defaulting to add). Same as `notmuch-show-tag' but sets initial input to '+'." - (interactive) - (notmuch-show-tag "+")) + (interactive + (list (notmuch-read-tag-changes (notmuch-show-get-tags) "Tag message" "+"))) + (notmuch-show-tag tag-changes)) -(defun notmuch-show-remove-tag () +(defun notmuch-show-remove-tag (tag-changes) "Change tags for the current message (defaulting to remove). Same as `notmuch-show-tag' but sets initial input to '-'." - (interactive) - (notmuch-show-tag "-")) + (interactive + (list (notmuch-read-tag-changes (notmuch-show-get-tags) "Tag message" "-"))) + (notmuch-show-tag tag-changes)) (defun notmuch-show-toggle-visibility-headers () "Toggle the visibility of the current message headers."