From b9a96c85d271b99f13fa0f1ec10fb1dd38694013 Mon Sep 17 00:00:00 2001 From: jao Date: Thu, 25 Aug 2022 05:39:24 +0100 Subject: jao-notmuch: next (tree) message command for searches sans tag:new --- lib/net/jao-notmuch.el | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el index f8a4648..11b239f 100644 --- a/lib/net/jao-notmuch.el +++ b/lib/net/jao-notmuch.el @@ -54,12 +54,6 @@ (notmuch-tree-close-message-window) (notmuch-tree-show-message nil))) -(defun jao-notmuch-click-message-buffer () - (interactive) - (let ((b (current-buffer))) - (unless (eq 'url (jao-notmuch-goto-message-buffer t t)) - (pop-to-buffer b)))) - (defun jao-notmuch-tree--find-tree-buffer () (or jao-notmuch--tree-buffer (let ((mb (current-buffer))) @@ -293,13 +287,29 @@ (outline-show-entry) (when and-show (notmuch-tree-show-message nil))) +(defsubst jao-notmuch-tree--message-open () + (and (buffer-live-p notmuch-tree-message-buffer) + (get-buffer-window notmuch-tree-message-buffer))) + +(defsubst jao-notmuch--get-prop (prop &optional props) + (or (and props (plist-get props prop)) + (notmuch-tree-get-prop prop) + (notmuch-show-get-prop prop))) + +(defun jao-notmuch--looking-at-match-p () + (and (jao-notmuch--get-prop :match) + (equal (jao-notmuch--get-prop :orig-tags) + (jao-notmuch--get-prop :tags)))) + (defun jao-notmuch-tree--next (prev thread no-exit &optional ignore-new) (let ((line-move-ignore-invisible nil)) - (cond ((and (not ignore-new) (jao-notmuch--looking-at-new-p))) + (cond ((and (not ignore-new) + (jao-notmuch--looking-at-match-p) + (not (jao-notmuch-tree--message-open)))) (thread (notmuch-tree-next-thread prev) (unless (or (not (notmuch-tree-get-message-properties)) - (jao-notmuch--looking-at-new-p)) + (jao-notmuch--looking-at-match-p)) (notmuch-tree-matching-message prev (not no-exit)))) (t (notmuch-tree-matching-message prev (not no-exit))))) (when (notmuch-tree-get-message-id) -- cgit v1.2.3