-;; notmuch-tree.el --- displaying notmuch forests.
+;;; notmuch-tree.el --- displaying notmuch forests.
;;
;; Copyright © Carl Worth
;; Copyright © David Edmondson
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
-;; along with Notmuch. If not, see <http://www.gnu.org/licenses/>.
+;; along with Notmuch. If not, see <https://www.gnu.org/licenses/>.
;;
;; Authors: David Edmondson <dme@dme.org>
;; Mark Walters <markwalters1009@gmail.com>
+;;; Code:
+
(require 'mail-parse)
(require 'notmuch-lib)
(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))
(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)
(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)))
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
\\{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))
(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))
;;
(provide 'notmuch-tree)
+
+;;; notmuch-tree.el ends here