unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
Subject: Re: [PATCH] emacs-show: open excluded matches if no other matches
Date: Thu, 12 Apr 2012 22:10:10 +0300	[thread overview]
Message-ID: <m2wr5kdawd.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <1331836090-30560-1-git-send-email-markwalters1009@gmail.com>

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

      parent reply	other threads:[~2012-04-12 19:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2wr5kdawd.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=markwalters1009@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).