emacs: make show view a/A/x/X key bindings more consistent

Modify the show view key bindings as follows to make them more
consistent:

'a' = Archive current message, then move to next message, or show next
thread from search if at the last message in thread.

'A' = Archive each message in thread, then show next thread from
search.

'x' = Archive current message, then move to next message, or exit back
to search results if at the last message in thread.

'X' = Archive each message in thread, then exit back to search
results.

The changes make the key bindings more consistent in two ways:
1) 'a'/'A' both advance to the next thread like 'a' used to.
2) 'x' operates on messages and 'X' on threads like 'a'/'A'.
This commit is contained in:
Jani Nikula 2012-01-31 19:29:06 +02:00 committed by David Bremner
parent 61fa5c0bb8
commit d2ef4edc54

View file

@ -1087,9 +1087,10 @@ thread id. If a prefix is given, crypto processing is toggled."
(define-key map "*" 'notmuch-show-tag-all) (define-key map "*" 'notmuch-show-tag-all)
(define-key map "-" 'notmuch-show-remove-tag) (define-key map "-" 'notmuch-show-remove-tag)
(define-key map "+" 'notmuch-show-add-tag) (define-key map "+" 'notmuch-show-add-tag)
(define-key map "x" 'notmuch-show-archive-thread-then-exit) (define-key map "X" 'notmuch-show-archive-thread-then-exit)
(define-key map "a" 'notmuch-show-archive-message-then-next) (define-key map "x" 'notmuch-show-archive-message-then-next-or-exit)
(define-key map "A" 'notmuch-show-archive-thread-then-next) (define-key map "A" 'notmuch-show-archive-thread-then-next)
(define-key map "a" 'notmuch-show-archive-message-then-next-or-next-thread)
(define-key map "N" 'notmuch-show-next-message) (define-key map "N" 'notmuch-show-next-message)
(define-key map "P" 'notmuch-show-previous-message) (define-key map "P" 'notmuch-show-previous-message)
(define-key map "n" 'notmuch-show-next-open-message) (define-key map "n" 'notmuch-show-next-open-message)
@ -1452,7 +1453,8 @@ thread, navigate to the next thread in the parent search buffer."
If a prefix argument is given and this is the last open message If a prefix argument is given and this is the last open message
in the thread, navigate to the next thread in the parent search in the thread, navigate to the next thread in the parent search
buffer." buffer. Return t if there was a next open message in the thread
to show, nil otherwise."
(interactive "P") (interactive "P")
(let (r) (let (r)
(while (and (setq r (notmuch-show-goto-message-next)) (while (and (setq r (notmuch-show-goto-message-next))
@ -1463,7 +1465,8 @@ buffer."
(notmuch-show-message-adjust)) (notmuch-show-message-adjust))
(if pop-at-end (if pop-at-end
(notmuch-show-next-thread) (notmuch-show-next-thread)
(goto-char (point-max)))))) (goto-char (point-max))))
r))
(defun notmuch-show-previous-open-message () (defun notmuch-show-previous-open-message ()
"Show the previous open message." "Show the previous open message."
@ -1671,12 +1674,25 @@ removed)."
(let ((op (if unarchive "+" "-"))) (let ((op (if unarchive "+" "-")))
(notmuch-show-tag-message (concat op "inbox")))) (notmuch-show-tag-message (concat op "inbox"))))
(defun notmuch-show-archive-message-then-next () (defun notmuch-show-archive-message-then-next-or-exit ()
"Archive the current message, then show the next open message in the current thread." "Archive the current message, then show the next open message in the current thread.
If at the last open message in the current thread, then exit back
to search results."
(interactive) (interactive)
(notmuch-show-archive-message) (notmuch-show-archive-message)
(notmuch-show-next-open-message t)) (notmuch-show-next-open-message t))
(defun notmuch-show-archive-message-then-next-or-next-thread ()
"Archive the current message, then show the next open message in the current thread.
If at the last open message in the current thread, then show next
thread from search."
(interactive)
(notmuch-show-archive-message)
(unless (notmuch-show-next-open-message)
(notmuch-show-next-thread t)))
(defun notmuch-show-stash-cc () (defun notmuch-show-stash-cc ()
"Copy CC field of current message to kill-ring." "Copy CC field of current message to kill-ring."
(interactive) (interactive)