[PATCH] emacs: remove newlines from input to notmuch count --batch

Tomi Ollila tomi.ollila at iki.fi
Sat Feb 8 10:31:17 PST 2014


On Sat, Feb 08 2014, David Bremner <david at tethera.net> wrote:

> Since a newline starts a new query in batch mode, this causes
> mysterious crashes in the emacs interface if saved searches contain
> newlines.  See the discussion at
>
>       id:87wqhcxb5j.fsf at maritornes.cs.unb.ca
>
> In general newlines seem to be just whitespace to the xapian query
> parser, so this should be mainly harmless.
> ---

LGTM.

Tomi


>  emacs/notmuch-hello.el | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index 7b3d76b..e325cd3 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -399,10 +399,12 @@ options will be handled as specified for
>  			     (third elem)
>  			   (cdr elem))))
>  	(insert
> -	 (notmuch-hello-filtered-query count-query
> -				       (or (plist-get options :filter-count)
> -					   (plist-get options :filter)))
> -	 "\n")))
> +	 (replace-regexp-in-string
> +	  "\n" " "
> +	  (notmuch-hello-filtered-query count-query
> +					(or (plist-get options :filter-count)
> +					    (plist-get options :filter))))
> +	  "\n")))
>  
>      (unless (= (call-process-region (point-min) (point-max) notmuch-command
>  				    t t nil "count" "--batch") 0)
> -- 
> 1.8.5.2
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list