Re: [PATCH] emacs: Introduce notmuch-draftify-buffer command.

Subject: Re: [PATCH] emacs: Introduce notmuch-draftify-buffer command.

Date: Wed, 25 Sep 2024 19:09:31 -0300

To: Brennan Vincent, notmuch@notmuchmail.org

Cc:

From: David Bremner


Brennan Vincent <brennan@umanwizard.com> writes:

> This command inserts the current buffer as a draft. It optionally
> begins editing the draft.

[nice commit message snipped]

Here again, if possible we would like a test. For emacs tests it is a
bit more laborious, but there are several options outlined in
test/

>  will appear in a buffer named \"*Notmuch errors*\" and an error
> -will be signaled."
> +will be signaled.
> +
> +Otherwise, returns the output from the process as a string."
>    (with-temp-buffer
> -    (let ((status (notmuch-call-notmuch--helper t args)))
> -      (notmuch-check-exit-status status (cons notmuch-command args)
> -				 (buffer-string)))))
> +    (let ((status (notmuch-call-notmuch--helper t args))
> +	  (output (buffer-string)))
> +      (and (notmuch-check-exit-status status (cons notmuch-command args)
> +				      output)
> +	   output))))

Is it clear / documented what the return value of
notmuch-check-exit-status is? If all you mean is that it completes
without error, I think "progn" is clearer than "and"

> +Returns the message ID of the inserted message."
> +  (let ((output (apply 'notmuch-call-notmuch-process
> +		       :stdin-string (buffer-string) "insert"
> +		       (append (and create (list "--create-folder"))
> +			       (list (concat "--folder=" folder)
> +				     "--emit-message-id")
> +			       tags))))
> +    (string-trim output)))

One problem we have is that people merrily upgrade the emacs front end
without updating the CLI. Recently (see devel/schemata) we have started
bumping the output version for new command arguments, so at least the
error reporting is clear.
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: