mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 20:08:10 +01:00
emacs: use define-derived-mode for defining modes.
This sets up and runs all the correct hooks and reduces some redundancy.
This commit is contained in:
parent
07dff49630
commit
e954310d70
4 changed files with 4 additions and 25 deletions
|
@ -671,7 +671,7 @@ with `notmuch-hello-query-counts'."
|
|||
"Keymap for \"notmuch hello\" buffers.")
|
||||
(fset 'notmuch-hello-mode-map notmuch-hello-mode-map)
|
||||
|
||||
(defun notmuch-hello-mode ()
|
||||
(define-derived-mode notmuch-hello-mode fundamental-mode "notmuch-hello"
|
||||
"Major mode for convenient notmuch navigation. This is your entry portal into notmuch.
|
||||
|
||||
Saved searches are \"bookmarks\" for arbitrary queries. Hit RET
|
||||
|
@ -702,13 +702,7 @@ The screen may be customized via `\\[customize]'.
|
|||
Complete list of currently available key bindings:
|
||||
|
||||
\\{notmuch-hello-mode-map}"
|
||||
(interactive)
|
||||
(kill-all-local-variables)
|
||||
(setq notmuch-buffer-refresh-function #'notmuch-hello-update)
|
||||
(use-local-map notmuch-hello-mode-map)
|
||||
(setq major-mode 'notmuch-hello-mode
|
||||
mode-name "notmuch-hello")
|
||||
(run-mode-hooks 'notmuch-hello-mode-hook)
|
||||
;;(setq buffer-read-only t)
|
||||
)
|
||||
|
||||
|
|
|
@ -1454,7 +1454,7 @@ reset based on the original query."
|
|||
"Keymap for \"notmuch show\" buffers.")
|
||||
(fset 'notmuch-show-mode-map notmuch-show-mode-map)
|
||||
|
||||
(defun notmuch-show-mode ()
|
||||
(define-derived-mode notmuch-show-mode fundamental-mode "notmuch-show"
|
||||
"Major mode for viewing a thread with notmuch.
|
||||
|
||||
This buffer contains the results of the \"notmuch show\" command
|
||||
|
@ -1482,12 +1482,7 @@ You can add or remove arbitrary tags from the current message with
|
|||
All currently available key bindings:
|
||||
|
||||
\\{notmuch-show-mode-map}"
|
||||
(interactive)
|
||||
(kill-all-local-variables)
|
||||
(setq notmuch-buffer-refresh-function #'notmuch-show-refresh-view)
|
||||
(use-local-map notmuch-show-mode-map)
|
||||
(setq major-mode 'notmuch-show-mode
|
||||
mode-name "notmuch-show")
|
||||
(setq buffer-read-only t
|
||||
truncate-lines t))
|
||||
|
||||
|
|
|
@ -803,7 +803,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
|
||||
|
@ -817,12 +817,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))
|
||||
|
|
|
@ -331,7 +331,7 @@ This face is the default value for the \"unread\" tag in
|
|||
:group 'notmuch-search
|
||||
:group 'notmuch-faces)
|
||||
|
||||
(defun notmuch-search-mode ()
|
||||
(define-derived-mode notmuch-search-mode fundamental-mode "notmuch-search"
|
||||
"Major mode displaying results of a notmuch search.
|
||||
|
||||
This buffer contains the results of a \"notmuch search\" of your
|
||||
|
@ -361,8 +361,6 @@ new, global search.
|
|||
Complete list of currently available key bindings:
|
||||
|
||||
\\{notmuch-search-mode-map}"
|
||||
(interactive)
|
||||
(kill-all-local-variables)
|
||||
(make-local-variable 'notmuch-search-query-string)
|
||||
(make-local-variable 'notmuch-search-oldest-first)
|
||||
(make-local-variable 'notmuch-search-target-thread)
|
||||
|
@ -370,10 +368,7 @@ Complete list of currently available key bindings:
|
|||
(setq notmuch-buffer-refresh-function #'notmuch-search-refresh-view)
|
||||
(set (make-local-variable 'scroll-preserve-screen-position) t)
|
||||
(add-to-invisibility-spec (cons 'ellipsis t))
|
||||
(use-local-map notmuch-search-mode-map)
|
||||
(setq truncate-lines t)
|
||||
(setq major-mode 'notmuch-search-mode
|
||||
mode-name "notmuch-search")
|
||||
(setq buffer-read-only t))
|
||||
|
||||
(defun notmuch-search-get-result (&optional pos)
|
||||
|
|
Loading…
Reference in a new issue