mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 20:08:10 +01:00
emacs: Improve the behaviour of the 'q' binding.
When a user hits 'q' in a notmuch buffer, kill the buffer only if there are no other windows currently showing it.
This commit is contained in:
parent
0f35ddcdfc
commit
30f1c43efe
4 changed files with 13 additions and 8 deletions
|
@ -135,7 +135,7 @@ For example, if you wanted to remove an \"inbox\" tag and add an
|
|||
(defvar notmuch-common-keymap
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map "?" 'notmuch-help)
|
||||
(define-key map "q" 'notmuch-kill-this-buffer)
|
||||
(define-key map "q" 'notmuch-bury-or-kill-this-buffer)
|
||||
(define-key map "s" 'notmuch-search)
|
||||
(define-key map "z" 'notmuch-tree)
|
||||
(define-key map "m" 'notmuch-mua-new-mail)
|
||||
|
@ -239,10 +239,15 @@ depending on the value of `notmuch-poll-script'."
|
|||
(call-process notmuch-poll-script nil nil))
|
||||
(call-process notmuch-command nil nil nil "new")))
|
||||
|
||||
(defun notmuch-kill-this-buffer ()
|
||||
"Kill the current buffer."
|
||||
(defun notmuch-bury-or-kill-this-buffer ()
|
||||
"Undisplay the current buffer.
|
||||
|
||||
Bury the current buffer, unless there is only one window showing
|
||||
it, in which case it is killed."
|
||||
(interactive)
|
||||
(kill-buffer (current-buffer)))
|
||||
(if (> (length (get-buffer-window-list nil nil t)) 1)
|
||||
(bury-buffer)
|
||||
(kill-buffer)))
|
||||
|
||||
(defun notmuch-documentation-first-line (symbol)
|
||||
"Return the first line of the documentation string for SYMBOL."
|
||||
|
|
|
@ -1956,7 +1956,7 @@ buffer. If PREVIOUS is non-nil, move to the previous item in the
|
|||
search results instead."
|
||||
(interactive "P")
|
||||
(let ((parent-buffer notmuch-show-parent-buffer))
|
||||
(notmuch-kill-this-buffer)
|
||||
(notmuch-bury-or-kill-this-buffer)
|
||||
(when (buffer-live-p parent-buffer)
|
||||
(switch-to-buffer parent-buffer)
|
||||
(and (if previous
|
||||
|
|
|
@ -234,7 +234,7 @@ FUNC."
|
|||
;; Override because we want to close message pane first.
|
||||
(define-key map [remap notmuch-help] (notmuch-tree-close-message-pane-and #'notmuch-help))
|
||||
;; Override because we first close message pane and then close tree buffer.
|
||||
(define-key map [remap notmuch-kill-this-buffer] 'notmuch-tree-quit)
|
||||
(define-key map [remap notmuch-bury-or-kill-this-buffer] 'notmuch-tree-quit)
|
||||
;; Override because we close message pane after the search query is entered.
|
||||
(define-key map [remap notmuch-search] 'notmuch-tree-to-search)
|
||||
;; Override because we want to close message pane first.
|
||||
|
|
|
@ -153,7 +153,7 @@ there will be called at other points of notmuch execution."
|
|||
(defvar notmuch-search-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(set-keymap-parent map notmuch-common-keymap)
|
||||
(define-key map "x" 'notmuch-kill-this-buffer)
|
||||
(define-key map "x" 'notmuch-bury-or-kill-this-buffer)
|
||||
(define-key map (kbd "<DEL>") 'notmuch-search-scroll-down)
|
||||
(define-key map "b" 'notmuch-search-scroll-down)
|
||||
(define-key map " " 'notmuch-search-scroll-up)
|
||||
|
@ -961,7 +961,7 @@ same relative position within the new buffer."
|
|||
(oldest-first notmuch-search-oldest-first)
|
||||
(target-thread (notmuch-search-find-thread-id 'bare))
|
||||
(query notmuch-search-query-string))
|
||||
(notmuch-kill-this-buffer)
|
||||
(notmuch-bury-or-kill-this-buffer)
|
||||
(notmuch-search query oldest-first target-thread target-line)
|
||||
(goto-char (point-min))))
|
||||
|
||||
|
|
Loading…
Reference in a new issue