[PATCH v4 7/8] emacs: Fix navigation of multi-line search result formats

Jani Nikula jani at nikula.org
Wed Aug 1 23:51:19 PDT 2012


On Sat, 21 Jul 2012, Austin Clements <amdragon at MIT.EDU> wrote:
> At this point, the only remaining functions that don't support
> multi-line search result formats are the thread navigation functions.
> This patch fixes that by rewriting them in terms of
> notmuch-search-result-{beginning,end}.
>
> This changes the behavior of notmuch-search-previous-thread slightly
> so that if point isn't at the beginning of a result, it first moves
> point to the beginning of the result.

Hi Austin, bisecting suggests this patch (committed as 5d0883e) breaks
notmuch-show-archive-thread-then-next and subsequently
notmuch-show-advance-and-archive for me. When showing the last thread in
the search results, notmuch-show-archive-thread-then-next used to exit
to the end of the search buffer. Now it redisplays the current
thread. When I hit SPC to cruise through mails, there's no indication
that I've reached the end of search results, other than the same thread
being displayed over and over.

BR,
Jani.


> ---
>  emacs/notmuch.el |   13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index d092528..fd1836f 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -293,18 +293,25 @@ For a mouse binding, return nil."
>  (defun notmuch-search-next-thread ()
>    "Select the next thread in the search results."
>    (interactive)
> -  (forward-line 1))
> +  (when (notmuch-search-get-result (notmuch-search-result-end))
> +    (goto-char (notmuch-search-result-end))))
>  
>  (defun notmuch-search-previous-thread ()
>    "Select the previous thread in the search results."
>    (interactive)
> -  (forward-line -1))
> +  (if (notmuch-search-get-result)
> +      (unless (bobp)
> +	(goto-char (notmuch-search-result-beginning (- (point) 1))))
> +    ;; We must be past the end; jump to the last result
> +    (notmuch-search-last-thread)))
>  
>  (defun notmuch-search-last-thread ()
>    "Select the last thread in the search results."
>    (interactive)
>    (goto-char (point-max))
> -  (forward-line -2))
> +  (forward-line -2)
> +  (let ((beg (notmuch-search-result-beginning)))
> +    (when beg (goto-char beg))))
>  
>  (defun notmuch-search-first-thread ()
>    "Select the first thread in the search results."
> -- 
> 1.7.10
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list