* [PATCH] emacs-show: open excluded matches if no other matches @ 2012-03-15 18:28 Mark Walters 2012-04-12 19:08 ` Jameson Graef Rollins 2012-04-12 19:10 ` Tomi Ollila 0 siblings, 2 replies; 6+ messages in thread From: Mark Walters @ 2012-03-15 18:28 UTC (permalink / raw) To: notmuch Currently emacs show does not open matching but excluded messages. This is normally the desired behaviour but is probably not ideal if only excluded messages match. This patch opens all the matching (necessarily excluded) messages in this case and goes to the first one. --- emacs/notmuch-show.el | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 4a60631..bd4ba0f 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1608,6 +1608,11 @@ to show, nil otherwise." (notmuch-show-message-adjust)) (goto-char (point-max))))) +(defun notmuch-show-open-if-matched () + "Open a message if it is matched (whether or not excluded)." + (let ((props (notmuch-show-get-message-properties))) + (notmuch-show-message-visible props (plist-get props :match)))) + (defun notmuch-show-goto-first-wanted-message () "Move to the first open message and mark it read" (goto-char (point-min)) @@ -1615,9 +1620,14 @@ to show, nil otherwise." (notmuch-show-mark-read) (notmuch-show-next-open-message)) (when (eobp) + ;; There are no matched non-excluded messages so open all matched + ;; (necessarily excluded) messages and go to the first. + (notmuch-show-mapc 'notmuch-show-open-if-matched) + (force-window-update) (goto-char (point-min)) - (unless (notmuch-show-get-prop :match) - (notmuch-show-next-matching-message)))) + (if (notmuch-show-message-visible-p) + (notmuch-show-mark-read) + (notmuch-show-next-open-message)))) (defun notmuch-show-previous-open-message () "Show the previous open message." -- 1.7.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] emacs-show: open excluded matches if no other matches 2012-03-15 18:28 [PATCH] emacs-show: open excluded matches if no other matches Mark Walters @ 2012-04-12 19:08 ` Jameson Graef Rollins 2012-04-12 19:20 ` Tomi Ollila 2012-04-12 19:10 ` Tomi Ollila 1 sibling, 1 reply; 6+ messages in thread From: Jameson Graef Rollins @ 2012-04-12 19:08 UTC (permalink / raw) To: Mark Walters, notmuch [-- Attachment #1: Type: text/plain, Size: 565 bytes --] On Thu, Mar 15 2012, Mark Walters <markwalters1009@gmail.com> wrote: > Currently emacs show does not open matching but excluded > messages. This is normally the desired behaviour but is probably not > ideal if only excluded messages match. This patch opens all the > matching (necessarily excluded) messages in this case and goes to the > first one. Hi, Mark. I have tested this patch and it LGTM. I think this is the behavior we want, since it's no fun to open up a show buffer and have all messages in the thread closed. That doesn't make much sense. jamie. [-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] emacs-show: open excluded matches if no other matches 2012-04-12 19:08 ` Jameson Graef Rollins @ 2012-04-12 19:20 ` Tomi Ollila 2012-04-13 8:57 ` Jani Nikula 0 siblings, 1 reply; 6+ messages in thread From: Tomi Ollila @ 2012-04-12 19:20 UTC (permalink / raw) To: Jameson Graef Rollins, Mark Walters, notmuch On Thu, Apr 12 2012, Jameson Graef Rollins wrote: > On Thu, Mar 15 2012, Mark Walters <markwalters1009@gmail.com> wrote: >> Currently emacs show does not open matching but excluded >> messages. This is normally the desired behaviour but is probably not >> ideal if only excluded messages match. This patch opens all the >> matching (necessarily excluded) messages in this case and goes to the >> first one. > > Hi, Mark. I have tested this patch and it LGTM. I think this is the > behavior we want, since it's no fun to open up a show buffer and have > all messages in the thread closed. That doesn't make much sense. I disagree: If I open up a show buffer I'd like to have all messages in the thread closed if search terms do not match. But that is my opinion and inconsistent with current behaviour. (Therefore I already +1:d this patch) An example: I have thread of 100 messages and 1 of those is unread. Search terms is tag:unread. I enter the thread: 99 messages closed and this one open. Now unread is automatically removed. If I go back to search view (by pressing q) and re-choose the same thread, current behaviour is to open all 100 messages. I'd like to see all 100 messages closed. > jamie. Tomi ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] emacs-show: open excluded matches if no other matches 2012-04-12 19:20 ` Tomi Ollila @ 2012-04-13 8:57 ` Jani Nikula 2012-04-13 9:29 ` Mark Walters 0 siblings, 1 reply; 6+ messages in thread From: Jani Nikula @ 2012-04-13 8:57 UTC (permalink / raw) To: Tomi Ollila, Jameson Graef Rollins, Mark Walters, notmuch On Thu, 12 Apr 2012 22:20:52 +0300, Tomi Ollila <tomi.ollila@iki.fi> wrote: > On Thu, Apr 12 2012, Jameson Graef Rollins wrote: > > > On Thu, Mar 15 2012, Mark Walters <markwalters1009@gmail.com> wrote: > >> Currently emacs show does not open matching but excluded > >> messages. This is normally the desired behaviour but is probably not > >> ideal if only excluded messages match. This patch opens all the > >> matching (necessarily excluded) messages in this case and goes to the > >> first one. > > > > Hi, Mark. I have tested this patch and it LGTM. I think this is the > > behavior we want, since it's no fun to open up a show buffer and have > > all messages in the thread closed. That doesn't make much sense. > > I disagree: If I open up a show buffer I'd like to have all messages > in the thread closed if search terms do not match. But that is my > opinion and inconsistent with current behaviour. > > (Therefore I already +1:d this patch) > > An example: I have thread of 100 messages and 1 of those is unread. > Search terms is tag:unread. I enter the thread: 99 messages closed > and this one open. Now unread is automatically removed. If I go back > to search view (by pressing q) and re-choose the same thread, > current behaviour is to open all 100 messages. I'd like to see all > 100 messages closed. IIUC this would still show all messages closed. Messages that don't match will be closed. The change is that if there are messages that match, but all of them are excluded, then open the messages anyway. In your example, only if you have *another* message that is both tag:unread and tag:deleted (or some other excluded tag) it would show up the second time you enter show view. I actually think I'd still want the above to show all messages closed, unless the excluded tag was explicitly specified in the search. The idea of exclusions is to reduce "noise" in the view, why open them? If you have those 100 messages in a thread, and you want to see the interesting (i.e. non-excluded) messages, I'd rather see 0 open if 0 are interesting, instead of 100 non-interesting if they are all excluded. Perhaps a function to toggle the open/close of excluded messages would be a better idea. But then I don't use exclusions ATM, so maybe I just don't understand, and won't be affected either way. *shrug*. BR, Jani. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] emacs-show: open excluded matches if no other matches 2012-04-13 8:57 ` Jani Nikula @ 2012-04-13 9:29 ` Mark Walters 0 siblings, 0 replies; 6+ messages in thread From: Mark Walters @ 2012-04-13 9:29 UTC (permalink / raw) To: Jani Nikula, Tomi Ollila, Jameson Graef Rollins, notmuch On Fri, 13 Apr 2012, Jani Nikula <jani@nikula.org> wrote: > On Thu, 12 Apr 2012 22:20:52 +0300, Tomi Ollila <tomi.ollila@iki.fi> wrote: >> On Thu, Apr 12 2012, Jameson Graef Rollins wrote: >> >> > On Thu, Mar 15 2012, Mark Walters <markwalters1009@gmail.com> wrote: >> >> Currently emacs show does not open matching but excluded >> >> messages. This is normally the desired behaviour but is probably not >> >> ideal if only excluded messages match. This patch opens all the >> >> matching (necessarily excluded) messages in this case and goes to the >> >> first one. >> > >> > Hi, Mark. I have tested this patch and it LGTM. I think this is the >> > behavior we want, since it's no fun to open up a show buffer and have >> > all messages in the thread closed. That doesn't make much sense. >> >> I disagree: If I open up a show buffer I'd like to have all messages >> in the thread closed if search terms do not match. But that is my >> opinion and inconsistent with current behaviour. >> >> (Therefore I already +1:d this patch) >> >> An example: I have thread of 100 messages and 1 of those is unread. >> Search terms is tag:unread. I enter the thread: 99 messages closed >> and this one open. Now unread is automatically removed. If I go back >> to search view (by pressing q) and re-choose the same thread, >> current behaviour is to open all 100 messages. I'd like to see all >> 100 messages closed. > > IIUC this would still show all messages closed. Messages that don't > match will be closed. The change is that if there are messages that > match, but all of them are excluded, then open the messages anyway. This patch does not affect the behaviour in this case, but the code existing code does expand all messages in a thread if none match (the use of basic-args and args in notmuch-show-build-buffer). > In your example, only if you have *another* message that is both > tag:unread and tag:deleted (or some other excluded tag) it would show up > the second time you enter show view. > > I actually think I'd still want the above to show all messages closed, > unless the excluded tag was explicitly specified in the search. The idea > of exclusions is to reduce "noise" in the view, why open them? If you > have those 100 messages in a thread, and you want to see the interesting > (i.e. non-excluded) messages, I'd rather see 0 open if 0 are > interesting, instead of 100 non-interesting if they are all excluded. I think that is entirely plausible as a way to go (though I would also be happy with the behaviour after this patch). But I think that should be a subsequent patch because to be consistent it would have to change the existing behaviour for no matches (and no excludes) to be all closed. > Perhaps a function to toggle the open/close of excluded messages would > be a better idea. That might be useful regardless. I could add a function to do this, which could be called by the above patch if we want the behaviour it introduces. Do you think that is worth doing? > But then I don't use exclusions ATM, so maybe I just > don't understand, and won't be affected either way. *shrug*. That is one problem: there are lots of potential use cases and its not clear which of them people will use and which we should encourage. I use a `bizarre' one: I exclude all of my mailing list mail (including notmuch) so that it doesn't show up in my personal mail searches. So I guess I am using the excludes to return to the bad old days of `folders'. (I am not recommending this to anyone, I partly did it as a good stress test for the exclude stuff, but it does seem to mostly work.) Best wishes Mark ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] emacs-show: open excluded matches if no other matches 2012-03-15 18:28 [PATCH] emacs-show: open excluded matches if no other matches Mark Walters 2012-04-12 19:08 ` Jameson Graef Rollins @ 2012-04-12 19:10 ` Tomi Ollila 1 sibling, 0 replies; 6+ messages in thread From: Tomi Ollila @ 2012-04-12 19:10 UTC (permalink / raw) To: Mark Walters, notmuch On Thu, Mar 15 2012, Mark Walters wrote: > Currently emacs show does not open matching but excluded > messages. This is normally the desired behaviour but is probably not > ideal if only excluded messages match. This patch opens all the > matching (necessarily excluded) messages in this case and goes to the > first one. > --- I don't (yet) fully understand this exclude stuff, but the implementation looks ok. +1 Tomi > emacs/notmuch-show.el | 14 ++++++++++++-- > 1 files changed, 12 insertions(+), 2 deletions(-) > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index 4a60631..bd4ba0f 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -1608,6 +1608,11 @@ to show, nil otherwise." > (notmuch-show-message-adjust)) > (goto-char (point-max))))) > > +(defun notmuch-show-open-if-matched () > + "Open a message if it is matched (whether or not excluded)." > + (let ((props (notmuch-show-get-message-properties))) > + (notmuch-show-message-visible props (plist-get props :match)))) > + > (defun notmuch-show-goto-first-wanted-message () > "Move to the first open message and mark it read" > (goto-char (point-min)) > @@ -1615,9 +1620,14 @@ to show, nil otherwise." > (notmuch-show-mark-read) > (notmuch-show-next-open-message)) > (when (eobp) > + ;; There are no matched non-excluded messages so open all matched > + ;; (necessarily excluded) messages and go to the first. > + (notmuch-show-mapc 'notmuch-show-open-if-matched) > + (force-window-update) > (goto-char (point-min)) > - (unless (notmuch-show-get-prop :match) > - (notmuch-show-next-matching-message)))) > + (if (notmuch-show-message-visible-p) > + (notmuch-show-mark-read) > + (notmuch-show-next-open-message)))) > > (defun notmuch-show-previous-open-message () > "Show the previous open message." > -- > 1.7.9.1 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-04-13 9:29 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-03-15 18:28 [PATCH] emacs-show: open excluded matches if no other matches Mark Walters 2012-04-12 19:08 ` Jameson Graef Rollins 2012-04-12 19:20 ` Tomi Ollila 2012-04-13 8:57 ` Jani Nikula 2012-04-13 9:29 ` Mark Walters 2012-04-12 19:10 ` Tomi Ollila
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).