Small bug in json-search changes

Austin Clements amdragon at MIT.EDU
Mon Aug 6 16:47:32 PDT 2012


Nice catch.  I think the solution is either exactly this, or we should
strip "thread:" off notmuch-search-target-thread when we set it.  I
would lean slightly toward the latter so we don't have to generate up
a new (identical) string on every notmuch-search-show-result call, but
I doubt it would make much difference in the grand scheme of things.

Quoth Mark Walters on Aug 07 at 12:10 am:
> 
> Hi
> 
> I have found a small bug in the recent changes to notmuch search to use
> the JSON output. If you refresh the search buffer "point" does not stay
> on the same thread. 
> 
> I think the problem is that notmuch-search-refresh-view calls notmuch
> search with target-thread set to notmuch-search-find-thread-id which
> returns the thread-id with "thread:" prefixed, whereas
> notmuch-search-show-result checks for a match with (plist-get result
> :thread) which is the thread id with no prefix.
> 
> The patch below fixes this but I am not sure it is the nicest fix.
> 
> Best wishes
> 
> Mark
> 
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index d2d82a9..a53d5a0 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -798,7 +798,7 @@ non-authors is found, assume that all of the authors match."
>  	(insert "\n")
>  	(notmuch-search-color-line beg (point) (plist-get result :tags))
>  	(put-text-property beg (point) 'notmuch-search-result result))
> -      (when (string= (plist-get result :thread) notmuch-search-target-thread)
> +      (when (string= (concat "thread:" (plist-get result :thread)) notmuch-search-target-thread)
>  	(setq notmuch-search-target-thread "found")
>  	(goto-char beg)))))
>  
> 


More information about the notmuch mailing list