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:m2zhgg3r5y.fsf@dme.org - Implement "A function scope variable to store the direction would save testing `prev' every time around the loop." as suggested in id:m2wobk3r4v.fsf@dme.org - Will address id:87k17cauth.fsf@iki.fi in future work as it's a bit out of scope for this patch set - Dropped id:20191113225752.26502-1-jb55@jb55.com since it has already been upstreamed v2: id:20191128161401.28844-1-jb55@jb55.com - fix a bug when moving between open messages - include M-RET keybinding patch from id:20191113225752.26502-1-jb55@jb55.com v1: id:20191117222929.1064-1-jb55@jb55.com 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 notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch