David Bremner <david@tethera.net> writes: > 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/ Done, will be in the next revision of the patch series. > >> 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" Done, will be in the next revision of the patch series. > >> +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. That won't work here, since `notmuch insert` doesn't accept --format-version at all, so people using older versions of the CLI would just get an obscure error about --format-version being an unrecognized arg. What we can do is in notmuch-check-exit-status, search the error output for "Unrecognized option: --emit-message-id" and translate it to something friendlier. Searching for specific strings in error message is a bit unsatisfying to me, but at least it works (and correct me if I'm wrong, but I don't think notmuch has been localized to languages other than English which would break it). What do you think? (Btw, I think in the future it would be good to make all commands accept --format-version, even those whose output doesn't change today, to avoid this sort of issue). > _______________________________________________ > notmuch mailing list -- notmuch@notmuchmail.org > To unsubscribe send an email to notmuch-leave@notmuchmail.org _______________________________________________ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-leave@notmuchmail.org