unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [RFC PATCH] emacs: make show view a/A/x/X key bindings more consistent
@ 2012-01-31 15:03 Jani Nikula
  2012-01-31 15:13 ` Austin Clements
  2012-01-31 15:25 ` David Edmondson
  0 siblings, 2 replies; 3+ messages in thread
From: Jani Nikula @ 2012-01-31 15:03 UTC (permalink / raw)
  To: notmuch

Proposal for show view a/A/x/X key bindings, according to
http://titanpad.com/SA39EbNezU and IRC discussion:

'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.

IMHO these changes would make the current implementation more
consistent in two ways: 1) 'a'/'A' would advance to next thread like
'a' used to do, 2) 'x' would operate on messages and 'X' on threads
like 'a'/'A' do now.

The implementation here is hacky at best, and I agree with dme that
notmuch-show.el could use some code cleanup and provide
non-interactive primitives. However I won't have the time and energy
for that right now.
---
 emacs/notmuch-show.el |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index de9421e..62f3664 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1075,9 +1075,10 @@ thread id.  If a prefix is given, crypto processing is toggled."
 	(define-key map "h" 'notmuch-show-toggle-headers)
 	(define-key map "-" 'notmuch-show-remove-tag)
 	(define-key map "+" 'notmuch-show-add-tag)
-	(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-thread-then-exit)
+	(define-key map "x" 'notmuch-show-archive-message-then-next-then-exit)
 	(define-key map "A" 'notmuch-show-archive-thread-then-next)
+	(define-key map "a" 'notmuch-show-archive-message-then-next-then-next)
 	(define-key map "N" 'notmuch-show-next-message)
 	(define-key map "P" 'notmuch-show-previous-message)
 	(define-key map "n" 'notmuch-show-next-open-message)
@@ -1425,10 +1426,12 @@ buffer."
     (if r
 	(progn
 	  (notmuch-show-mark-read)
-	  (notmuch-show-message-adjust))
+	  (notmuch-show-message-adjust)
+	  t)
       (if pop-at-end
 	  (notmuch-show-next-thread)
-	(goto-char (point-max))))))
+	(goto-char (point-max))
+	nil))))
 
 (defun notmuch-show-previous-open-message ()
   "Show the previous open message."
@@ -1645,12 +1648,23 @@ removed)."
       (notmuch-show-add-tag "inbox")
     (notmuch-show-remove-tag "inbox")))
 
-(defun notmuch-show-archive-message-then-next ()
-  "Archive the current message, then show the next open message in the current thread."
+(defun notmuch-show-archive-message-then-next-then-exit ()
+  "Archive the current message, then show the next open message in the current thread.
+
+If at the last message in thread, then exit back to search results."
   (interactive)
   (notmuch-show-archive-message)
   (notmuch-show-next-open-message t))
 
+(defun notmuch-show-archive-message-then-next-then-next ()
+  "Archive the current message, then show the next open message in the current thread.
+
+If at the last message in 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 ()
   "Copy CC field of current message to kill-ring."
   (interactive)
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] emacs: make show view a/A/x/X key bindings more consistent
  2012-01-31 15:03 [RFC PATCH] emacs: make show view a/A/x/X key bindings more consistent Jani Nikula
@ 2012-01-31 15:13 ` Austin Clements
  2012-01-31 15:25 ` David Edmondson
  1 sibling, 0 replies; 3+ messages in thread
From: Austin Clements @ 2012-01-31 15:13 UTC (permalink / raw)
  To: Jani Nikula; +Cc: notmuch

Quoth Jani Nikula on Jan 31 at  5:03 pm:
> Proposal for show view a/A/x/X key bindings, according to
> http://titanpad.com/SA39EbNezU and IRC discussion:
> 
> '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.
> 
> IMHO these changes would make the current implementation more
> consistent in two ways: 1) 'a'/'A' would advance to next thread like
> 'a' used to do, 2) 'x' would operate on messages and 'X' on threads
> like 'a'/'A' do now.

+1 to the proposal.  I don't know the maze of twisty little passages
that implement the show bindings well enough to say if the code is
right.

> The implementation here is hacky at best, and I agree with dme that
> notmuch-show.el could use some code cleanup and provide
> non-interactive primitives. However I won't have the time and energy
> for that right now.
> ---
>  emacs/notmuch-show.el |   26 ++++++++++++++++++++------
>  1 files changed, 20 insertions(+), 6 deletions(-)
> 
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index de9421e..62f3664 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1075,9 +1075,10 @@ thread id.  If a prefix is given, crypto processing is toggled."
>  	(define-key map "h" 'notmuch-show-toggle-headers)
>  	(define-key map "-" 'notmuch-show-remove-tag)
>  	(define-key map "+" 'notmuch-show-add-tag)
> -	(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-thread-then-exit)
> +	(define-key map "x" 'notmuch-show-archive-message-then-next-then-exit)
>  	(define-key map "A" 'notmuch-show-archive-thread-then-next)
> +	(define-key map "a" 'notmuch-show-archive-message-then-next-then-next)

notmuch-show-archive-message-then-next-then-next-thread?  I like the
very explicit names, but "then-next-then-next" is rather opaque.

>  	(define-key map "N" 'notmuch-show-next-message)
>  	(define-key map "P" 'notmuch-show-previous-message)
>  	(define-key map "n" 'notmuch-show-next-open-message)
> @@ -1425,10 +1426,12 @@ buffer."
>      (if r
>  	(progn
>  	  (notmuch-show-mark-read)
> -	  (notmuch-show-message-adjust))
> +	  (notmuch-show-message-adjust)
> +	  t)
>        (if pop-at-end
>  	  (notmuch-show-next-thread)
> -	(goto-char (point-max))))))
> +	(goto-char (point-max))
> +	nil))))
>  
>  (defun notmuch-show-previous-open-message ()
>    "Show the previous open message."
> @@ -1645,12 +1648,23 @@ removed)."
>        (notmuch-show-add-tag "inbox")
>      (notmuch-show-remove-tag "inbox")))
>  
> -(defun notmuch-show-archive-message-then-next ()
> -  "Archive the current message, then show the next open message in the current thread."
> +(defun notmuch-show-archive-message-then-next-then-exit ()
> +  "Archive the current message, then show the next open message in the current thread.
> +
> +If at the last message in thread, then exit back to search results."
>    (interactive)
>    (notmuch-show-archive-message)
>    (notmuch-show-next-open-message t))
>  
> +(defun notmuch-show-archive-message-then-next-then-next ()
> +  "Archive the current message, then show the next open message in the current thread.
> +
> +If at the last message in 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 ()
>    "Copy CC field of current message to kill-ring."
>    (interactive)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] emacs: make show view a/A/x/X key bindings more consistent
  2012-01-31 15:03 [RFC PATCH] emacs: make show view a/A/x/X key bindings more consistent Jani Nikula
  2012-01-31 15:13 ` Austin Clements
@ 2012-01-31 15:25 ` David Edmondson
  1 sibling, 0 replies; 3+ messages in thread
From: David Edmondson @ 2012-01-31 15:25 UTC (permalink / raw)
  To: Jani Nikula, notmuch

[-- Attachment #1: Type: text/plain, Size: 562 bytes --]

On Tue, 31 Jan 2012 17:03:55 +0200, Jani Nikula <jani@nikula.org> wrote:
> '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.

This seems consistent to me and would be an improvement.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-31 15:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-31 15:03 [RFC PATCH] emacs: make show view a/A/x/X key bindings more consistent Jani Nikula
2012-01-31 15:13 ` Austin Clements
2012-01-31 15:25 ` David Edmondson

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).