X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=emacs%2Fnotmuch-tree.el;h=658c4f90870dfe4de726514b41908b53dde85661;hp=182235e79525be3723877d496ed717018af4f7f3;hb=9966720453c72286b5f36a56323244d70202cb26;hpb=8cca886b10c5ec44f3214701c0c1e3c896d53d5c diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 182235e7..658c4f90 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -1,4 +1,4 @@ -;; notmuch-tree.el --- displaying notmuch forests. +;;; notmuch-tree.el --- displaying notmuch forests. ;; ;; Copyright © Carl Worth ;; Copyright © David Edmondson @@ -17,11 +17,13 @@ ;; General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License -;; along with Notmuch. If not, see . +;; along with Notmuch. If not, see . ;; ;; Authors: David Edmondson ;; Mark Walters +;;; Code: + (require 'mail-parse) (require 'notmuch-lib) @@ -239,12 +241,17 @@ FUNC." (define-key map [remap notmuch-search] 'notmuch-tree-to-search) ;; Override because we want to close message pane first. (define-key map [remap notmuch-mua-new-mail] (notmuch-tree-close-message-pane-and #'notmuch-mua-new-mail)) + ;; Override because we want to close message pane first. + (define-key map [remap notmuch-jump-search] (notmuch-tree-close-message-pane-and #'notmuch-jump-search)) + + (define-key map "S" 'notmuch-search-from-tree-current-query) ;; these use notmuch-show functions directly (define-key map "|" 'notmuch-show-pipe-message) (define-key map "w" 'notmuch-show-save-attachments) (define-key map "v" 'notmuch-show-view-all-mime-parts) (define-key map "c" 'notmuch-show-stash-map) + (define-key map "b" 'notmuch-show-resend-message) ;; these apply to the message pane (define-key map (kbd "M-TAB") (notmuch-tree-to-message-pane #'notmuch-show-previous-button)) @@ -276,7 +283,7 @@ FUNC." (define-key map "+" 'notmuch-tree-add-tag) (define-key map "*" 'notmuch-tree-tag-thread) (define-key map " " 'notmuch-tree-scroll-or-next) - (define-key map "b" 'notmuch-tree-scroll-message-window-back) + (define-key map (kbd "DEL") 'notmuch-tree-scroll-message-window-back) map)) (fset 'notmuch-tree-mode-map notmuch-tree-mode-map) @@ -402,6 +409,12 @@ Does NOT change the database." (notmuch-tree-close-message-window) (notmuch-tree query))) +(defun notmuch-search-from-tree-current-query () + "Call notmuch search with the current query" + (interactive) + (notmuch-tree-close-message-window) + (notmuch-search (notmuch-tree-get-query))) + (defun notmuch-tree-message-window-kill-hook () "Close the message pane when exiting the show buffer." (let ((buffer (current-buffer))) @@ -793,7 +806,7 @@ This function inserts a collection of several complete threads as passed to it by notmuch-tree-process-filter." (mapc 'notmuch-tree-insert-forest-thread forest)) -(defun notmuch-tree-mode () +(define-derived-mode notmuch-tree-mode fundamental-mode "notmuch-tree" "Major mode displaying messages (as opposed to threads) of of a notmuch search. This buffer contains the results of a \"notmuch tree\" of your @@ -807,12 +820,7 @@ Complete list of currently available key bindings: \\{notmuch-tree-mode-map}" - (interactive) - (kill-all-local-variables) (setq notmuch-buffer-refresh-function #'notmuch-tree-refresh-view) - (use-local-map notmuch-tree-mode-map) - (setq major-mode 'notmuch-tree-mode - mode-name "notmuch-tree") (hl-line-mode 1) (setq buffer-read-only t truncate-lines t)) @@ -867,6 +875,11 @@ the same as for the function notmuch-tree." (setq notmuch-tree-query-context query-context) (setq notmuch-tree-target-msg target) (setq notmuch-tree-open-target open-target) + ;; Set the default value for `notmuch-show-process-crypto' in this + ;; buffer. Although we don't use this some of the functions we call + ;; (such as reply) do. It is a buffer local variable so setting it + ;; will not affect genuine show buffers. + (setq notmuch-show-process-crypto notmuch-crypto-process-mime) (erase-buffer) (goto-char (point-min)) @@ -932,3 +945,5 @@ The arguments are: ;; (provide 'notmuch-tree) + +;;; notmuch-tree.el ends here