unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* show-mode message/thread archiving improvements
@ 2012-01-17 18:05 Jameson Graef Rollins
  2012-01-17 18:05 ` [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two generally useful functions Jameson Graef Rollins
                   ` (2 more replies)
  0 siblings, 3 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-17 18:05 UTC (permalink / raw)
  To: Notmuch Mail

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

I have reworked the show-mode message/thread archiving improvements from
two now-obsolete patch sets:

id:"1325975294-646-1-git-send-email-jrollins@finestructure.net"
id:"1325986015-22510-1-git-send-email-jrollins@finestructure.net"

All the "delete" stuff has been removed from this series, and I just
focus on improving the functions associated with message and thread
tagging, archiving, and navigation.  I also incorporated some good
suggestions from Aaron Ecay to make things "lispier".

The first five patches should be non-controversial and just improve the
available functions without changing any visible behavior.  Together
they make it much easier for users to create useful custom key bindings
to achieve custom tagging and navigation operations.

The last patch changes the default keybind for the 'a' key to archive
just the current message, and not the entire thread.  In my opinion this
is a *much* more sensible binding for this key.  I actually rebound to
this immediately after I started using notmuch long ago.  It also adds a
new 'A' that performs the old function to archive the entire thread and
move on.

jamie.

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

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

* [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two generally useful functions
  2012-01-17 18:05 show-mode message/thread archiving improvements Jameson Graef Rollins
@ 2012-01-17 18:05 ` Jameson Graef Rollins
  2012-01-17 18:05   ` [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread Jameson Graef Rollins
                     ` (2 more replies)
  2012-01-17 20:09 ` show-mode message/thread archiving improvements Aaron Ecay
  2012-01-23  8:33 ` Jameson Graef Rollins
  2 siblings, 3 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-17 18:05 UTC (permalink / raw)
  To: Notmuch Mail

Brake up notmuch-show-archive-thread-internal into two new functions:

notmuch-show-tag-thread-internal: applies a tag to all messages in
thread.  If option remove flag is t, tags will be removed instead of
added.

notmuch-show-next-thread: moves to the next thread in the search
result.  If given a prefix, will show the next result, otherwise will
just move to it in the search view.

Two new interactive functions, notmuch-show-{add,remove}-tag-thread,
are also added.  Together, these provide a better suit of thread
tagging and navigation tools.

The higher level thread archiving functions are modified to use these
new functions.
---
 emacs/notmuch-show.el |   33 ++++++++++++++++++++++++++-------
 1 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 03c1f6b..3625afd 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1421,12 +1421,29 @@ argument, hide all of the messages."
   (interactive)
   (backward-button 1))
 
-(defun notmuch-show-archive-thread-internal (show-next)
-  ;; Remove the tag from the current set of messages.
+(defun notmuch-show-tag-thread-internal (tag &optional remove)
+  ;; Add tag to the current set of messages.  If the remove switch is
+  ;; given, tags will be removed instead of added.
   (goto-char (point-min))
-  (loop do (notmuch-show-remove-tag "inbox")
-	until (not (notmuch-show-goto-message-next)))
-  ;; Move to the next item in the search results, if any.
+  (let ((tag-function 'notmuch-show-add-tag))
+    (if remove
+	(setq tag-function 'notmuch-show-remove-tag))
+    (loop do (funcall tag-function tag)
+	  until (not (notmuch-show-goto-message-next)))))
+
+(defun notmuch-show-add-tag-thread (tag)
+  "Add tag to all messages in the current thread."
+  (interactive)
+  (notmuch-show-tag-thread-internal tag))
+
+(defun notmuch-show-remove-tag-thread (tag)
+  "Remove tag from all messages in the current thread."
+  (interactive)
+  (notmuch-show-tag-thread-internal tag t))
+
+(defun notmuch-show-next-thread (&optional show-next)
+  "Move to the next item in the search results, if any."
+  (interactive)
   (let ((parent-buffer notmuch-show-parent-buffer))
     (notmuch-kill-this-buffer)
     (if parent-buffer
@@ -1448,12 +1465,14 @@ being delivered to the same thread. It does not archive the
 entire thread, but only the messages shown in the current
 buffer."
   (interactive)
-  (notmuch-show-archive-thread-internal t))
+  (notmuch-show-remove-tag-thread "inbox")
+  (notmuch-show-next-thread t))
 
 (defun notmuch-show-archive-thread-then-exit ()
   "Archive each message in thread, then exit back to search results."
   (interactive)
-  (notmuch-show-archive-thread-internal nil))
+  (notmuch-show-remove-tag-thread "inbox")
+  (notmuch-show-next-thread))
 
 (defun notmuch-show-stash-cc ()
   "Copy CC field of current message to kill-ring."
-- 
1.7.7.3

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

* [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread
  2012-01-17 18:05 ` [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two generally useful functions Jameson Graef Rollins
@ 2012-01-17 18:05   ` Jameson Graef Rollins
  2012-01-17 18:05     ` [PATCH 3/6] emacs: add message archiving functions Jameson Graef Rollins
  2012-01-18  8:08     ` [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread David Edmondson
  2012-01-17 20:10   ` [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two generally useful functions Aaron Ecay
  2012-01-18  8:06   ` David Edmondson
  2 siblings, 2 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-17 18:05 UTC (permalink / raw)
  To: Notmuch Mail

This function is now just for archiving the current thread.  A new
function is created to archive-then-next.  The 'a' key binding is
updated accordingly.

This will allow people to bind to the simple thread archiving function
without the extra navigation.  The archive-thread function now also
takes a prefix to unarchive the current thread (ie. put the whole
thread back in the inbox).
---
 emacs/notmuch-show.el |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 3625afd..ee9ef62 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -945,7 +945,7 @@ thread id.  If a prefix is given, crypto processing is toggled."
 	(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-thread)
+	(define-key map "a" 'notmuch-show-archive-thread-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)
@@ -1200,7 +1200,7 @@ thread from the search from which this thread was originally
 shown."
   (interactive)
   (if (notmuch-show-advance)
-      (notmuch-show-archive-thread)))
+      (notmuch-show-archive-thread-then-next)))
 
 (defun notmuch-show-rewind ()
   "Backup through the thread, (reverse scrolling compared to \\[notmuch-show-advance-and-archive]).
@@ -1453,8 +1453,12 @@ argument, hide all of the messages."
 	  (if show-next
 	      (notmuch-search-show-thread))))))
 
-(defun notmuch-show-archive-thread ()
-  "Archive each message in thread, then show next thread from search.
+(defun notmuch-show-archive-thread (&optional unarchive)
+  "Archive each message in thread.
+
+If a prefix argument is given, the messages will be
+\"unarchived\" (ie. the \"inbox\" tag will be added instead of
+removed).
 
 Archive each message currently shown by removing the \"inbox\"
 tag from each. Then kill this buffer and show the next thread
@@ -1465,13 +1469,20 @@ being delivered to the same thread. It does not archive the
 entire thread, but only the messages shown in the current
 buffer."
   (interactive)
-  (notmuch-show-remove-tag-thread "inbox")
+  (if unarchive
+      (notmuch-show-add-tag-thread "inbox")
+    (notmuch-show-remove-tag-thread "inbox")))
+
+(defun notmuch-show-archive-thread-then-next ()
+  "Archive each message in thread, then show next thread from search."
+  (interactive)
+  (notmuch-show-archive-thread)
   (notmuch-show-next-thread t))
 
 (defun notmuch-show-archive-thread-then-exit ()
   "Archive each message in thread, then exit back to search results."
   (interactive)
-  (notmuch-show-remove-tag-thread "inbox")
+  (notmuch-show-archive-thread)
   (notmuch-show-next-thread))
 
 (defun notmuch-show-stash-cc ()
-- 
1.7.7.3

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

* [PATCH 3/6] emacs: add message archiving functions
  2012-01-17 18:05   ` [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread Jameson Graef Rollins
@ 2012-01-17 18:05     ` Jameson Graef Rollins
  2012-01-17 18:05       ` [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end Jameson Graef Rollins
                         ` (3 more replies)
  2012-01-18  8:08     ` [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread David Edmondson
  1 sibling, 4 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-17 18:05 UTC (permalink / raw)
  To: Notmuch Mail

This adds two new message archiving functions that parallel the thread
archiving functions: notmuch-show-archive-message{,-then-next}.  The
former also takes a prefix argument to unarchive the message (ie. put
back in inbox).
---
 emacs/notmuch-show.el |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index ee9ef62..207949c 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1485,6 +1485,23 @@ buffer."
   (notmuch-show-archive-thread)
   (notmuch-show-next-thread))
 
+(defun notmuch-show-archive-message (&optional unarchive)
+  "Archive the current message.
+
+If a prefix argument is given, the message will be
+\"unarchived\" (ie. the \"inbox\" tag will be added instead of
+removed)."
+  (interactive)
+  (if unarchive
+      (notmuch-show-add-tag "inbox")
+    (notmuch-show-remove-tag "inbox")))
+
+(defun notmuch-show-archive-message-then-next ()
+  "Archive the current message, then show next thread from search."
+  (interactive)
+  (notmuch-show-archive-message)
+  (notmuch-show-next-open-message))
+
 (defun notmuch-show-stash-cc ()
   "Copy CC field of current message to kill-ring."
   (interactive)
-- 
1.7.7.3

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

* [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end
  2012-01-17 18:05     ` [PATCH 3/6] emacs: add message archiving functions Jameson Graef Rollins
@ 2012-01-17 18:05       ` Jameson Graef Rollins
  2012-01-17 18:05         ` [PATCH 5/6] emacs: use pop-at-end functionality in show-archive-message-then-next function Jameson Graef Rollins
  2012-01-18  8:12         ` [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end David Edmondson
  2012-01-17 18:43       ` [PATCH] emacs: fix archive thread/message function documentation Jameson Graef Rollins
                         ` (2 subsequent siblings)
  3 siblings, 2 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-17 18:05 UTC (permalink / raw)
  To: Notmuch Mail

This will allow for keybindings that achieve a smoother message
processing flow by reducing the number of key presses needed for most
common operations.
---
 emacs/notmuch-show.el |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 207949c..6b2e6e9 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1270,17 +1270,23 @@ any effects from previous calls to
   (notmuch-show-mark-read)
   (notmuch-show-message-adjust))
 
-(defun notmuch-show-next-open-message ()
+(defun notmuch-show-next-open-message (&optional pop-at-end)
   "Show the next message."
   (interactive)
-  (let (r)
+  (let ((r)
+	(parent-buffer notmuch-show-parent-buffer))
     (while (and (setq r (notmuch-show-goto-message-next))
 		(not (notmuch-show-message-visible-p))))
     (if r
 	(progn
 	  (notmuch-show-mark-read)
 	  (notmuch-show-message-adjust))
-      (goto-char (point-max)))))
+      (if (and parent-buffer pop-at-end)
+	  (progn
+	    (kill-this-buffer)
+	    (switch-to-buffer parent-buffer)
+	    (forward-line 1))
+	(goto-char (point-max))))))
 
 (defun notmuch-show-previous-open-message ()
   "Show the previous message."
-- 
1.7.7.3

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

* [PATCH 5/6] emacs: use pop-at-end functionality in show-archive-message-then-next function
  2012-01-17 18:05       ` [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end Jameson Graef Rollins
@ 2012-01-17 18:05         ` Jameson Graef Rollins
  2012-01-17 18:05           ` [PATCH 6/6] emacs: modify the default show-mode key bindings for archiving Jameson Graef Rollins
  2012-01-18  8:12         ` [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end David Edmondson
  1 sibling, 1 reply; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-17 18:05 UTC (permalink / raw)
  To: Notmuch Mail

This provides a smoother message processing flow by reducing the
number of key presses needed for these common operations.
---
 emacs/notmuch-show.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 6b2e6e9..21eadbe 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1506,7 +1506,7 @@ removed)."
   "Archive the current message, then show next thread from search."
   (interactive)
   (notmuch-show-archive-message)
-  (notmuch-show-next-open-message))
+  (notmuch-show-next-open-message t))
 
 (defun notmuch-show-stash-cc ()
   "Copy CC field of current message to kill-ring."
-- 
1.7.7.3

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

* [PATCH 6/6] emacs: modify the default show-mode key bindings for archiving
  2012-01-17 18:05         ` [PATCH 5/6] emacs: use pop-at-end functionality in show-archive-message-then-next function Jameson Graef Rollins
@ 2012-01-17 18:05           ` Jameson Graef Rollins
  2012-01-18  8:13             ` David Edmondson
  0 siblings, 1 reply; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-17 18:05 UTC (permalink / raw)
  To: Notmuch Mail

This changes the default key bindings for the 'a' key in notmuch-show
mode.  Instead of archiving the entire thread, it now just archives
the current message, and then advance to the next open message
(archive-message-then-next).  'A' is now bound to the previous
archive-thread-then-next function.
---
 emacs/notmuch-show.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 21eadbe..c488e6a 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -945,7 +945,8 @@ thread id.  If a prefix is given, crypto processing is toggled."
 	(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-thread-then-next)
+	(define-key map "a" 'notmuch-show-archive-message-then-next)
+	(define-key map "A" 'notmuch-show-archive-thread-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)
-- 
1.7.7.3

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

* [PATCH] emacs: fix archive thread/message function documentation.
  2012-01-17 18:05     ` [PATCH 3/6] emacs: add message archiving functions Jameson Graef Rollins
  2012-01-17 18:05       ` [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end Jameson Graef Rollins
@ 2012-01-17 18:43       ` Jameson Graef Rollins
  2012-01-17 20:13       ` [PATCH 3/6] emacs: add message archiving functions Aaron Ecay
  2012-01-18  8:09       ` David Edmondson
  3 siblings, 0 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-17 18:43 UTC (permalink / raw)
  To: Notmuch Mail

This removes an inaccuracy in the thread archiving function, and adds
a clarification to the message archiving function.
---
Late catch on some documentation inaccuracies.  Apologies.

 emacs/notmuch-show.el |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index c488e6a..c1d721e 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1463,13 +1463,10 @@ argument, hide all of the messages."
 (defun notmuch-show-archive-thread (&optional unarchive)
   "Archive each message in thread.
 
-If a prefix argument is given, the messages will be
-\"unarchived\" (ie. the \"inbox\" tag will be added instead of
-removed).
-
 Archive each message currently shown by removing the \"inbox\"
-tag from each. Then kill this buffer and show the next thread
-from the search from which this thread was originally shown.
+tag from each.  If a prefix argument is given, the messages will
+be \"unarchived\" (ie. the \"inbox\" tag will be added instead of
+removed).
 
 Note: This command is safe from any race condition of new messages
 being delivered to the same thread. It does not archive the
@@ -1493,7 +1490,7 @@ buffer."
   (notmuch-show-next-thread))
 
 (defun notmuch-show-archive-message (&optional unarchive)
-  "Archive the current message.
+  "Archive the current message (remove \"inbox\" tag).
 
 If a prefix argument is given, the message will be
 \"unarchived\" (ie. the \"inbox\" tag will be added instead of
-- 
1.7.7.3

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

* Re: show-mode message/thread archiving improvements
  2012-01-17 18:05 show-mode message/thread archiving improvements Jameson Graef Rollins
  2012-01-17 18:05 ` [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two generally useful functions Jameson Graef Rollins
@ 2012-01-17 20:09 ` Aaron Ecay
  2012-01-23  8:33 ` Jameson Graef Rollins
  2 siblings, 0 replies; 59+ messages in thread
From: Aaron Ecay @ 2012-01-17 20:09 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

+1 on this series from me.  (Minor comments on a couple of the patches
to follow.)

-- 
Aaron Ecay

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

* Re: [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two generally useful functions
  2012-01-17 18:05 ` [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two generally useful functions Jameson Graef Rollins
  2012-01-17 18:05   ` [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread Jameson Graef Rollins
@ 2012-01-17 20:10   ` Aaron Ecay
  2012-01-17 20:17     ` Jameson Graef Rollins
  2012-01-18  8:06   ` David Edmondson
  2 siblings, 1 reply; 59+ messages in thread
From: Aaron Ecay @ 2012-01-17 20:10 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

On Tue, 17 Jan 2012 10:05:26 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> Brake up notmuch-show-archive-thread-internal into two new functions:
> 
> notmuch-show-tag-thread-internal: applies a tag to all messages in
> thread.  If option remove flag is t, tags will be removed instead of
> added.
> 
> notmuch-show-next-thread: moves to the next thread in the search
> result.  If given a prefix, will show the next result, otherwise will
> just move to it in the search view.
> 
> Two new interactive functions, notmuch-show-{add,remove}-tag-thread,
> are also added.  Together, these provide a better suit of thread
> tagging and navigation tools.
> 
> The higher level thread archiving functions are modified to use these
> new functions.
> ---
>  emacs/notmuch-show.el |   33 ++++++++++++++++++++++++++-------
>  1 files changed, 26 insertions(+), 7 deletions(-)
> 
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 03c1f6b..3625afd 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1421,12 +1421,29 @@ argument, hide all of the messages."
>    (interactive)
>    (backward-button 1))
>  
> -(defun notmuch-show-archive-thread-internal (show-next)
> -  ;; Remove the tag from the current set of messages.
> +(defun notmuch-show-tag-thread-internal (tag &optional remove)
> +  ;; Add tag to the current set of messages.  If the remove switch is
> +  ;; given, tags will be removed instead of added.

This should be a docstring instead of a comment.  (This applies equally
to the old version....)

-- 
Aaron Ecay

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

* Re: [PATCH 3/6] emacs: add message archiving functions
  2012-01-17 18:05     ` [PATCH 3/6] emacs: add message archiving functions Jameson Graef Rollins
  2012-01-17 18:05       ` [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end Jameson Graef Rollins
  2012-01-17 18:43       ` [PATCH] emacs: fix archive thread/message function documentation Jameson Graef Rollins
@ 2012-01-17 20:13       ` Aaron Ecay
  2012-01-17 20:18         ` Jameson Graef Rollins
  2012-01-18  8:09       ` David Edmondson
  3 siblings, 1 reply; 59+ messages in thread
From: Aaron Ecay @ 2012-01-17 20:13 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

On Tue, 17 Jan 2012 10:05:28 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> This adds two new message archiving functions that parallel the thread
> archiving functions: notmuch-show-archive-message{,-then-next}.  The
> former also takes a prefix argument to unarchive the message (ie. put
> back in inbox).
> ---
>  emacs/notmuch-show.el |   17 +++++++++++++++++
>  1 files changed, 17 insertions(+), 0 deletions(-)
> 
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index ee9ef62..207949c 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1485,6 +1485,23 @@ buffer."
>    (notmuch-show-archive-thread)
>    (notmuch-show-next-thread))
>  
> +(defun notmuch-show-archive-message (&optional unarchive)
> +  "Archive the current message.
> +
> +If a prefix argument is given, the message will be
> +\"unarchived\" (ie. the \"inbox\" tag will be added instead of
> +removed)."
> +  (interactive)

If this function uses the prefix arg, its interactive call should be
“(interactive "P")”.  This applies equally to the -thread variant in
patch 2/6, but I made the comment here because that diff doesn’t show
the function contiguously.

-- 
Aaron Ecay

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

* Re: [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two generally useful functions
  2012-01-17 20:10   ` [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two generally useful functions Aaron Ecay
@ 2012-01-17 20:17     ` Jameson Graef Rollins
  2012-01-17 20:57       ` Aaron Ecay
  2012-01-18  8:14       ` David Edmondson
  0 siblings, 2 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-17 20:17 UTC (permalink / raw)
  To: Aaron Ecay, Notmuch Mail

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

On Tue, 17 Jan 2012 15:10:40 -0500, Aaron Ecay <aaronecay@gmail.com> wrote:
> This should be a docstring instead of a comment.  (This applies equally
> to the old version....)

We're not currently in the habit of adding doc strings for
non-interactive programs.  Do we need to go down that route?

jamie.

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

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

* Re: [PATCH 3/6] emacs: add message archiving functions
  2012-01-17 20:13       ` [PATCH 3/6] emacs: add message archiving functions Aaron Ecay
@ 2012-01-17 20:18         ` Jameson Graef Rollins
  0 siblings, 0 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-17 20:18 UTC (permalink / raw)
  To: Aaron Ecay, Notmuch Mail

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

On Tue, 17 Jan 2012 15:13:47 -0500, Aaron Ecay <aaronecay@gmail.com> wrote:
> If this function uses the prefix arg, its interactive call should be
> “(interactive "P")”.  This applies equally to the -thread variant in
> patch 2/6, but I made the comment here because that diff doesn’t show
> the function contiguously.

Ah yes.  Good catch, Aaron.  I'll fix that and resend.

jamie.

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

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

* Re: [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two generally useful functions
  2012-01-17 20:17     ` Jameson Graef Rollins
@ 2012-01-17 20:57       ` Aaron Ecay
  2012-01-18  8:14       ` David Edmondson
  1 sibling, 0 replies; 59+ messages in thread
From: Aaron Ecay @ 2012-01-17 20:57 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

On Tue, 17 Jan 2012 12:17:54 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> 
> We're not currently in the habit of adding doc strings for
> non-interactive programs.  Do we need to go down that route?

It is handy for developers, since the usual documentation facilities
(describe-function, apropos, ...) will then work for that function too.
Emacs documentation recommends(-ish) this:

,----[ Elisp manual Section D.6 ]
| An internal variable or subroutine of a Lisp program might as well
| have a documentation string.  In earlier Emacs versions, you could
| save space by using a comment instead of a documentation string,
| but that is no longer the case--documentation strings now take up
| very little space in a running Emacs.
`----

-- 
Aaron Ecay

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

* Re: [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two generally useful functions
  2012-01-17 18:05 ` [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two generally useful functions Jameson Graef Rollins
  2012-01-17 18:05   ` [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread Jameson Graef Rollins
  2012-01-17 20:10   ` [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two generally useful functions Aaron Ecay
@ 2012-01-18  8:06   ` David Edmondson
  2 siblings, 0 replies; 59+ messages in thread
From: David Edmondson @ 2012-01-18  8:06 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

Very happy with the overall ideas.

On Tue, 17 Jan 2012 10:05:26 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> -(defun notmuch-show-archive-thread-internal (show-next)
> -  ;; Remove the tag from the current set of messages.
> +(defun notmuch-show-tag-thread-internal (tag &optional remove)
> +  ;; Add tag to the current set of messages.  If the remove switch is
> +  ;; given, tags will be removed instead of added.
>    (goto-char (point-min))
> -  (loop do (notmuch-show-remove-tag "inbox")
> -	until (not (notmuch-show-goto-message-next)))
> -  ;; Move to the next item in the search results, if any.
> +  (let ((tag-function 'notmuch-show-add-tag))
> +    (if remove
> +	(setq tag-function 'notmuch-show-remove-tag))

This seems odd. How about:

 (let ((tag-function (if remove 'notmuch-show-remove-tag 'notmuch-show-add-tag)))
  ...

> +    (loop do (funcall tag-function tag)
> +	  until (not (notmuch-show-goto-message-next)))))

Otherwise good.

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

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

* Re: [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread
  2012-01-17 18:05   ` [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread Jameson Graef Rollins
  2012-01-17 18:05     ` [PATCH 3/6] emacs: add message archiving functions Jameson Graef Rollins
@ 2012-01-18  8:08     ` David Edmondson
  1 sibling, 0 replies; 59+ messages in thread
From: David Edmondson @ 2012-01-18  8:08 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

+1.

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

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

* Re: [PATCH 3/6] emacs: add message archiving functions
  2012-01-17 18:05     ` [PATCH 3/6] emacs: add message archiving functions Jameson Graef Rollins
                         ` (2 preceding siblings ...)
  2012-01-17 20:13       ` [PATCH 3/6] emacs: add message archiving functions Aaron Ecay
@ 2012-01-18  8:09       ` David Edmondson
  3 siblings, 0 replies; 59+ messages in thread
From: David Edmondson @ 2012-01-18  8:09 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

+1.

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

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

* Re: [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end
  2012-01-17 18:05       ` [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end Jameson Graef Rollins
  2012-01-17 18:05         ` [PATCH 5/6] emacs: use pop-at-end functionality in show-archive-message-then-next function Jameson Graef Rollins
@ 2012-01-18  8:12         ` David Edmondson
  2012-01-18  8:47           ` Jameson Graef Rollins
  1 sibling, 1 reply; 59+ messages in thread
From: David Edmondson @ 2012-01-18  8:12 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

On Tue, 17 Jan 2012 10:05:29 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> -(defun notmuch-show-next-open-message ()
> +(defun notmuch-show-next-open-message (&optional pop-at-end)
>    "Show the next message."
>    (interactive)
> -  (let (r)
> +  (let ((r)
> +	(parent-buffer notmuch-show-parent-buffer))

No need for brackets around `r'. Please put initialised local variables
before uninitialised.

>      (while (and (setq r (notmuch-show-goto-message-next))
>  		(not (notmuch-show-message-visible-p))))
>      (if r
>  	(progn
>  	  (notmuch-show-mark-read)
>  	  (notmuch-show-message-adjust))
> -      (goto-char (point-max)))))
> +      (if (and parent-buffer pop-at-end)
> +	  (progn
> +	    (kill-this-buffer)
> +	    (switch-to-buffer parent-buffer)
> +	    (forward-line 1))
> +	(goto-char (point-max))))))

Can you explain in words how this is expected to behave please?

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

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

* Re: [PATCH 6/6] emacs: modify the default show-mode key bindings for archiving
  2012-01-17 18:05           ` [PATCH 6/6] emacs: modify the default show-mode key bindings for archiving Jameson Graef Rollins
@ 2012-01-18  8:13             ` David Edmondson
  0 siblings, 0 replies; 59+ messages in thread
From: David Edmondson @ 2012-01-18  8:13 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

+1.

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

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

* Re: [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two generally useful functions
  2012-01-17 20:17     ` Jameson Graef Rollins
  2012-01-17 20:57       ` Aaron Ecay
@ 2012-01-18  8:14       ` David Edmondson
  1 sibling, 0 replies; 59+ messages in thread
From: David Edmondson @ 2012-01-18  8:14 UTC (permalink / raw)
  To: Jameson Graef Rollins, Aaron Ecay, Notmuch Mail

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

On Tue, 17 Jan 2012 12:17:54 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> On Tue, 17 Jan 2012 15:10:40 -0500, Aaron Ecay <aaronecay@gmail.com> wrote:
> > This should be a docstring instead of a comment.  (This applies equally
> > to the old version....)
> 
> We're not currently in the habit of adding doc strings for
> non-interactive programs.  Do we need to go down that route?

They are nice to have, especially if we already have the comment.

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

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

* Re: [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end
  2012-01-18  8:12         ` [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end David Edmondson
@ 2012-01-18  8:47           ` Jameson Graef Rollins
  2012-01-18  8:56             ` David Edmondson
  0 siblings, 1 reply; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-18  8:47 UTC (permalink / raw)
  To: David Edmondson, Notmuch Mail

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

On Wed, 18 Jan 2012 08:12:27 +0000, David Edmondson <dme@dme.org> wrote:
> No need for brackets around `r'. Please put initialised local variables
> before uninitialised.

Yeah, that's another comment of Aron's that I forgot to fix this time
around.  Sorry about that.

> >      (while (and (setq r (notmuch-show-goto-message-next))
> >  		(not (notmuch-show-message-visible-p))))
> >      (if r
> >  	(progn
> >  	  (notmuch-show-mark-read)
> >  	  (notmuch-show-message-adjust))
> > -      (goto-char (point-max)))))
> > +      (if (and parent-buffer pop-at-end)
> > +	  (progn
> > +	    (kill-this-buffer)
> > +	    (switch-to-buffer parent-buffer)
> > +	    (forward-line 1))
> > +	(goto-char (point-max))))))
> 
> Can you explain in words how this is expected to behave please?

If there is not another message, but there is a parent buffer and the
pop-at-end variable is set, kill this buffer, go the parent, and move to
the next thread.  Otherwise, go to the max point in the buffer.

Do you see a problem?

The one thing I do realize now is that the behavior might be slightly
strange if the parent buffer is itself a show buffer.  In that case, the
forward-line part doesn't make any sense.  It should check that the
parent is a search buffer first.  It should also use the notmuch-search
function to jump to the next thread (notmuch-search-next-thread).  The
notmuch-show-next-thread function could use the same improvements.

jamie.

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

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

* Re: [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end
  2012-01-18  8:47           ` Jameson Graef Rollins
@ 2012-01-18  8:56             ` David Edmondson
  2012-01-18 18:53               ` Jameson Graef Rollins
  0 siblings, 1 reply; 59+ messages in thread
From: David Edmondson @ 2012-01-18  8:56 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

On Wed, 18 Jan 2012 00:47:11 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> > >      (while (and (setq r (notmuch-show-goto-message-next))
> > >  		(not (notmuch-show-message-visible-p))))
> > >      (if r
> > >  	(progn
> > >  	  (notmuch-show-mark-read)
> > >  	  (notmuch-show-message-adjust))
> > > -      (goto-char (point-max)))))
> > > +      (if (and parent-buffer pop-at-end)
> > > +	  (progn
> > > +	    (kill-this-buffer)
> > > +	    (switch-to-buffer parent-buffer)
> > > +	    (forward-line 1))
> > > +	(goto-char (point-max))))))
> > 
> > Can you explain in words how this is expected to behave please?
> 
> Do you see a problem?

Not a problem, just trying to understand the behaviour (I have to revive
my advance/rewind patches at some point).

> If there is not another message, but there is a parent buffer and the
> pop-at-end variable is set, kill this buffer, go the parent, and move to
> the next thread.  Otherwise, go to the max point in the buffer.

I'm used to the cursor going to the bottom of the thread to let me know
that I reached the end, then I hit 'space' and move on to the next
thread. Will that behaviour be retained with this patch? (Well,
including your other patch which seemed to set `pop-at-end'.)

It's one of those things that I have to try out to understand properly I
expect.

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

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

* Re: [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end
  2012-01-18  8:56             ` David Edmondson
@ 2012-01-18 18:53               ` Jameson Graef Rollins
  0 siblings, 0 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-18 18:53 UTC (permalink / raw)
  To: David Edmondson, Notmuch Mail

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

On Wed, 18 Jan 2012 08:56:26 +0000, David Edmondson <dme@dme.org> wrote:
> I'm used to the cursor going to the bottom of the thread to let me know
> that I reached the end, then I hit 'space' and move on to the next
> thread. Will that behaviour be retained with this patch? (Well,
> including your other patch which seemed to set `pop-at-end'.)

This doesn't change the default behavior of the 'n' key, if that's what
you're asking, so the behavior you're describing should work the same.

jamie.

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

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

* Re: show-mode message/thread archiving improvements
  2012-01-17 18:05 show-mode message/thread archiving improvements Jameson Graef Rollins
  2012-01-17 18:05 ` [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two generally useful functions Jameson Graef Rollins
  2012-01-17 20:09 ` show-mode message/thread archiving improvements Aaron Ecay
@ 2012-01-23  8:33 ` Jameson Graef Rollins
  2012-01-23  8:34   ` [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions Jameson Graef Rollins
  2012-01-25  0:06   ` Jameson Graef Rollins
  2 siblings, 2 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-23  8:33 UTC (permalink / raw)
  To: Notmuch Mail

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

v2 of this series to follow, based on some good feedback from David and
Aaron.

Reminder:

> The last patch changes the default keybind for the 'a' key to archive
> just the current message, and not the entire thread.  In my opinion this
> is a *much* more sensible binding for this key.  I actually rebound to
> this immediately after I started using notmuch long ago.  It also adds a
> new 'A' that performs the old function to archive the entire thread and
> move on.

jamie.

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

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

* [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions
  2012-01-23  8:33 ` Jameson Graef Rollins
@ 2012-01-23  8:34   ` Jameson Graef Rollins
  2012-01-23  8:34     ` [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread Jameson Graef Rollins
  2012-01-23 11:00     ` [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions David Edmondson
  2012-01-25  0:06   ` Jameson Graef Rollins
  1 sibling, 2 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-23  8:34 UTC (permalink / raw)
  To: Notmuch Mail

Brake up notmuch-show-archive-thread-internal into two new functions:

notmuch-show-tag-thread-internal: applies a tag to all messages in
thread.  If option remove flag is t, tags will be removed instead of
added.

notmuch-show-next-thread: moves to the next thread in the search
result.  If given a prefix, will show the next result, otherwise will
just move to it in the search view.

Two new interactive functions, notmuch-show-{add,remove}-tag-thread,
are also added.  Together, these provide a better suit of thread
tagging and navigation tools.

The higher level thread archiving functions are modified to use these
new function.
---
 emacs/notmuch-show.el |   35 ++++++++++++++++++++++++++++-------
 1 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index e6a5b31..9638f35 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1524,12 +1524,31 @@ argument, hide all of the messages."
   (interactive)
   (backward-button 1))
 
-(defun notmuch-show-archive-thread-internal (show-next)
-  ;; Remove the tag from the current set of messages.
+(defun notmuch-show-tag-thread-internal (tag &optional remove)
+  "Add tag to the current set of messages.
+
+If the remove switch is given, tags will be removed instead of
+added."
   (goto-char (point-min))
-  (loop do (notmuch-show-remove-tag "inbox")
-	until (not (notmuch-show-goto-message-next)))
-  ;; Move to the next item in the search results, if any.
+  (let ((tag-function (if remove
+			  'notmuch-show-remove-tag
+			'notmuch-show-add-tag)))
+    (loop do (funcall tag-function tag)
+	  until (not (notmuch-show-goto-message-next)))))
+
+(defun notmuch-show-add-tag-thread (tag)
+  "Add tag to all messages in the current thread."
+  (interactive)
+  (notmuch-show-tag-thread-internal tag))
+
+(defun notmuch-show-remove-tag-thread (tag)
+  "Remove tag from all messages in the current thread."
+  (interactive)
+  (notmuch-show-tag-thread-internal tag t))
+
+(defun notmuch-show-next-thread (&optional show-next)
+  "Move to the next item in the search results, if any."
+  (interactive "P")
   (let ((parent-buffer notmuch-show-parent-buffer))
     (notmuch-kill-this-buffer)
     (if parent-buffer
@@ -1551,12 +1570,14 @@ being delivered to the same thread. It does not archive the
 entire thread, but only the messages shown in the current
 buffer."
   (interactive)
-  (notmuch-show-archive-thread-internal t))
+  (notmuch-show-remove-tag-thread "inbox")
+  (notmuch-show-next-thread t))
 
 (defun notmuch-show-archive-thread-then-exit ()
   "Archive each message in thread, then exit back to search results."
   (interactive)
-  (notmuch-show-archive-thread-internal nil))
+  (notmuch-show-remove-tag-thread "inbox")
+  (notmuch-show-next-thread))
 
 (defun notmuch-show-stash-cc ()
   "Copy CC field of current message to kill-ring."
-- 
1.7.8.3

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

* [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread
  2012-01-23  8:34   ` [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions Jameson Graef Rollins
@ 2012-01-23  8:34     ` Jameson Graef Rollins
  2012-01-23  8:34       ` [PATCH 3/6] emacs: add message archiving functions Jameson Graef Rollins
  2012-01-23 11:01       ` [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread David Edmondson
  2012-01-23 11:00     ` [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions David Edmondson
  1 sibling, 2 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-23  8:34 UTC (permalink / raw)
  To: Notmuch Mail

This function is now just for archiving the current thread.  A new
function is created to archive-then-next.  The 'a' key binding is
updated accordingly.

This will allow people to bind to the simple thread archiving function
without the extra navigation.  The archive-thread function now also
takes a prefix to unarchive the current thread (ie. put the whole
thread back in the inbox).
---
 emacs/notmuch-show.el |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 9638f35..21a655a 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1043,7 +1043,7 @@ thread id.  If a prefix is given, crypto processing is toggled."
 	(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-thread)
+	(define-key map "a" 'notmuch-show-archive-thread-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)
@@ -1303,7 +1303,7 @@ thread from the search from which this thread was originally
 shown."
   (interactive)
   (if (notmuch-show-advance)
-      (notmuch-show-archive-thread)))
+      (notmuch-show-archive-thread-then-next)))
 
 (defun notmuch-show-rewind ()
   "Backup through the thread, (reverse scrolling compared to \\[notmuch-show-advance-and-archive]).
@@ -1558,8 +1558,12 @@ added."
 	  (if show-next
 	      (notmuch-search-show-thread))))))
 
-(defun notmuch-show-archive-thread ()
-  "Archive each message in thread, then show next thread from search.
+(defun notmuch-show-archive-thread (&optional unarchive)
+  "Archive each message in thread.
+
+If a prefix argument is given, the messages will be
+\"unarchived\" (ie. the \"inbox\" tag will be added instead of
+removed).
 
 Archive each message currently shown by removing the \"inbox\"
 tag from each. Then kill this buffer and show the next thread
@@ -1569,14 +1573,21 @@ Note: This command is safe from any race condition of new messages
 being delivered to the same thread. It does not archive the
 entire thread, but only the messages shown in the current
 buffer."
+  (interactive "P")
+  (if unarchive
+      (notmuch-show-add-tag-thread "inbox")
+    (notmuch-show-remove-tag-thread "inbox")))
+
+(defun notmuch-show-archive-thread-then-next ()
+  "Archive each message in thread, then show next thread from search."
   (interactive)
-  (notmuch-show-remove-tag-thread "inbox")
+  (notmuch-show-archive-thread)
   (notmuch-show-next-thread t))
 
 (defun notmuch-show-archive-thread-then-exit ()
   "Archive each message in thread, then exit back to search results."
   (interactive)
-  (notmuch-show-remove-tag-thread "inbox")
+  (notmuch-show-archive-thread)
   (notmuch-show-next-thread))
 
 (defun notmuch-show-stash-cc ()
-- 
1.7.8.3

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

* [PATCH 3/6] emacs: add message archiving functions
  2012-01-23  8:34     ` [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread Jameson Graef Rollins
@ 2012-01-23  8:34       ` Jameson Graef Rollins
  2012-01-23  8:34         ` [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end Jameson Graef Rollins
                           ` (2 more replies)
  2012-01-23 11:01       ` [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread David Edmondson
  1 sibling, 3 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-23  8:34 UTC (permalink / raw)
  To: Notmuch Mail

This adds two new message archiving functions that parallel the thread
archiving functions: notmuch-show-archive-message{,-then-next}.  The
former also takes a prefix argument to unarchive the message (ie. put
back in inbox).
---
 emacs/notmuch-show.el |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 21a655a..fcd2878 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1590,6 +1590,23 @@ buffer."
   (notmuch-show-archive-thread)
   (notmuch-show-next-thread))
 
+(defun notmuch-show-archive-message (&optional unarchive)
+  "Archive the current message.
+
+If a prefix argument is given, the message will be
+\"unarchived\" (ie. the \"inbox\" tag will be added instead of
+removed)."
+  (interactive "P")
+  (if unarchive
+      (notmuch-show-add-tag "inbox")
+    (notmuch-show-remove-tag "inbox")))
+
+(defun notmuch-show-archive-message-then-next ()
+  "Archive the current message, then show next thread from search."
+  (interactive)
+  (notmuch-show-archive-message)
+  (notmuch-show-next-open-message))
+
 (defun notmuch-show-stash-cc ()
   "Copy CC field of current message to kill-ring."
   (interactive)
-- 
1.7.8.3

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

* [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end
  2012-01-23  8:34       ` [PATCH 3/6] emacs: add message archiving functions Jameson Graef Rollins
@ 2012-01-23  8:34         ` Jameson Graef Rollins
  2012-01-23  8:34           ` [PATCH 5/6] emacs: use pop-at-end functionality in show-archive-message-then-next function Jameson Graef Rollins
  2012-01-23 11:02           ` [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end David Edmondson
  2012-01-23 11:01         ` [PATCH 3/6] emacs: add message archiving functions David Edmondson
  2012-01-24 18:44         ` Tomi Ollila
  2 siblings, 2 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-23  8:34 UTC (permalink / raw)
  To: Notmuch Mail

This will allow for keybindings that achieve a smoother message
processing flow by reducing the number of key presses needed for most
common operations.
---
 emacs/notmuch-show.el |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index fcd2878..fe7ec6a 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1373,17 +1373,23 @@ any effects from previous calls to
   (notmuch-show-mark-read)
   (notmuch-show-message-adjust))
 
-(defun notmuch-show-next-open-message ()
+(defun notmuch-show-next-open-message (&optional pop-at-end)
   "Show the next message."
-  (interactive)
-  (let (r)
+  (interactive "P")
+  (let ((parent-buffer notmuch-show-parent-buffer)
+	(r))
     (while (and (setq r (notmuch-show-goto-message-next))
 		(not (notmuch-show-message-visible-p))))
     (if r
 	(progn
 	  (notmuch-show-mark-read)
 	  (notmuch-show-message-adjust))
-      (goto-char (point-max)))))
+      (if (and parent-buffer pop-at-end)
+	  (progn
+	    (kill-this-buffer)
+	    (switch-to-buffer parent-buffer)
+	    (notmuch-search-next-message))
+	(goto-char (point-max))))))
 
 (defun notmuch-show-previous-open-message ()
   "Show the previous message."
-- 
1.7.8.3

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

* [PATCH 5/6] emacs: use pop-at-end functionality in show-archive-message-then-next function
  2012-01-23  8:34         ` [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end Jameson Graef Rollins
@ 2012-01-23  8:34           ` Jameson Graef Rollins
  2012-01-23  8:34             ` [PATCH 6/6] emacs: modify the default show-mode key bindings for archiving Jameson Graef Rollins
  2012-01-23 11:02           ` [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end David Edmondson
  1 sibling, 1 reply; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-23  8:34 UTC (permalink / raw)
  To: Notmuch Mail

This provides a smoother message processing flow by reducing the
number of key presses needed for these common operations.
---
 emacs/notmuch-show.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index fe7ec6a..8c71d03 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1611,7 +1611,7 @@ removed)."
   "Archive the current message, then show next thread from search."
   (interactive)
   (notmuch-show-archive-message)
-  (notmuch-show-next-open-message))
+  (notmuch-show-next-open-message t))
 
 (defun notmuch-show-stash-cc ()
   "Copy CC field of current message to kill-ring."
-- 
1.7.8.3

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

* [PATCH 6/6] emacs: modify the default show-mode key bindings for archiving
  2012-01-23  8:34           ` [PATCH 5/6] emacs: use pop-at-end functionality in show-archive-message-then-next function Jameson Graef Rollins
@ 2012-01-23  8:34             ` Jameson Graef Rollins
  2012-01-23 11:14               ` David Edmondson
                                 ` (2 more replies)
  0 siblings, 3 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-23  8:34 UTC (permalink / raw)
  To: Notmuch Mail

This changes the default key bindings for the 'a' key in notmuch-show
mode.  Instead of archiving the entire thread, it now just archives
the current message, and then advance to the next open message
(archive-message-then-next).  'A' is now bound to the previous
archive-thread-then-next function.
---
 emacs/notmuch-show.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 8c71d03..29d9d92 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1043,7 +1043,8 @@ thread id.  If a prefix is given, crypto processing is toggled."
 	(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-thread-then-next)
+	(define-key map "a" 'notmuch-show-archive-message-then-next)
+	(define-key map "A" 'notmuch-show-archive-thread-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)
-- 
1.7.8.3

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

* Re: [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions
  2012-01-23  8:34   ` [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions Jameson Graef Rollins
  2012-01-23  8:34     ` [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread Jameson Graef Rollins
@ 2012-01-23 11:00     ` David Edmondson
  1 sibling, 0 replies; 59+ messages in thread
From: David Edmondson @ 2012-01-23 11:00 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

On Mon, 23 Jan 2012 00:34:20 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> Brake up notmuch-show-archive-thread-internal into two new functions:

"Break", otherwise +1.

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

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

* Re: [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread
  2012-01-23  8:34     ` [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread Jameson Graef Rollins
  2012-01-23  8:34       ` [PATCH 3/6] emacs: add message archiving functions Jameson Graef Rollins
@ 2012-01-23 11:01       ` David Edmondson
  1 sibling, 0 replies; 59+ messages in thread
From: David Edmondson @ 2012-01-23 11:01 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

+1.

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

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

* Re: [PATCH 3/6] emacs: add message archiving functions
  2012-01-23  8:34       ` [PATCH 3/6] emacs: add message archiving functions Jameson Graef Rollins
  2012-01-23  8:34         ` [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end Jameson Graef Rollins
@ 2012-01-23 11:01         ` David Edmondson
  2012-01-24 18:44         ` Tomi Ollila
  2 siblings, 0 replies; 59+ messages in thread
From: David Edmondson @ 2012-01-23 11:01 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

+1.

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

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

* Re: [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end
  2012-01-23  8:34         ` [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end Jameson Graef Rollins
  2012-01-23  8:34           ` [PATCH 5/6] emacs: use pop-at-end functionality in show-archive-message-then-next function Jameson Graef Rollins
@ 2012-01-23 11:02           ` David Edmondson
  2012-01-23 17:39             ` Jameson Graef Rollins
  1 sibling, 1 reply; 59+ messages in thread
From: David Edmondson @ 2012-01-23 11:02 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

On Mon, 23 Jan 2012 00:34:23 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> -(defun notmuch-show-next-open-message ()
> +(defun notmuch-show-next-open-message (&optional pop-at-end)
>    "Show the next message."
> -  (interactive)
> -  (let (r)
> +  (interactive "P")
> +  (let ((parent-buffer notmuch-show-parent-buffer)
> +	(r))

Extra brackets around 'r' are unnecessary. Otherwise, +1.

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

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

* Re: [PATCH 6/6] emacs: modify the default show-mode key bindings for archiving
  2012-01-23  8:34             ` [PATCH 6/6] emacs: modify the default show-mode key bindings for archiving Jameson Graef Rollins
@ 2012-01-23 11:14               ` David Edmondson
  2012-01-23 21:03               ` Xavier Maillard
  2012-01-24 18:50               ` Tomi Ollila
  2 siblings, 0 replies; 59+ messages in thread
From: David Edmondson @ 2012-01-23 11:14 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

+1.

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

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

* Re: [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end
  2012-01-23 11:02           ` [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end David Edmondson
@ 2012-01-23 17:39             ` Jameson Graef Rollins
  2012-01-23 17:55               ` David Edmondson
  0 siblings, 1 reply; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-23 17:39 UTC (permalink / raw)
  To: David Edmondson, Notmuch Mail

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

On Mon, 23 Jan 2012 11:02:04 +0000, David Edmondson <dme@dme.org> wrote:
> On Mon, 23 Jan 2012 00:34:23 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> > -(defun notmuch-show-next-open-message ()
> > +(defun notmuch-show-next-open-message (&optional pop-at-end)
> >    "Show the next message."
> > -  (interactive)
> > -  (let (r)
> > +  (interactive "P")
> > +  (let ((parent-buffer notmuch-show-parent-buffer)
> > +	(r))
> 
> Extra brackets around 'r' are unnecessary. Otherwise, +1.

This seems minor enough that I'm not going to resend, but noted for next
time.  Thanks.

jamie.

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

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

* Re: [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end
  2012-01-23 17:39             ` Jameson Graef Rollins
@ 2012-01-23 17:55               ` David Edmondson
  2012-01-23 18:51                 ` Jameson Graef Rollins
  0 siblings, 1 reply; 59+ messages in thread
From: David Edmondson @ 2012-01-23 17:55 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

On Mon, 23 Jan 2012 09:39:30 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> On Mon, 23 Jan 2012 11:02:04 +0000, David Edmondson <dme@dme.org> wrote:
> > On Mon, 23 Jan 2012 00:34:23 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> > > -(defun notmuch-show-next-open-message ()
> > > +(defun notmuch-show-next-open-message (&optional pop-at-end)
> > >    "Show the next message."
> > > -  (interactive)
> > > -  (let (r)
> > > +  (interactive "P")
> > > +  (let ((parent-buffer notmuch-show-parent-buffer)
> > > +	(r))
> > 
> > Extra brackets around 'r' are unnecessary. Otherwise, +1.
> 
> This seems minor enough that I'm not going to resend, but noted for next
> time.  Thanks.

On that basis, I hope no-one will complain if I fix them as a 'drive by'
during another change...

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

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

* Re: [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end
  2012-01-23 17:55               ` David Edmondson
@ 2012-01-23 18:51                 ` Jameson Graef Rollins
  0 siblings, 0 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-23 18:51 UTC (permalink / raw)
  To: David Edmondson, Notmuch Mail

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

On Mon, 23 Jan 2012 17:55:14 +0000, David Edmondson <dme@dme.org> wrote:
> On that basis, I hope no-one will complain if I fix them as a 'drive by'
> during another change...

Hrm.  I don't think that follows.  Unless the patch is already touching
that code, I would really prefer we continue to enforce that unrelated
changes go into separate patches.

There are plenty of other places in the code where we do use parens
around uninitialized variables.  If you really want to remove them I
would prefer to see a patch to fixes them all at once.  Doesn't seem
worth it to me, but everyone seems to be on an uncrustify kick recently,
so...

jamie.

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

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

* Re: [PATCH 6/6] emacs: modify the default show-mode key bindings for archiving
  2012-01-23  8:34             ` [PATCH 6/6] emacs: modify the default show-mode key bindings for archiving Jameson Graef Rollins
  2012-01-23 11:14               ` David Edmondson
@ 2012-01-23 21:03               ` Xavier Maillard
  2012-01-24 18:50               ` Tomi Ollila
  2 siblings, 0 replies; 59+ messages in thread
From: Xavier Maillard @ 2012-01-23 21:03 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

This is also +1 for me.

/Xavier

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

* Re: [PATCH 3/6] emacs: add message archiving functions
  2012-01-23  8:34       ` [PATCH 3/6] emacs: add message archiving functions Jameson Graef Rollins
  2012-01-23  8:34         ` [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end Jameson Graef Rollins
  2012-01-23 11:01         ` [PATCH 3/6] emacs: add message archiving functions David Edmondson
@ 2012-01-24 18:44         ` Tomi Ollila
  2 siblings, 0 replies; 59+ messages in thread
From: Tomi Ollila @ 2012-01-24 18:44 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

On Mon, 23 Jan 2012 00:34:22 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> This adds two new message archiving functions that parallel the thread
> archiving functions: notmuch-show-archive-message{,-then-next}.  The
> former also takes a prefix argument to unarchive the message (ie. put
> back in inbox).
> ---

LGTM, except...

> +(defun notmuch-show-archive-message-then-next ()
> +  "Archive the current message, then show next thread from search."
> +  (interactive)
> +  (notmuch-show-archive-message)
> +  (notmuch-show-next-open-message))
> +

It goes to next open message but docstring says show nexr thread from search.

Tomi

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

* Re: [PATCH 6/6] emacs: modify the default show-mode key bindings for archiving
  2012-01-23  8:34             ` [PATCH 6/6] emacs: modify the default show-mode key bindings for archiving Jameson Graef Rollins
  2012-01-23 11:14               ` David Edmondson
  2012-01-23 21:03               ` Xavier Maillard
@ 2012-01-24 18:50               ` Tomi Ollila
  2 siblings, 0 replies; 59+ messages in thread
From: Tomi Ollila @ 2012-01-24 18:50 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

On Mon, 23 Jan 2012 00:34:25 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> This changes the default key bindings for the 'a' key in notmuch-show
> mode.  Instead of archiving the entire thread, it now just archives
> the current message, and then advance to the next open message
> (archive-message-then-next).  'A' is now bound to the previous
> archive-thread-then-next function.
> ---

+1 for the whole thread. If that one docstring is wrong I'd rather see
this patchset first pushed and then just do one-line trivial patch to
fix that issue -- less work to everyone.

Tomi

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

* (no subject)
  2012-01-23  8:33 ` Jameson Graef Rollins
  2012-01-23  8:34   ` [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions Jameson Graef Rollins
@ 2012-01-25  0:06   ` Jameson Graef Rollins
  2012-01-25  0:06     ` [PATCH v3 1/8] emacs: use search-next-thread to move to next thread in show mode Jameson Graef Rollins
  2012-01-31  3:28     ` David Bremner
  1 sibling, 2 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-25  0:06 UTC (permalink / raw)
  To: Notmuch Mail

Final v3 rework of this patch series:

* reworked pop-at-end patch to be much simpler (which also happens to
  get around other issues with this patch that dme had)
* added pop-at-end function to both show-next-...message functions
* fixed call to search-next-thread in show-next-thread function
* added patch at beginning to fix search thread navigation in show
  mode
* add patch at end to fix doc string
* Fix doc string

jamie.

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

* [PATCH v3 1/8] emacs: use search-next-thread to move to next thread in show mode
  2012-01-25  0:06   ` Jameson Graef Rollins
@ 2012-01-25  0:06     ` Jameson Graef Rollins
  2012-01-25  0:06       ` [PATCH v3 2/8] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions Jameson Graef Rollins
  2012-01-25 10:53       ` [PATCH v3 1/8] emacs: use search-next-thread to move to next thread in show mode David Edmondson
  2012-01-31  3:28     ` David Bremner
  1 sibling, 2 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-25  0:06 UTC (permalink / raw)
  To: Notmuch Mail

We should always use the dedicated search mode navigation functions,
in case navigation mechanics change down the line.
---
 emacs/notmuch-show.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index e6a5b31..a0045fc 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -39,6 +39,7 @@
 (declare-function notmuch-call-notmuch-process "notmuch" (&rest args))
 (declare-function notmuch-fontify-headers "notmuch" nil)
 (declare-function notmuch-select-tag-with-completion "notmuch" (prompt &rest search-terms))
+(declare-function notmuch-search-next-thread "notmuch" nil)
 (declare-function notmuch-search-show-thread "notmuch" nil)
 
 (defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date")
@@ -1535,7 +1536,7 @@ argument, hide all of the messages."
     (if parent-buffer
 	(progn
 	  (switch-to-buffer parent-buffer)
-	  (forward-line)
+	  (notmuch-search-next-thread)
 	  (if show-next
 	      (notmuch-search-show-thread))))))
 
-- 
1.7.8.3

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

* [PATCH v3 2/8] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions
  2012-01-25  0:06     ` [PATCH v3 1/8] emacs: use search-next-thread to move to next thread in show mode Jameson Graef Rollins
@ 2012-01-25  0:06       ` Jameson Graef Rollins
  2012-01-25  0:06         ` [PATCH v3 3/8] emacs: break out thread navigation from notmuch-show-archive-thread Jameson Graef Rollins
  2012-01-25 10:47         ` [PATCH v3 2/8] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions David Edmondson
  2012-01-25 10:53       ` [PATCH v3 1/8] emacs: use search-next-thread to move to next thread in show mode David Edmondson
  1 sibling, 2 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-25  0:06 UTC (permalink / raw)
  To: Notmuch Mail

Brake up notmuch-show-archive-thread-internal into two new functions:

notmuch-show-tag-thread-internal: applies a tag to all messages in
thread.  If option remove flag is t, tags will be removed instead of
added.

notmuch-show-next-thread: moves to the next thread in the search
result.  If given a prefix, will show the next result, otherwise will
just move to it in the search view.

Two new interactive functions, notmuch-show-{add,remove}-tag-thread,
are also added.  Together, these provide a better suit of thread
tagging and navigation tools.

The higher level thread archiving functions are modified to use these
new function.
---
 emacs/notmuch-show.el |   46 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index a0045fc..fb908b0 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1525,20 +1525,38 @@ argument, hide all of the messages."
   (interactive)
   (backward-button 1))
 
-(defun notmuch-show-archive-thread-internal (show-next)
-  ;; Remove the tag from the current set of messages.
+(defun notmuch-show-tag-thread-internal (tag &optional remove)
+  "Add tag to the current set of messages.
+
+If the remove switch is given, tags will be removed instead of
+added."
   (goto-char (point-min))
-  (loop do (notmuch-show-remove-tag "inbox")
-	until (not (notmuch-show-goto-message-next)))
-  ;; Move to the next item in the search results, if any.
+  (let ((tag-function (if remove
+			  'notmuch-show-remove-tag
+			'notmuch-show-add-tag)))
+    (loop do (funcall tag-function tag)
+	  until (not (notmuch-show-goto-message-next)))))
+
+(defun notmuch-show-add-tag-thread (tag)
+  "Add tag to all messages in the current thread."
+  (interactive)
+  (notmuch-show-tag-thread-internal tag))
+
+(defun notmuch-show-remove-tag-thread (tag)
+  "Remove tag from all messages in the current thread."
+  (interactive)
+  (notmuch-show-tag-thread-internal tag t))
+
+(defun notmuch-show-next-thread (&optional show-next)
+  "Move to the next item in the search results, if any."
+  (interactive "P")
   (let ((parent-buffer notmuch-show-parent-buffer))
     (notmuch-kill-this-buffer)
-    (if parent-buffer
-	(progn
-	  (switch-to-buffer parent-buffer)
-	  (notmuch-search-next-thread)
-	  (if show-next
-	      (notmuch-search-show-thread))))))
+    (when parent-buffer
+      (switch-to-buffer parent-buffer)
+      (notmuch-search-next-thread)
+      (if show-next
+	  (notmuch-search-show-thread)))))
 
 (defun notmuch-show-archive-thread ()
   "Archive each message in thread, then show next thread from search.
@@ -1552,12 +1570,14 @@ being delivered to the same thread. It does not archive the
 entire thread, but only the messages shown in the current
 buffer."
   (interactive)
-  (notmuch-show-archive-thread-internal t))
+  (notmuch-show-remove-tag-thread "inbox")
+  (notmuch-show-next-thread t))
 
 (defun notmuch-show-archive-thread-then-exit ()
   "Archive each message in thread, then exit back to search results."
   (interactive)
-  (notmuch-show-archive-thread-internal nil))
+  (notmuch-show-remove-tag-thread "inbox")
+  (notmuch-show-next-thread))
 
 (defun notmuch-show-stash-cc ()
   "Copy CC field of current message to kill-ring."
-- 
1.7.8.3

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

* [PATCH v3 3/8] emacs: break out thread navigation from notmuch-show-archive-thread
  2012-01-25  0:06       ` [PATCH v3 2/8] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions Jameson Graef Rollins
@ 2012-01-25  0:06         ` Jameson Graef Rollins
  2012-01-25  0:06           ` [PATCH v3 4/8] emacs: add message archiving functions Jameson Graef Rollins
  2012-01-25 10:49           ` [PATCH v3 3/8] emacs: break out thread navigation from notmuch-show-archive-thread David Edmondson
  2012-01-25 10:47         ` [PATCH v3 2/8] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions David Edmondson
  1 sibling, 2 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-25  0:06 UTC (permalink / raw)
  To: Notmuch Mail

This function is now just for archiving the current thread.  A new
function is created to archive-then-next.  The 'a' key binding is
updated accordingly.

This will allow people to bind to the simple thread archiving function
without the extra navigation.  The archive-thread function now also
takes a prefix to unarchive the current thread (ie. put the whole
thread back in the inbox).
---
 emacs/notmuch-show.el |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index fb908b0..071e662 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1044,7 +1044,7 @@ thread id.  If a prefix is given, crypto processing is toggled."
 	(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-thread)
+	(define-key map "a" 'notmuch-show-archive-thread-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)
@@ -1304,7 +1304,7 @@ thread from the search from which this thread was originally
 shown."
   (interactive)
   (if (notmuch-show-advance)
-      (notmuch-show-archive-thread)))
+      (notmuch-show-archive-thread-then-next)))
 
 (defun notmuch-show-rewind ()
   "Backup through the thread, (reverse scrolling compared to \\[notmuch-show-advance-and-archive]).
@@ -1558,8 +1558,12 @@ added."
       (if show-next
 	  (notmuch-search-show-thread)))))
 
-(defun notmuch-show-archive-thread ()
-  "Archive each message in thread, then show next thread from search.
+(defun notmuch-show-archive-thread (&optional unarchive)
+  "Archive each message in thread.
+
+If a prefix argument is given, the messages will be
+\"unarchived\" (ie. the \"inbox\" tag will be added instead of
+removed).
 
 Archive each message currently shown by removing the \"inbox\"
 tag from each. Then kill this buffer and show the next thread
@@ -1569,14 +1573,21 @@ Note: This command is safe from any race condition of new messages
 being delivered to the same thread. It does not archive the
 entire thread, but only the messages shown in the current
 buffer."
+  (interactive "P")
+  (if unarchive
+      (notmuch-show-add-tag-thread "inbox")
+    (notmuch-show-remove-tag-thread "inbox")))
+
+(defun notmuch-show-archive-thread-then-next ()
+  "Archive each message in thread, then show next thread from search."
   (interactive)
-  (notmuch-show-remove-tag-thread "inbox")
+  (notmuch-show-archive-thread)
   (notmuch-show-next-thread t))
 
 (defun notmuch-show-archive-thread-then-exit ()
   "Archive each message in thread, then exit back to search results."
   (interactive)
-  (notmuch-show-remove-tag-thread "inbox")
+  (notmuch-show-archive-thread)
   (notmuch-show-next-thread))
 
 (defun notmuch-show-stash-cc ()
-- 
1.7.8.3

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

* [PATCH v3 4/8] emacs: add message archiving functions
  2012-01-25  0:06         ` [PATCH v3 3/8] emacs: break out thread navigation from notmuch-show-archive-thread Jameson Graef Rollins
@ 2012-01-25  0:06           ` Jameson Graef Rollins
  2012-01-25  0:06             ` [PATCH v3 5/8] emacs: add option to show-next-{, open-}message functions to pop out to parent buffer if at end Jameson Graef Rollins
  2012-01-25 10:50             ` [PATCH v3 4/8] emacs: add message archiving functions David Edmondson
  2012-01-25 10:49           ` [PATCH v3 3/8] emacs: break out thread navigation from notmuch-show-archive-thread David Edmondson
  1 sibling, 2 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-25  0:06 UTC (permalink / raw)
  To: Notmuch Mail

This adds two new message archiving functions that parallel the thread
archiving functions: notmuch-show-archive-message{,-then-next}.  The
former also takes a prefix argument to unarchive the message (ie. put
back in inbox).
---
 emacs/notmuch-show.el |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 071e662..0dc594b 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1590,6 +1590,23 @@ buffer."
   (notmuch-show-archive-thread)
   (notmuch-show-next-thread))
 
+(defun notmuch-show-archive-message (&optional unarchive)
+  "Archive the current message.
+
+If a prefix argument is given, the message will be
+\"unarchived\" (ie. the \"inbox\" tag will be added instead of
+removed)."
+  (interactive "P")
+  (if unarchive
+      (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."
+  (interactive)
+  (notmuch-show-archive-message)
+  (notmuch-show-next-open-message))
+
 (defun notmuch-show-stash-cc ()
   "Copy CC field of current message to kill-ring."
   (interactive)
-- 
1.7.8.3

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

* [PATCH v3 5/8] emacs: add option to show-next-{, open-}message functions to pop out to parent buffer if at end
  2012-01-25  0:06           ` [PATCH v3 4/8] emacs: add message archiving functions Jameson Graef Rollins
@ 2012-01-25  0:06             ` Jameson Graef Rollins
  2012-01-25  0:06               ` [PATCH v3 6/8] emacs: use pop-at-end functionality in show-archive-message-then-next function Jameson Graef Rollins
  2012-01-25 10:51               ` [PATCH v3 5/8] emacs: add option to show-next-{, open-}message functions to pop out to parent buffer if at end David Edmondson
  2012-01-25 10:50             ` [PATCH v3 4/8] emacs: add message archiving functions David Edmondson
  1 sibling, 2 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-25  0:06 UTC (permalink / raw)
  To: Notmuch Mail

This will allow for keybindings that achieve a smoother message
processing flow by reducing the number of key presses needed for most
common operations.
---
 emacs/notmuch-show.el |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 0dc594b..8837402 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1358,14 +1358,19 @@ any effects from previous calls to
   (with-current-notmuch-show-message
    (notmuch-mua-new-forward-message prompt-for-sender)))
 
-(defun notmuch-show-next-message ()
-  "Show the next message."
-  (interactive)
+(defun notmuch-show-next-message (&optional pop-at-end)
+  "Show the next message.
+
+If a prefix argument is given and this is the last message in the
+thread, navigate to the next thread in the parent search buffer."
+  (interactive "P")
   (if (notmuch-show-goto-message-next)
       (progn
 	(notmuch-show-mark-read)
 	(notmuch-show-message-adjust))
-    (goto-char (point-max))))
+    (if pop-at-end
+	(notmuch-show-next-thread)
+      (goto-char (point-max)))))
 
 (defun notmuch-show-previous-message ()
   "Show the previous message."
@@ -1374,9 +1379,13 @@ any effects from previous calls to
   (notmuch-show-mark-read)
   (notmuch-show-message-adjust))
 
-(defun notmuch-show-next-open-message ()
-  "Show the next message."
-  (interactive)
+(defun notmuch-show-next-open-message (&optional pop-at-end)
+  "Show the next 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
+buffer."
+  (interactive "P")
   (let (r)
     (while (and (setq r (notmuch-show-goto-message-next))
 		(not (notmuch-show-message-visible-p))))
@@ -1384,7 +1393,9 @@ any effects from previous calls to
 	(progn
 	  (notmuch-show-mark-read)
 	  (notmuch-show-message-adjust))
-      (goto-char (point-max)))))
+      (if pop-at-end
+	  (notmuch-show-next-thread)
+	(goto-char (point-max))))))
 
 (defun notmuch-show-previous-open-message ()
   "Show the previous message."
-- 
1.7.8.3

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

* [PATCH v3 6/8] emacs: use pop-at-end functionality in show-archive-message-then-next function
  2012-01-25  0:06             ` [PATCH v3 5/8] emacs: add option to show-next-{, open-}message functions to pop out to parent buffer if at end Jameson Graef Rollins
@ 2012-01-25  0:06               ` Jameson Graef Rollins
  2012-01-25  0:06                 ` [PATCH v3 7/8] emacs: modify the default show-mode key bindings for archiving Jameson Graef Rollins
  2012-01-25 10:52                 ` [PATCH v3 6/8] emacs: use pop-at-end functionality in show-archive-message-then-next function David Edmondson
  2012-01-25 10:51               ` [PATCH v3 5/8] emacs: add option to show-next-{, open-}message functions to pop out to parent buffer if at end David Edmondson
  1 sibling, 2 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-25  0:06 UTC (permalink / raw)
  To: Notmuch Mail

This provides a smoother message processing flow by reducing the
number of key presses needed for these common operations.
---
 emacs/notmuch-show.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 8837402..b309b5b 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1616,7 +1616,7 @@ removed)."
   "Archive the current message, then show the next open message in the current thread."
   (interactive)
   (notmuch-show-archive-message)
-  (notmuch-show-next-open-message))
+  (notmuch-show-next-open-message t))
 
 (defun notmuch-show-stash-cc ()
   "Copy CC field of current message to kill-ring."
-- 
1.7.8.3

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

* [PATCH v3 7/8] emacs: modify the default show-mode key bindings for archiving
  2012-01-25  0:06               ` [PATCH v3 6/8] emacs: use pop-at-end functionality in show-archive-message-then-next function Jameson Graef Rollins
@ 2012-01-25  0:06                 ` Jameson Graef Rollins
  2012-01-25  0:06                   ` [PATCH v3 8/8] emacs: fix show-previous-message doc string Jameson Graef Rollins
  2012-01-25 10:53                   ` [PATCH v3 7/8] emacs: modify the default show-mode key bindings for archiving David Edmondson
  2012-01-25 10:52                 ` [PATCH v3 6/8] emacs: use pop-at-end functionality in show-archive-message-then-next function David Edmondson
  1 sibling, 2 replies; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-25  0:06 UTC (permalink / raw)
  To: Notmuch Mail

This changes the default key bindings for the 'a' key in notmuch-show
mode.  Instead of archiving the entire thread, it now just archives
the current message, and then advance to the next open message
(archive-message-then-next).  'A' is now bound to the previous
archive-thread-then-next function.
---
 emacs/notmuch-show.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index b309b5b..4de552d 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1044,7 +1044,8 @@ thread id.  If a prefix is given, crypto processing is toggled."
 	(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-thread-then-next)
+	(define-key map "a" 'notmuch-show-archive-message-then-next)
+	(define-key map "A" 'notmuch-show-archive-thread-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)
-- 
1.7.8.3

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

* [PATCH v3 8/8] emacs: fix show-previous-message doc string
  2012-01-25  0:06                 ` [PATCH v3 7/8] emacs: modify the default show-mode key bindings for archiving Jameson Graef Rollins
@ 2012-01-25  0:06                   ` Jameson Graef Rollins
  2012-01-25 10:53                     ` David Edmondson
  2012-01-25 10:53                   ` [PATCH v3 7/8] emacs: modify the default show-mode key bindings for archiving David Edmondson
  1 sibling, 1 reply; 59+ messages in thread
From: Jameson Graef Rollins @ 2012-01-25  0:06 UTC (permalink / raw)
  To: Notmuch Mail

---
 emacs/notmuch-show.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 4de552d..a4f83ee 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1399,7 +1399,7 @@ buffer."
 	(goto-char (point-max))))))
 
 (defun notmuch-show-previous-open-message ()
-  "Show the previous message."
+  "Show the previous open message."
   (interactive)
   (while (and (notmuch-show-goto-message-previous)
 	      (not (notmuch-show-message-visible-p))))
-- 
1.7.8.3

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

* Re: [PATCH v3 2/8] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions
  2012-01-25  0:06       ` [PATCH v3 2/8] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions Jameson Graef Rollins
  2012-01-25  0:06         ` [PATCH v3 3/8] emacs: break out thread navigation from notmuch-show-archive-thread Jameson Graef Rollins
@ 2012-01-25 10:47         ` David Edmondson
  1 sibling, 0 replies; 59+ messages in thread
From: David Edmondson @ 2012-01-25 10:47 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

On Tue, 24 Jan 2012 16:06:17 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> notmuch-show-tag-thread-internal: applies a tag to all messages in
> thread.  If option remove flag is t, tags will be removed instead of
> added.

If it's non-nil, but yes.

> notmuch-show-next-thread: moves to the next thread in the search
> result.  If given a prefix, will show the next result, otherwise will
> just move to it in the search view.
> 
> Two new interactive functions, notmuch-show-{add,remove}-tag-thread,
> are also added.  Together, these provide a better suit of thread
> tagging and navigation tools.
> 
> The higher level thread archiving functions are modified to use these
> new function.
> ---
>  emacs/notmuch-show.el |   46 +++++++++++++++++++++++++++++++++-------------
>  1 files changed, 33 insertions(+), 13 deletions(-)
> 
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index a0045fc..fb908b0 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1525,20 +1525,38 @@ argument, hide all of the messages."
>    (interactive)
>    (backward-button 1))
>  
> -(defun notmuch-show-archive-thread-internal (show-next)
> -  ;; Remove the tag from the current set of messages.
> +(defun notmuch-show-tag-thread-internal (tag &optional remove)
> +  "Add tag to the current set of messages.

"Add TAG to all messages in the current buffer."

> +
> +If the remove switch is given, tags will be removed instead of
> +added."

"If the REMOVE argument is non-nil, ..."

>    (goto-char (point-min))
> -  (loop do (notmuch-show-remove-tag "inbox")
> -	until (not (notmuch-show-goto-message-next)))
> -  ;; Move to the next item in the search results, if any.
> +  (let ((tag-function (if remove
> +			  'notmuch-show-remove-tag
> +			'notmuch-show-add-tag)))
> +    (loop do (funcall tag-function tag)
> +	  until (not (notmuch-show-goto-message-next)))))

I wonder if we shouldn't have a macro for "do something to all messages
in the current buffer" that could be used more widely.

> +
> +(defun notmuch-show-add-tag-thread (tag)
> +  "Add tag to all messages in the current thread."
> +  (interactive)
> +  (notmuch-show-tag-thread-internal tag))
> +
> +(defun notmuch-show-remove-tag-thread (tag)
> +  "Remove tag from all messages in the current thread."
> +  (interactive)
> +  (notmuch-show-tag-thread-internal tag t))
> +
> +(defun notmuch-show-next-thread (&optional show-next)
> +  "Move to the next item in the search results, if any."

Describe the meaning of SHOW-NEXT.

> +  (interactive "P")
>    (let ((parent-buffer notmuch-show-parent-buffer))
>      (notmuch-kill-this-buffer)
> -    (if parent-buffer
> -	(progn
> -	  (switch-to-buffer parent-buffer)
> -	  (notmuch-search-next-thread)
> -	  (if show-next
> -	      (notmuch-search-show-thread))))))
> +    (when parent-buffer
> +      (switch-to-buffer parent-buffer)
> +      (notmuch-search-next-thread)
> +      (if show-next
> +	  (notmuch-search-show-thread)))))
>  
>  (defun notmuch-show-archive-thread ()
>    "Archive each message in thread, then show next thread from search.
> @@ -1552,12 +1570,14 @@ being delivered to the same thread. It does not archive the
>  entire thread, but only the messages shown in the current
>  buffer."
>    (interactive)
> -  (notmuch-show-archive-thread-internal t))
> +  (notmuch-show-remove-tag-thread "inbox")
> +  (notmuch-show-next-thread t))
>  
>  (defun notmuch-show-archive-thread-then-exit ()
>    "Archive each message in thread, then exit back to search results."
>    (interactive)
> -  (notmuch-show-archive-thread-internal nil))
> +  (notmuch-show-remove-tag-thread "inbox")
> +  (notmuch-show-next-thread))
>  
>  (defun notmuch-show-stash-cc ()
>    "Copy CC field of current message to kill-ring."
> -- 
> 1.7.8.3
> 
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

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

* Re: [PATCH v3 3/8] emacs: break out thread navigation from notmuch-show-archive-thread
  2012-01-25  0:06         ` [PATCH v3 3/8] emacs: break out thread navigation from notmuch-show-archive-thread Jameson Graef Rollins
  2012-01-25  0:06           ` [PATCH v3 4/8] emacs: add message archiving functions Jameson Graef Rollins
@ 2012-01-25 10:49           ` David Edmondson
  1 sibling, 0 replies; 59+ messages in thread
From: David Edmondson @ 2012-01-25 10:49 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

On Tue, 24 Jan 2012 16:06:18 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> This function is now just for archiving the current thread.  A new
> function is created to archive-then-next.  The 'a' key binding is
> updated accordingly.
> 
> This will allow people to bind to the simple thread archiving function
> without the extra navigation.  The archive-thread function now also
> takes a prefix to unarchive the current thread (ie. put the whole
> thread back in the inbox).
> ---
>  emacs/notmuch-show.el |   23 +++++++++++++++++------
>  1 files changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index fb908b0..071e662 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1044,7 +1044,7 @@ thread id.  If a prefix is given, crypto processing is toggled."
>  	(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-thread)
> +	(define-key map "a" 'notmuch-show-archive-thread-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)
> @@ -1304,7 +1304,7 @@ thread from the search from which this thread was originally
>  shown."
>    (interactive)
>    (if (notmuch-show-advance)
> -      (notmuch-show-archive-thread)))
> +      (notmuch-show-archive-thread-then-next)))
>  
>  (defun notmuch-show-rewind ()
>    "Backup through the thread, (reverse scrolling compared to \\[notmuch-show-advance-and-archive]).
> @@ -1558,8 +1558,12 @@ added."
>        (if show-next
>  	  (notmuch-search-show-thread)))))
>  
> -(defun notmuch-show-archive-thread ()
> -  "Archive each message in thread, then show next thread from search.
> +(defun notmuch-show-archive-thread (&optional unarchive)
> +  "Archive each message in thread.
> +
> +If a prefix argument is given, the messages will be
> +\"unarchived\" (ie. the \"inbox\" tag will be added instead of
> +removed).

It's clearer to reference "inbox" directly:

     Remove the "inbox" tag from the messages currently shown.

     If a prefix argument is given the "inbox" tag will be added rather
     than removed.

>  
>  Archive each message currently shown by removing the \"inbox\"
>  tag from each. Then kill this buffer and show the next thread
> @@ -1569,14 +1573,21 @@ Note: This command is safe from any race condition of new messages
>  being delivered to the same thread. It does not archive the
>  entire thread, but only the messages shown in the current
>  buffer."
> +  (interactive "P")
> +  (if unarchive
> +      (notmuch-show-add-tag-thread "inbox")
> +    (notmuch-show-remove-tag-thread "inbox")))
> +
> +(defun notmuch-show-archive-thread-then-next ()
> +  "Archive each message in thread, then show next thread from search."
>    (interactive)
> -  (notmuch-show-remove-tag-thread "inbox")
> +  (notmuch-show-archive-thread)
>    (notmuch-show-next-thread t))
>  
>  (defun notmuch-show-archive-thread-then-exit ()
>    "Archive each message in thread, then exit back to search results."
>    (interactive)
> -  (notmuch-show-remove-tag-thread "inbox")
> +  (notmuch-show-archive-thread)
>    (notmuch-show-next-thread))
>  
>  (defun notmuch-show-stash-cc ()
> -- 
> 1.7.8.3
> 
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

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

* Re: [PATCH v3 4/8] emacs: add message archiving functions
  2012-01-25  0:06           ` [PATCH v3 4/8] emacs: add message archiving functions Jameson Graef Rollins
  2012-01-25  0:06             ` [PATCH v3 5/8] emacs: add option to show-next-{, open-}message functions to pop out to parent buffer if at end Jameson Graef Rollins
@ 2012-01-25 10:50             ` David Edmondson
  1 sibling, 0 replies; 59+ messages in thread
From: David Edmondson @ 2012-01-25 10:50 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

On Tue, 24 Jan 2012 16:06:19 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> This adds two new message archiving functions that parallel the thread
> archiving functions: notmuch-show-archive-message{,-then-next}.  The
> former also takes a prefix argument to unarchive the message (ie. put
> back in inbox).
> ---
>  emacs/notmuch-show.el |   17 +++++++++++++++++
>  1 files changed, 17 insertions(+), 0 deletions(-)
> 
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 071e662..0dc594b 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1590,6 +1590,23 @@ buffer."
>    (notmuch-show-archive-thread)
>    (notmuch-show-next-thread))
>  
> +(defun notmuch-show-archive-message (&optional unarchive)
> +  "Archive the current message.
> +
> +If a prefix argument is given, the message will be
> +\"unarchived\" (ie. the \"inbox\" tag will be added instead of
> +removed)."

Same comments as for the previous patch - just reference "inbox"
directly.

> +  (interactive "P")
> +  (if unarchive
> +      (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."
> +  (interactive)
> +  (notmuch-show-archive-message)
> +  (notmuch-show-next-open-message))
> +
>  (defun notmuch-show-stash-cc ()
>    "Copy CC field of current message to kill-ring."
>    (interactive)
> -- 
> 1.7.8.3
> 
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

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

* Re: [PATCH v3 5/8] emacs: add option to show-next-{, open-}message functions to pop out to parent buffer if at end
  2012-01-25  0:06             ` [PATCH v3 5/8] emacs: add option to show-next-{, open-}message functions to pop out to parent buffer if at end Jameson Graef Rollins
  2012-01-25  0:06               ` [PATCH v3 6/8] emacs: use pop-at-end functionality in show-archive-message-then-next function Jameson Graef Rollins
@ 2012-01-25 10:51               ` David Edmondson
  1 sibling, 0 replies; 59+ messages in thread
From: David Edmondson @ 2012-01-25 10:51 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

Fine.

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

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

* Re: [PATCH v3 6/8] emacs: use pop-at-end functionality in show-archive-message-then-next function
  2012-01-25  0:06               ` [PATCH v3 6/8] emacs: use pop-at-end functionality in show-archive-message-then-next function Jameson Graef Rollins
  2012-01-25  0:06                 ` [PATCH v3 7/8] emacs: modify the default show-mode key bindings for archiving Jameson Graef Rollins
@ 2012-01-25 10:52                 ` David Edmondson
  1 sibling, 0 replies; 59+ messages in thread
From: David Edmondson @ 2012-01-25 10:52 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

Fine.

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

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

* Re: [PATCH v3 7/8] emacs: modify the default show-mode key bindings for archiving
  2012-01-25  0:06                 ` [PATCH v3 7/8] emacs: modify the default show-mode key bindings for archiving Jameson Graef Rollins
  2012-01-25  0:06                   ` [PATCH v3 8/8] emacs: fix show-previous-message doc string Jameson Graef Rollins
@ 2012-01-25 10:53                   ` David Edmondson
  1 sibling, 0 replies; 59+ messages in thread
From: David Edmondson @ 2012-01-25 10:53 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

Fine.

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

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

* Re: [PATCH v3 8/8] emacs: fix show-previous-message doc string
  2012-01-25  0:06                   ` [PATCH v3 8/8] emacs: fix show-previous-message doc string Jameson Graef Rollins
@ 2012-01-25 10:53                     ` David Edmondson
  0 siblings, 0 replies; 59+ messages in thread
From: David Edmondson @ 2012-01-25 10:53 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

Fine.

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

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

* Re: [PATCH v3 1/8] emacs: use search-next-thread to move to next thread in show mode
  2012-01-25  0:06     ` [PATCH v3 1/8] emacs: use search-next-thread to move to next thread in show mode Jameson Graef Rollins
  2012-01-25  0:06       ` [PATCH v3 2/8] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions Jameson Graef Rollins
@ 2012-01-25 10:53       ` David Edmondson
  1 sibling, 0 replies; 59+ messages in thread
From: David Edmondson @ 2012-01-25 10:53 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

Fine.

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

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

* Re:
  2012-01-25  0:06   ` Jameson Graef Rollins
  2012-01-25  0:06     ` [PATCH v3 1/8] emacs: use search-next-thread to move to next thread in show mode Jameson Graef Rollins
@ 2012-01-31  3:28     ` David Bremner
  1 sibling, 0 replies; 59+ messages in thread
From: David Bremner @ 2012-01-31  3:28 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

On Tue, 24 Jan 2012 16:06:15 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> Final v3 rework of this patch series:
> 

pushed.

d

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

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

Thread overview: 59+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-17 18:05 show-mode message/thread archiving improvements Jameson Graef Rollins
2012-01-17 18:05 ` [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two generally useful functions Jameson Graef Rollins
2012-01-17 18:05   ` [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread Jameson Graef Rollins
2012-01-17 18:05     ` [PATCH 3/6] emacs: add message archiving functions Jameson Graef Rollins
2012-01-17 18:05       ` [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end Jameson Graef Rollins
2012-01-17 18:05         ` [PATCH 5/6] emacs: use pop-at-end functionality in show-archive-message-then-next function Jameson Graef Rollins
2012-01-17 18:05           ` [PATCH 6/6] emacs: modify the default show-mode key bindings for archiving Jameson Graef Rollins
2012-01-18  8:13             ` David Edmondson
2012-01-18  8:12         ` [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end David Edmondson
2012-01-18  8:47           ` Jameson Graef Rollins
2012-01-18  8:56             ` David Edmondson
2012-01-18 18:53               ` Jameson Graef Rollins
2012-01-17 18:43       ` [PATCH] emacs: fix archive thread/message function documentation Jameson Graef Rollins
2012-01-17 20:13       ` [PATCH 3/6] emacs: add message archiving functions Aaron Ecay
2012-01-17 20:18         ` Jameson Graef Rollins
2012-01-18  8:09       ` David Edmondson
2012-01-18  8:08     ` [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread David Edmondson
2012-01-17 20:10   ` [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two generally useful functions Aaron Ecay
2012-01-17 20:17     ` Jameson Graef Rollins
2012-01-17 20:57       ` Aaron Ecay
2012-01-18  8:14       ` David Edmondson
2012-01-18  8:06   ` David Edmondson
2012-01-17 20:09 ` show-mode message/thread archiving improvements Aaron Ecay
2012-01-23  8:33 ` Jameson Graef Rollins
2012-01-23  8:34   ` [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions Jameson Graef Rollins
2012-01-23  8:34     ` [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread Jameson Graef Rollins
2012-01-23  8:34       ` [PATCH 3/6] emacs: add message archiving functions Jameson Graef Rollins
2012-01-23  8:34         ` [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end Jameson Graef Rollins
2012-01-23  8:34           ` [PATCH 5/6] emacs: use pop-at-end functionality in show-archive-message-then-next function Jameson Graef Rollins
2012-01-23  8:34             ` [PATCH 6/6] emacs: modify the default show-mode key bindings for archiving Jameson Graef Rollins
2012-01-23 11:14               ` David Edmondson
2012-01-23 21:03               ` Xavier Maillard
2012-01-24 18:50               ` Tomi Ollila
2012-01-23 11:02           ` [PATCH 4/6] emacs: add option to notmuch-show-next-open-message to pop out to parent buffer if at end David Edmondson
2012-01-23 17:39             ` Jameson Graef Rollins
2012-01-23 17:55               ` David Edmondson
2012-01-23 18:51                 ` Jameson Graef Rollins
2012-01-23 11:01         ` [PATCH 3/6] emacs: add message archiving functions David Edmondson
2012-01-24 18:44         ` Tomi Ollila
2012-01-23 11:01       ` [PATCH 2/6] emacs: break out thread navigation from notmuch-show-archive-thread David Edmondson
2012-01-23 11:00     ` [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions David Edmondson
2012-01-25  0:06   ` Jameson Graef Rollins
2012-01-25  0:06     ` [PATCH v3 1/8] emacs: use search-next-thread to move to next thread in show mode Jameson Graef Rollins
2012-01-25  0:06       ` [PATCH v3 2/8] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions Jameson Graef Rollins
2012-01-25  0:06         ` [PATCH v3 3/8] emacs: break out thread navigation from notmuch-show-archive-thread Jameson Graef Rollins
2012-01-25  0:06           ` [PATCH v3 4/8] emacs: add message archiving functions Jameson Graef Rollins
2012-01-25  0:06             ` [PATCH v3 5/8] emacs: add option to show-next-{, open-}message functions to pop out to parent buffer if at end Jameson Graef Rollins
2012-01-25  0:06               ` [PATCH v3 6/8] emacs: use pop-at-end functionality in show-archive-message-then-next function Jameson Graef Rollins
2012-01-25  0:06                 ` [PATCH v3 7/8] emacs: modify the default show-mode key bindings for archiving Jameson Graef Rollins
2012-01-25  0:06                   ` [PATCH v3 8/8] emacs: fix show-previous-message doc string Jameson Graef Rollins
2012-01-25 10:53                     ` David Edmondson
2012-01-25 10:53                   ` [PATCH v3 7/8] emacs: modify the default show-mode key bindings for archiving David Edmondson
2012-01-25 10:52                 ` [PATCH v3 6/8] emacs: use pop-at-end functionality in show-archive-message-then-next function David Edmondson
2012-01-25 10:51               ` [PATCH v3 5/8] emacs: add option to show-next-{, open-}message functions to pop out to parent buffer if at end David Edmondson
2012-01-25 10:50             ` [PATCH v3 4/8] emacs: add message archiving functions David Edmondson
2012-01-25 10:49           ` [PATCH v3 3/8] emacs: break out thread navigation from notmuch-show-archive-thread David Edmondson
2012-01-25 10:47         ` [PATCH v3 2/8] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions David Edmondson
2012-01-25 10:53       ` [PATCH v3 1/8] emacs: use search-next-thread to move to next thread in show mode David Edmondson
2012-01-31  3:28     ` David Bremner

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