mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 04:18:08 +01:00
Make notmuch-hello a mode.
This enables the nifty '?' key binding to work in notmuch-hello (although for some strange reasons I don't see any descriptions for specific key bindings yet. Not sure how that is supposed to work though. But this starts, runs and behaves identical to the existing code. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
parent
5bc4ff4e1d
commit
a56010ac8b
1 changed files with 33 additions and 10 deletions
|
@ -259,6 +259,36 @@ should be. Returns a cons cell `(tags-per-line width)'."
|
||||||
(notmuch-poll)
|
(notmuch-poll)
|
||||||
(notmuch-hello-update))
|
(notmuch-hello-update))
|
||||||
|
|
||||||
|
|
||||||
|
(defvar notmuch-hello-mode-map
|
||||||
|
(let ((map (copy-keymap widget-keymap)))
|
||||||
|
(define-key map "v" '(lambda () "Display the notmuch version" (interactive)
|
||||||
|
(message "notmuch version %s" (notmuch-version))))
|
||||||
|
(define-key map "?" 'notmuch-help)
|
||||||
|
(define-key map "q" 'kill-this-buffer)
|
||||||
|
(define-key map "=" 'notmuch-hello-update)
|
||||||
|
(define-key map "G" 'notmuch-hello-poll-and-update)
|
||||||
|
(define-key map (kbd "<C-tab>") 'widget-backward)
|
||||||
|
(define-key map "m" 'notmuch-mua-mail)
|
||||||
|
(define-key map "s" 'notmuch-hello-goto-search)
|
||||||
|
map)
|
||||||
|
"Keymap for \"notmuch hello\" buffers.")
|
||||||
|
(fset 'notmuch-hello-mode-map notmuch-hello-mode-map)
|
||||||
|
|
||||||
|
(defun notmuch-hello-mode ()
|
||||||
|
"Major mode for convenient notmuch navigation. This is your entry portal into notmuch.
|
||||||
|
|
||||||
|
Complete list of currently available key bindings:
|
||||||
|
|
||||||
|
\\{notmuch-hello-mode-map}"
|
||||||
|
(interactive)
|
||||||
|
(kill-all-local-variables)
|
||||||
|
(use-local-map notmuch-hello-mode-map)
|
||||||
|
(setq major-mode 'notmuch-hello-mode
|
||||||
|
mode-name "notmuch-hello")
|
||||||
|
;;(setq buffer-read-only t)
|
||||||
|
)
|
||||||
|
|
||||||
(defun notmuch-hello (&optional no-display)
|
(defun notmuch-hello (&optional no-display)
|
||||||
(interactive)
|
(interactive)
|
||||||
|
|
||||||
|
@ -283,6 +313,9 @@ should be. Returns a cons cell `(tags-per-line width)'."
|
||||||
(let ((inhibit-read-only t))
|
(let ((inhibit-read-only t))
|
||||||
(erase-buffer))
|
(erase-buffer))
|
||||||
|
|
||||||
|
(unless (eq major-mode 'notmuch-hello-mode)
|
||||||
|
(notmuch-hello-mode))
|
||||||
|
|
||||||
(let ((all (overlay-lists)))
|
(let ((all (overlay-lists)))
|
||||||
;; Delete all the overlays.
|
;; Delete all the overlays.
|
||||||
(mapc 'delete-overlay (car all))
|
(mapc 'delete-overlay (car all))
|
||||||
|
@ -441,16 +474,6 @@ should be. Returns a cons cell `(tags-per-line width)'."
|
||||||
(let ((fill-column (- (window-width) notmuch-hello-indent)))
|
(let ((fill-column (- (window-width) notmuch-hello-indent)))
|
||||||
(center-region start (point))))
|
(center-region start (point))))
|
||||||
|
|
||||||
(use-local-map widget-keymap)
|
|
||||||
(local-set-key "=" 'notmuch-hello-update)
|
|
||||||
(local-set-key (kbd "<C-tab>") 'widget-backward)
|
|
||||||
(local-set-key "G" 'notmuch-hello-poll-and-update)
|
|
||||||
(local-set-key "m" 'notmuch-mua-mail)
|
|
||||||
(local-set-key "q" '(lambda () (interactive) (kill-buffer (current-buffer))))
|
|
||||||
(local-set-key "s" 'notmuch-hello-goto-search)
|
|
||||||
(local-set-key "v" '(lambda () (interactive)
|
|
||||||
(message "notmuch version %s" (notmuch-version))))
|
|
||||||
|
|
||||||
(widget-setup)
|
(widget-setup)
|
||||||
|
|
||||||
(when final-target-pos
|
(when final-target-pos
|
||||||
|
|
Loading…
Reference in a new issue