[PATCH v3 0/7] Port notmuch-show's x/X bindings to notmuch-tree

classic Classic list List threaded Threaded
20 messages Options
William Casarin William Casarin
Reply | Threaded
Open this post in threaded view
|

[PATCH v3 0/7] Port notmuch-show's x/X bindings to notmuch-tree

These patches bring notmuch-tree more in line with the user experience
of notmuch-show by adding the x/X bindings.

v3:
  - Removed dubious setq assignments in notmuch-tree-next-thread
    notmuch-tree-goto-matching-message as suggested in id:[hidden email]

  - Implement "A function scope variable to store the direction would
    save testing `prev' every time around the loop." as suggested in
    id:[hidden email]

  - Will address id:[hidden email] in future work as it's a bit
    out of scope for this patch set

  - Dropped id:[hidden email] since it has already
    been upstreamed

v2: id:[hidden email]
  - fix a bug when moving between open messages
  - include M-RET keybinding patch from id:[hidden email]

v1: id:[hidden email]


William Casarin (7):
  emacs/tree: return true if a thread was found in next-thread
  emacs/tree: add notmuch-tree-goto-matching-message
  emacs/tree: add notmuch-tree-matching-message
  emacs/tree: add kill-both prefix argument to notmuch-tree-quit
  emacs/tree: add notmuch-tree-archive-message-than-next-or-exit
  emacs/tree: add notmuch-tree-archive-thread-then-exit
  emacs/tree: add x/X bindings

 emacs/notmuch-tree.el | 70 +++++++++++++++++++++++++++++++------------
 1 file changed, 51 insertions(+), 19 deletions(-)

base-commit: 757ed001aad27d3c5ee8828174778b71013e4afd

Range-diff:
 8:  ac0f03a2 =  9:  5f9ea4d2 emacs: bind M-RET to notmuch-tree-from-search-thread
 1:  16972fa8 ! 36:  6ec4e58f emacs/tree: return true if a thread was found in next-thread
      (defun notmuch-tree-next-thread ()
     +  "Get the next thread in the current tree. Returns t if a thread was
     +found or nil if not."
        (interactive)
        (forward-line 1)
    --  (while (not (or (notmuch-tree-get-prop :first) (eobp)))
    +   (while (not (or (notmuch-tree-get-prop :first) (eobp)))
     -    (forward-line 1)))
    -+  (let (end)
    -+    (while (not (or (notmuch-tree-get-prop :first) (setq end (eobp))))
    -+      (forward-line 1))
    -+    (not end)))
    ++    (forward-line 1))
    ++  (not (eobp)))
     
      (defun notmuch-tree-thread-mapcar (function)
        "Iterate through all messages in the current thread
 2:  54e166a9 ! 37:  3db9faf8 emacs/tree: add notmuch-tree-goto-matching-message
     +(defun notmuch-tree-goto-matching-message (&optional prev)
     +  "Move to the next or previous matching message.
     +
     +Returns t if there was a next matching message in the thread to show,
     +nil otherwise."
    -+  (let (last)
    -+    (while (and (not (setq last (if prev (bobp) (eobp))))
    -+                (not (notmuch-tree-get-match)))
    -+      (forward-line (if prev -1 nil)))
    -+    (not last)))
    ++  (let ((dir (if prev -1 nil))
    ++ (eobfn (if prev #'bobp #'eobp)))
    ++    (while (and (not (funcall eobfn))
    ++ (not (notmuch-tree-get-match)))
    ++      (forward-line dir))
    ++    (not (funcall eobfn))))
 3:  d68d2050 ! 38:  e42d6032 emacs/tree: add notmuch-tree-matching-message
 4:  8432bc9a = 39:  caca76d3 emacs/tree: add kill-both prefix argument to notmuch-tree-quit
 5:  0c3f996d ! 40:  02b84adb emacs/tree: add notmuch-tree-archive-message-than-next-or-exit
 6:  17545910 = 41:  b432dd49 emacs/tree: add notmuch-tree-archive-thread-then-exit
 7:  fbcb3ee0 = 42:  48ea3edb emacs/tree: add x/X bindings
--
2.24.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
William Casarin William Casarin
Reply | Threaded
Open this post in threaded view
|

[PATCH v3 1/7] emacs/tree: return true if a thread was found in next-thread

This will allow us to pop back to parent buffers when there are no
more threads to jump to.

Signed-off-by: William Casarin <[hidden email]>
---
 emacs/notmuch-tree.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index c00315e8..d262ba26 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -620,10 +620,13 @@ message will be \"unarchived\", i.e. the tag changes in
   (notmuch-tree-thread-top))
 
 (defun notmuch-tree-next-thread ()
+  "Get the next thread in the current tree. Returns t if a thread was
+found or nil if not."
   (interactive)
   (forward-line 1)
   (while (not (or (notmuch-tree-get-prop :first) (eobp)))
-    (forward-line 1)))
+    (forward-line 1))
+  (not (eobp)))
 
 (defun notmuch-tree-thread-mapcar (function)
   "Iterate through all messages in the current thread
--
2.24.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
William Casarin William Casarin
Reply | Threaded
Open this post in threaded view
|

[PATCH v3 2/7] emacs/tree: add notmuch-tree-goto-matching-message

In reply to this post by William Casarin
This function captures some common logic when jumping to matching
messages in notmuch-tree mode.

We also add a new return value (t or nil), that indicates if there was
a next matching message in the thread to show.

Signed-off-by: William Casarin <[hidden email]>
---
 emacs/notmuch-tree.el | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index d262ba26..18fdb1c0 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -577,12 +577,23 @@ message will be \"unarchived\", i.e. the tag changes in
   (when (window-live-p notmuch-tree-message-window)
     (notmuch-tree-show-message-in)))
 
+(defun notmuch-tree-goto-matching-message (&optional prev)
+  "Move to the next or previous matching message.
+
+Returns t if there was a next matching message in the thread to show,
+nil otherwise."
+  (let ((dir (if prev -1 nil))
+ (eobfn (if prev #'bobp #'eobp)))
+    (while (and (not (funcall eobfn))
+ (not (notmuch-tree-get-match)))
+      (forward-line dir))
+    (not (funcall eobfn))))
+
 (defun notmuch-tree-prev-matching-message ()
   "Move to previous matching message."
   (interactive)
   (forward-line -1)
-  (while (and (not (bobp)) (not (notmuch-tree-get-match)))
-    (forward-line -1))
+  (notmuch-tree-goto-matching-message t)
   (when (window-live-p notmuch-tree-message-window)
     (notmuch-tree-show-message-in)))
 
@@ -590,8 +601,7 @@ message will be \"unarchived\", i.e. the tag changes in
   "Move to next matching message."
   (interactive)
   (forward-line)
-  (while (and (not (eobp)) (not (notmuch-tree-get-match)))
-    (forward-line))
+  (notmuch-tree-goto-matching-message)
   (when (window-live-p notmuch-tree-message-window)
     (notmuch-tree-show-message-in)))
 
--
2.24.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
William Casarin William Casarin
Reply | Threaded
Open this post in threaded view
|

[PATCH v3 3/7] emacs/tree: add notmuch-tree-matching-message

In reply to this post by William Casarin
This functions removes some duplicate logic between
notmuch-tree-{next,prev}-matching-message

We do this because we will be adding some additional logic similar to
the notmuch-show-next-open-message function, and it will help if this
logic is all in one place.

Signed-off-by: William Casarin <[hidden email]>
---
 emacs/notmuch-tree.el | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 18fdb1c0..25d84f45 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -589,21 +589,23 @@ nil otherwise."
       (forward-line dir))
     (not (funcall eobfn))))
 
+(defun notmuch-tree-matching-message (&optional prev)
+  "Move to the next or previous matching message"
+  (interactive "P")
+  (forward-line (if prev -1 nil))
+  (notmuch-tree-goto-matching-message prev)
+  (when (window-live-p notmuch-tree-message-window)
+    (notmuch-tree-show-message-in)))
+
 (defun notmuch-tree-prev-matching-message ()
   "Move to previous matching message."
   (interactive)
-  (forward-line -1)
-  (notmuch-tree-goto-matching-message t)
-  (when (window-live-p notmuch-tree-message-window)
-    (notmuch-tree-show-message-in)))
+  (notmuch-tree-matching-message t))
 
 (defun notmuch-tree-next-matching-message ()
   "Move to next matching message."
   (interactive)
-  (forward-line)
-  (notmuch-tree-goto-matching-message)
-  (when (window-live-p notmuch-tree-message-window)
-    (notmuch-tree-show-message-in)))
+  (notmuch-tree-matching-message))
 
 (defun notmuch-tree-refresh-view ()
   "Refresh view."
--
2.24.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
William Casarin William Casarin
Reply | Threaded
Open this post in threaded view
|

[PATCH v3 4/7] emacs/tree: add kill-both prefix argument to notmuch-tree-quit

In reply to this post by William Casarin
This allows us to close both windows at the same time.

Signed-off-by: William Casarin <[hidden email]>
---
 emacs/notmuch-tree.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 25d84f45..f66219c5 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -530,10 +530,10 @@ Shows in split pane or whole window according to value of
   (when (notmuch-tree-scroll-message-window)
     (notmuch-tree-next-matching-message)))
 
-(defun notmuch-tree-quit ()
+(defun notmuch-tree-quit (&optional kill-both)
   "Close the split view or exit tree."
-  (interactive)
-  (unless (notmuch-tree-close-message-window)
+  (interactive "P")
+  (when (or (not (notmuch-tree-close-message-window)) kill-both)
     (kill-buffer (current-buffer))))
 
 (defun notmuch-tree-close-message-window ()
--
2.24.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
William Casarin William Casarin
Reply | Threaded
Open this post in threaded view
|

[PATCH v3 5/7] emacs/tree: add notmuch-tree-archive-message-than-next-or-exit

In reply to this post by William Casarin
This is the notmuch-tree version of
notmuch-show-archive-message-than-next-or-exit.

Signed-off-by: William Casarin <[hidden email]>
---
 emacs/notmuch-tree.el | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index f66219c5..cdf68ed4 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -563,6 +563,15 @@ message will be \"unarchived\", i.e. the tag changes in
   (notmuch-tree-archive-message unarchive)
   (notmuch-tree-next-matching-message))
 
+(defun notmuch-tree-archive-message-then-next-or-exit ()
+  "Archive current message, then show next open message in current thread.
+
+If at the last open message in the current thread, then exit back
+to search results."
+  (interactive)
+  (notmuch-tree-archive-message)
+  (notmuch-tree-next-matching-message t))
+
 (defun notmuch-tree-next-message ()
   "Move to next message."
   (interactive)
@@ -589,23 +598,24 @@ nil otherwise."
       (forward-line dir))
     (not (funcall eobfn))))
 
-(defun notmuch-tree-matching-message (&optional prev)
+(defun notmuch-tree-matching-message (&optional prev pop-at-end)
   "Move to the next or previous matching message"
   (interactive "P")
   (forward-line (if prev -1 nil))
-  (notmuch-tree-goto-matching-message prev)
-  (when (window-live-p notmuch-tree-message-window)
-    (notmuch-tree-show-message-in)))
+  (if (and (not (notmuch-tree-goto-matching-message prev)) pop-at-end)
+      (notmuch-tree-quit pop-at-end)
+    (when (window-live-p notmuch-tree-message-window)
+      (notmuch-tree-show-message-in))))
 
-(defun notmuch-tree-prev-matching-message ()
+(defun notmuch-tree-prev-matching-message (&optional pop-at-end)
   "Move to previous matching message."
-  (interactive)
-  (notmuch-tree-matching-message t))
+  (interactive "P")
+  (notmuch-tree-matching-message t pop-at-end))
 
-(defun notmuch-tree-next-matching-message ()
+(defun notmuch-tree-next-matching-message (&optional pop-at-end)
   "Move to next matching message."
-  (interactive)
-  (notmuch-tree-matching-message))
+  (interactive "P")
+  (notmuch-tree-matching-message nil pop-at-end))
 
 (defun notmuch-tree-refresh-view ()
   "Refresh view."
--
2.24.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
William Casarin William Casarin
Reply | Threaded
Open this post in threaded view
|

[PATCH v3 6/7] emacs/tree: add notmuch-tree-archive-thread-then-exit

In reply to this post by William Casarin
This is the notmuch-tree version of
notmuch-show-archive-thread-then-exit

Signed-off-by: William Casarin <[hidden email]>
---
 emacs/notmuch-tree.el | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index cdf68ed4..e9c0433c 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -563,6 +563,12 @@ message will be \"unarchived\", i.e. the tag changes in
   (notmuch-tree-archive-message unarchive)
   (notmuch-tree-next-matching-message))
 
+(defun notmuch-tree-archive-thread-then-exit ()
+  "Archive all messages in the current buffer, then exit notmuch-tree."
+  (interactive)
+  (notmuch-tree-archive-thread)
+  (notmuch-tree-quit t))
+
 (defun notmuch-tree-archive-message-then-next-or-exit ()
   "Archive current message, then show next open message in current thread.
 
--
2.24.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
William Casarin William Casarin
Reply | Threaded
Open this post in threaded view
|

[PATCH v3 7/7] emacs/tree: add x/X bindings

In reply to this post by William Casarin
Add x and X binds to notmuch-tree for functionally that we have in
notmuch-show.

The notmuch-tree-quit binding is somewhat redundant, since it is
handled by notmuch-bury-or-kill-this-buffer which is bound to q.

Signed-off-by: William Casarin <[hidden email]>
---
 emacs/notmuch-tree.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index e9c0433c..987cc81e 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -277,7 +277,8 @@ FUNC."
     ;; The main tree view bindings
     (define-key map (kbd "RET") 'notmuch-tree-show-message)
     (define-key map [mouse-1] 'notmuch-tree-show-message)
-    (define-key map "x" 'notmuch-tree-quit)
+    (define-key map "x" 'notmuch-tree-archive-message-then-next-or-exit)
+    (define-key map "X" 'notmuch-tree-archive-thread-then-exit)
     (define-key map "A" 'notmuch-tree-archive-thread)
     (define-key map "a" 'notmuch-tree-archive-message-then-next)
     (define-key map "z" 'notmuch-tree-to-tree)
--
2.24.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Edmondson David Edmondson
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v3 1/7] emacs/tree: return true if a thread was found in next-thread

In reply to this post by William Casarin
On Saturday, 2019-12-28 at 10:01:18 -05, William Casarin wrote:

> This will allow us to pop back to parent buffers when there are no
> more threads to jump to.
>
> Signed-off-by: William Casarin <[hidden email]>

Reviewed-by: David Edmondson <[hidden email]>

> ---
>  emacs/notmuch-tree.el | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
> index c00315e8..d262ba26 100644
> --- a/emacs/notmuch-tree.el
> +++ b/emacs/notmuch-tree.el
> @@ -620,10 +620,13 @@ message will be \"unarchived\", i.e. the tag changes in
>    (notmuch-tree-thread-top))
>  
>  (defun notmuch-tree-next-thread ()
> +  "Get the next thread in the current tree. Returns t if a thread was
> +found or nil if not."
>    (interactive)
>    (forward-line 1)
>    (while (not (or (notmuch-tree-get-prop :first) (eobp)))
> -    (forward-line 1)))
> +    (forward-line 1))
> +  (not (eobp)))
>  
>  (defun notmuch-tree-thread-mapcar (function)
>    "Iterate through all messages in the current thread
> --
> 2.24.0

dme.
--
Why stay in college? Why go to night school?
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Edmondson David Edmondson
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v3 2/7] emacs/tree: add notmuch-tree-goto-matching-message

In reply to this post by William Casarin
On Saturday, 2019-12-28 at 10:01:19 -05, William Casarin wrote:

> This function captures some common logic when jumping to matching
> messages in notmuch-tree mode.
>
> We also add a new return value (t or nil), that indicates if there was
> a next matching message in the thread to show.
>
> Signed-off-by: William Casarin <[hidden email]>

Reviewed-by: David Edmondson <[hidden email]>

> ---
>  emacs/notmuch-tree.el | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
> index d262ba26..18fdb1c0 100644
> --- a/emacs/notmuch-tree.el
> +++ b/emacs/notmuch-tree.el
> @@ -577,12 +577,23 @@ message will be \"unarchived\", i.e. the tag changes in
>    (when (window-live-p notmuch-tree-message-window)
>      (notmuch-tree-show-message-in)))
>  
> +(defun notmuch-tree-goto-matching-message (&optional prev)
> +  "Move to the next or previous matching message.
> +
> +Returns t if there was a next matching message in the thread to show,
> +nil otherwise."
> +  (let ((dir (if prev -1 nil))

You don't need this final `nil', but it's a real nit ;-)

> + (eobfn (if prev #'bobp #'eobp)))
> +    (while (and (not (funcall eobfn))
> + (not (notmuch-tree-get-match)))
> +      (forward-line dir))
> +    (not (funcall eobfn))))
> +
>  (defun notmuch-tree-prev-matching-message ()
>    "Move to previous matching message."
>    (interactive)
>    (forward-line -1)
> -  (while (and (not (bobp)) (not (notmuch-tree-get-match)))
> -    (forward-line -1))
> +  (notmuch-tree-goto-matching-message t)
>    (when (window-live-p notmuch-tree-message-window)
>      (notmuch-tree-show-message-in)))
>  
> @@ -590,8 +601,7 @@ message will be \"unarchived\", i.e. the tag changes in
>    "Move to next matching message."
>    (interactive)
>    (forward-line)
> -  (while (and (not (eobp)) (not (notmuch-tree-get-match)))
> -    (forward-line))
> +  (notmuch-tree-goto-matching-message)
>    (when (window-live-p notmuch-tree-message-window)
>      (notmuch-tree-show-message-in)))
>  
> --
> 2.24.0

dme.
--
You bring light in.
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Edmondson David Edmondson
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v3 3/7] emacs/tree: add notmuch-tree-matching-message

In reply to this post by William Casarin
On Saturday, 2019-12-28 at 10:01:20 -05, William Casarin wrote:

> This functions removes some duplicate logic between
> notmuch-tree-{next,prev}-matching-message
>
> We do this because we will be adding some additional logic similar to
> the notmuch-show-next-open-message function, and it will help if this
> logic is all in one place.
>
> Signed-off-by: William Casarin <[hidden email]>
> ---
>  emacs/notmuch-tree.el | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
> index 18fdb1c0..25d84f45 100644
> --- a/emacs/notmuch-tree.el
> +++ b/emacs/notmuch-tree.el
> @@ -589,21 +589,23 @@ nil otherwise."
>        (forward-line dir))
>      (not (funcall eobfn))))
>  
> +(defun notmuch-tree-matching-message (&optional prev)
> +  "Move to the next or previous matching message"
> +  (interactive "P")
> +  (forward-line (if prev -1 nil))
> +  (notmuch-tree-goto-matching-message prev)
> +  (when (window-live-p notmuch-tree-message-window)
> +    (notmuch-tree-show-message-in)))
> +

The naming is getting a bit contorted here.

How about renaming the existing `notmuch-tree-goto-matching-message' to
something internal, like `notmuch-tree--goto-matching-message-1' and
then the new `notmuch-tree-matching-message' to
`notmuch-tree-goto-matching-message', to make it clear that the new
function moves to a different message.

>  (defun notmuch-tree-prev-matching-message ()
>    "Move to previous matching message."
>    (interactive)
> -  (forward-line -1)
> -  (notmuch-tree-goto-matching-message t)
> -  (when (window-live-p notmuch-tree-message-window)
> -    (notmuch-tree-show-message-in)))
> +  (notmuch-tree-matching-message t))
>  
>  (defun notmuch-tree-next-matching-message ()
>    "Move to next matching message."
>    (interactive)
> -  (forward-line)
> -  (notmuch-tree-goto-matching-message)
> -  (when (window-live-p notmuch-tree-message-window)
> -    (notmuch-tree-show-message-in)))
> +  (notmuch-tree-matching-message))
>  
>  (defun notmuch-tree-refresh-view ()
>    "Refresh view."
> --
> 2.24.0
>
> _______________________________________________
> notmuch mailing list
> [hidden email]
> https://notmuchmail.org/mailman/listinfo/notmuch

dme.
--
I'm not living in the real world, no more, no more.
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Edmondson David Edmondson
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v3 4/7] emacs/tree: add kill-both prefix argument to notmuch-tree-quit

In reply to this post by William Casarin
On Saturday, 2019-12-28 at 10:01:21 -05, William Casarin wrote:

> This allows us to close both windows at the same time.
>
> Signed-off-by: William Casarin <[hidden email]>

Reviewed-by: David Edmondson <[hidden email]>

> ---
>  emacs/notmuch-tree.el | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
> index 25d84f45..f66219c5 100644
> --- a/emacs/notmuch-tree.el
> +++ b/emacs/notmuch-tree.el
> @@ -530,10 +530,10 @@ Shows in split pane or whole window according to value of
>    (when (notmuch-tree-scroll-message-window)
>      (notmuch-tree-next-matching-message)))
>  
> -(defun notmuch-tree-quit ()
> +(defun notmuch-tree-quit (&optional kill-both)
>    "Close the split view or exit tree."
> -  (interactive)
> -  (unless (notmuch-tree-close-message-window)
> +  (interactive "P")
> +  (when (or (not (notmuch-tree-close-message-window)) kill-both)
>      (kill-buffer (current-buffer))))
>  
>  (defun notmuch-tree-close-message-window ()
> --
> 2.24.0
>
> _______________________________________________
> notmuch mailing list
> [hidden email]
> https://notmuchmail.org/mailman/listinfo/notmuch

dme.
--
Oh there ain't no way to say I love you more.
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Edmondson David Edmondson
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v3 5/7] emacs/tree: add notmuch-tree-archive-message-than-next-or-exit

In reply to this post by William Casarin
On Saturday, 2019-12-28 at 10:01:22 -05, William Casarin wrote:

> This is the notmuch-tree version of
> notmuch-show-archive-message-than-next-or-exit.
>
> Signed-off-by: William Casarin <[hidden email]>

Reviewed-by: David Edmondson <[hidden email]>

> ---
>  emacs/notmuch-tree.el | 30 ++++++++++++++++++++----------
>  1 file changed, 20 insertions(+), 10 deletions(-)
>
> diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
> index f66219c5..cdf68ed4 100644
> --- a/emacs/notmuch-tree.el
> +++ b/emacs/notmuch-tree.el
> @@ -563,6 +563,15 @@ message will be \"unarchived\", i.e. the tag changes in
>    (notmuch-tree-archive-message unarchive)
>    (notmuch-tree-next-matching-message))
>  
> +(defun notmuch-tree-archive-message-then-next-or-exit ()
> +  "Archive current message, then show next open message in current thread.
> +
> +If at the last open message in the current thread, then exit back
> +to search results."
> +  (interactive)
> +  (notmuch-tree-archive-message)
> +  (notmuch-tree-next-matching-message t))
> +
>  (defun notmuch-tree-next-message ()
>    "Move to next message."
>    (interactive)
> @@ -589,23 +598,24 @@ nil otherwise."
>        (forward-line dir))
>      (not (funcall eobfn))))
>  
> -(defun notmuch-tree-matching-message (&optional prev)
> +(defun notmuch-tree-matching-message (&optional prev pop-at-end)
>    "Move to the next or previous matching message"
>    (interactive "P")
>    (forward-line (if prev -1 nil))
> -  (notmuch-tree-goto-matching-message prev)
> -  (when (window-live-p notmuch-tree-message-window)
> -    (notmuch-tree-show-message-in)))
> +  (if (and (not (notmuch-tree-goto-matching-message prev)) pop-at-end)
> +      (notmuch-tree-quit pop-at-end)
> +    (when (window-live-p notmuch-tree-message-window)
> +      (notmuch-tree-show-message-in))))
>  
> -(defun notmuch-tree-prev-matching-message ()
> +(defun notmuch-tree-prev-matching-message (&optional pop-at-end)
>    "Move to previous matching message."
> -  (interactive)
> -  (notmuch-tree-matching-message t))
> +  (interactive "P")
> +  (notmuch-tree-matching-message t pop-at-end))
>  
> -(defun notmuch-tree-next-matching-message ()
> +(defun notmuch-tree-next-matching-message (&optional pop-at-end)
>    "Move to next matching message."
> -  (interactive)
> -  (notmuch-tree-matching-message))
> +  (interactive "P")
> +  (notmuch-tree-matching-message nil pop-at-end))
>  
>  (defun notmuch-tree-refresh-view ()
>    "Refresh view."
> --
> 2.24.0
>
> _______________________________________________
> notmuch mailing list
> [hidden email]
> https://notmuchmail.org/mailman/listinfo/notmuch

dme.
--
I know a man called Sylvester, him have to wear a bullet proof vest y'all.
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Edmondson David Edmondson
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v3 6/7] emacs/tree: add notmuch-tree-archive-thread-then-exit

In reply to this post by William Casarin
On Saturday, 2019-12-28 at 10:01:23 -05, William Casarin wrote:

> This is the notmuch-tree version of
> notmuch-show-archive-thread-then-exit
>
> Signed-off-by: William Casarin <[hidden email]>

Reviewed-by: David Edmondson <[hidden email]>

> ---
>  emacs/notmuch-tree.el | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
> index cdf68ed4..e9c0433c 100644
> --- a/emacs/notmuch-tree.el
> +++ b/emacs/notmuch-tree.el
> @@ -563,6 +563,12 @@ message will be \"unarchived\", i.e. the tag changes in
>    (notmuch-tree-archive-message unarchive)
>    (notmuch-tree-next-matching-message))
>  
> +(defun notmuch-tree-archive-thread-then-exit ()
> +  "Archive all messages in the current buffer, then exit notmuch-tree."
> +  (interactive)
> +  (notmuch-tree-archive-thread)
> +  (notmuch-tree-quit t))
> +
>  (defun notmuch-tree-archive-message-then-next-or-exit ()
>    "Archive current message, then show next open message in current thread.
>  
> --
> 2.24.0
>
> _______________________________________________
> notmuch mailing list
> [hidden email]
> https://notmuchmail.org/mailman/listinfo/notmuch

dme.
--
Here I am, a rabbit-hearted girl.
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Edmondson David Edmondson
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v3 7/7] emacs/tree: add x/X bindings

In reply to this post by William Casarin
On Saturday, 2019-12-28 at 10:01:24 -05, William Casarin wrote:

> Add x and X binds to notmuch-tree for functionally that we have in
> notmuch-show.
>
> The notmuch-tree-quit binding is somewhat redundant, since it is
> handled by notmuch-bury-or-kill-this-buffer which is bound to q.
>
> Signed-off-by: William Casarin <[hidden email]>

Reviewed-by: David Edmondson <[hidden email]>

> ---
>  emacs/notmuch-tree.el | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
> index e9c0433c..987cc81e 100644
> --- a/emacs/notmuch-tree.el
> +++ b/emacs/notmuch-tree.el
> @@ -277,7 +277,8 @@ FUNC."
>      ;; The main tree view bindings
>      (define-key map (kbd "RET") 'notmuch-tree-show-message)
>      (define-key map [mouse-1] 'notmuch-tree-show-message)
> -    (define-key map "x" 'notmuch-tree-quit)
> +    (define-key map "x" 'notmuch-tree-archive-message-then-next-or-exit)
> +    (define-key map "X" 'notmuch-tree-archive-thread-then-exit)
>      (define-key map "A" 'notmuch-tree-archive-thread)
>      (define-key map "a" 'notmuch-tree-archive-message-then-next)
>      (define-key map "z" 'notmuch-tree-to-tree)
> --
> 2.24.0
>
> _______________________________________________
> notmuch mailing list
> [hidden email]
> https://notmuchmail.org/mailman/listinfo/notmuch

dme.
--
You know your green from your red.
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Daniel Kahn Gillmor Daniel Kahn Gillmor
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v3 0/7] Port notmuch-show's x/X bindings to notmuch-tree

In reply to this post by William Casarin
On Sat 2019-12-28 10:01:17 -0500, William Casarin wrote:
> These patches bring notmuch-tree more in line with the user experience
> of notmuch-show by adding the x/X bindings.

It looks like this series has been reviewed by dme, and is presumably
approved by him, with the exception of patch 3/7, which
id:[hidden email] suggests some improvement on.

William, would you be up for doing one last re-spin of this series to
address dme's comments?  it'd be nice to land this series unless someone
raises objections.

        --dkg

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (233 bytes) Download Attachment
William Casarin William Casarin
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v3 0/7] Port notmuch-show's x/X bindings to notmuch-tree

Daniel Kahn Gillmor <[hidden email]> writes:

> On Sat 2019-12-28 10:01:17 -0500, William Casarin wrote:
>> These patches bring notmuch-tree more in line with the user experience
>> of notmuch-show by adding the x/X bindings.
>
> It looks like this series has been reviewed by dme, and is presumably
> approved by him, with the exception of patch 3/7, which
> id:[hidden email] suggests some improvement on.
>
> William, would you be up for doing one last re-spin of this series to
> address dme's comments?  it'd be nice to land this series unless someone
> raises objections.

I was planning on it but it fell by the wayside. The only comment was
just a naming thing, perhaps we can just pull this and rename it in a
future patch? I could do a whole new series but I feel like that is
overkill.
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Edmondson David Edmondson
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v3 0/7] Port notmuch-show's x/X bindings to notmuch-tree

On Friday, 2020-02-21 at 09:06:46 -08, William Casarin wrote:

> Daniel Kahn Gillmor <[hidden email]> writes:
>
>> On Sat 2019-12-28 10:01:17 -0500, William Casarin wrote:
>>> These patches bring notmuch-tree more in line with the user experience
>>> of notmuch-show by adding the x/X bindings.
>>
>> It looks like this series has been reviewed by dme, and is presumably
>> approved by him, with the exception of patch 3/7, which
>> id:[hidden email] suggests some improvement on.
>>
>> William, would you be up for doing one last re-spin of this series to
>> address dme's comments?  it'd be nice to land this series unless someone
>> raises objections.
>
> I was planning on it but it fell by the wayside. The only comment was
> just a naming thing, perhaps we can just pull this and rename it in a
> future patch?

That would be fine with me.

> I could do a whole new series but I feel like that is overkill.

dme.
--
You make me feel like a natural woman.
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
William Casarin William Casarin
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v3 0/7] Port notmuch-show's x/X bindings to notmuch-tree


Hey there,

David Edmondson <[hidden email]> writes:

> On Friday, 2020-02-21 at 09:06:46 -08, William Casarin wrote:
>
>> Daniel Kahn Gillmor <[hidden email]> writes:
>>
>>> On Sat 2019-12-28 10:01:17 -0500, William Casarin wrote:
>>>> These patches bring notmuch-tree more in line with the user experience
>>>> of notmuch-show by adding the x/X bindings.
>>>
>>> It looks like this series has been reviewed by dme, and is presumably
>>> approved by him, with the exception of patch 3/7, which
>>> id:[hidden email] suggests some improvement on.
>>>
>>> William, would you be up for doing one last re-spin of this series to
>>> address dme's comments?  it'd be nice to land this series unless someone
>>> raises objections.
>>
>> I was planning on it but it fell by the wayside. The only comment was
>> just a naming thing, perhaps we can just pull this and rename it in a
>> future patch?
>
> That would be fine with me.

This set should be ready to go!

One thing that I want to do after this is start working on the 'A'
binding for notmuch-tree. It will be nice to skip through threads in
notmuch-tree from the search results like you can do in notmuch-show.

Cheers,
Will
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v3 3/7] emacs/tree: add notmuch-tree-matching-message

In reply to this post by William Casarin
William Casarin <[hidden email]> writes:

> This functions removes some duplicate logic between
> notmuch-tree-{next,prev}-matching-message
>

This patch doesn't apply. Does someone more familiar with the series
mind rebasing it against current master?

d
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch