]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-tree.el
emacs: tree: make jump close message pane
[notmuch] / emacs / notmuch-tree.el
index 384cb76bcf3c086f6f727112334e0ad4bea1eb84..6e5797e970f6377ba0ba5ca79d7504c07c7dc755 100644 (file)
@@ -1,4 +1,4 @@
-;; 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)
@@ -239,6 +241,8 @@ 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)
 
@@ -801,7 +805,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
@@ -815,12 +819,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))
@@ -945,3 +944,5 @@ The arguments are:
 ;;
 
 (provide 'notmuch-tree)
+
+;;; notmuch-tree.el ends here