Re: [PATCH] emacs: hello: make --batch error gracefully

Subject: Re: [PATCH] emacs: hello: make --batch error gracefully

Date: Tue, 23 Jul 2013 23:28:11 -0300

To: Mark Walters

Cc: notmuch mailing list

From: David Bremner


Mark Walters <markwalters1009@gmail.com> writes:
> -    (call-process-region (point-min) (point-max) notmuch-command
> -			 t t nil "count" "--batch")
> +    (unless (= (call-process-region (point-min) (point-max) notmuch-command
> +				    t t nil "count" "--batch") 0)
> +      (notmuch-logged-error "notmuch CLI version mismatch error (count --batch)
> +The most likely cause of this error is that the CLI is too old
> +to support count --batch and needs to be upgraded to the same
> +version as notmuch-emacs"))
> +

I had a look at this, and I agree the current failure mode is not nice
(it just says something mysterious about nil not being a string). On the
other hand, I think we should use the two argument form of
notmuch-logged-error, and the the first argument should say only what we
know. Something like

(notmuch-logged-error "notmuch count --batch failed"
"notmuch count --batch failed
Please check that the notmuch CLI is new enough to  support `count
--batch'. In general we recommend running matching versions of the CLI
and emacs interface.")

d


Thread: