unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Edmondson <dme@dme.org>
To: William Casarin <jb55@jb55.com>, notmuch@notmuchmail.org
Subject: Re: [PATCH v3 3/7] emacs/tree: add notmuch-tree-matching-message
Date: Mon, 30 Dec 2019 12:22:41 +0000	[thread overview]
Message-ID: <m25zhyxasu.fsf@dme.org> (raw)
In-Reply-To: <20191228150124.20630-4-jb55@jb55.com>

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 <jb55@jb55.com>
> ---
>  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
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

dme.
-- 
I'm not living in the real world, no more, no more.

  reply	other threads:[~2019-12-30 12:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-28 15:01 [PATCH v3 0/7] Port notmuch-show's x/X bindings to notmuch-tree William Casarin
2019-12-28 15:01 ` [PATCH v3 1/7] emacs/tree: return true if a thread was found in next-thread William Casarin
2019-12-30 12:17   ` David Edmondson
2019-12-28 15:01 ` [PATCH v3 2/7] emacs/tree: add notmuch-tree-goto-matching-message William Casarin
2019-12-30 12:20   ` David Edmondson
2019-12-28 15:01 ` [PATCH v3 3/7] emacs/tree: add notmuch-tree-matching-message William Casarin
2019-12-30 12:22   ` David Edmondson [this message]
2020-04-03 12:15   ` David Bremner
2019-12-28 15:01 ` [PATCH v3 4/7] emacs/tree: add kill-both prefix argument to notmuch-tree-quit William Casarin
2019-12-30 12:23   ` David Edmondson
2019-12-28 15:01 ` [PATCH v3 5/7] emacs/tree: add notmuch-tree-archive-message-than-next-or-exit William Casarin
2019-12-30 12:24   ` David Edmondson
2019-12-28 15:01 ` [PATCH v3 6/7] emacs/tree: add notmuch-tree-archive-thread-then-exit William Casarin
2019-12-30 12:25   ` David Edmondson
2019-12-28 15:01 ` [PATCH v3 7/7] emacs/tree: add x/X bindings William Casarin
2019-12-30 12:25   ` David Edmondson
2020-02-20 19:43 ` [PATCH v3 0/7] Port notmuch-show's x/X bindings to notmuch-tree Daniel Kahn Gillmor
2020-02-21 17:06   ` William Casarin
2020-02-21 17:18     ` David Edmondson
2020-03-23 16:38       ` William Casarin

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=m25zhyxasu.fsf@dme.org \
    --to=dme@dme.org \
    --cc=jb55@jb55.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).