From: David Bremner <david@tethera.net>
To: Brennan Vincent <brennan@umanwizard.com>, notmuch@notmuchmail.org
Subject: Re: [PATCH v2] Add --emit-message-id flag to notmuch-insert.
Date: Wed, 25 Sep 2024 18:51:21 -0300 [thread overview]
Message-ID: <87plorl7vq.fsf@tethera.net> (raw)
In-Reply-To: <87msketeua.fsf@taipei.mail-host-address-is-not-set>
Brennan Vincent <brennan@umanwizard.com> writes:
First, thanks for sending a contribution to notmuch.
Usually we insist on a bit more verbose (see
https://notmuchmail.org/contributing/#index5h2 for details).
Here it's probably enough to mention the overall goal of the patch
series, that this feature will be used to add a draftify feature, but
maybe you have a more general "why" to discuss.
> ---
> doc/man1/notmuch-insert.rst | 5 +++++
> notmuch-insert.c | 26 +++++++++++++++++++++-----
> 2 files changed, 26 insertions(+), 5 deletions(-)
>
> diff --git a/doc/man1/notmuch-insert.rst b/doc/man1/notmuch-insert.rst
> index e05bd0b5..3848b8f6 100644
> --- a/doc/man1/notmuch-insert.rst
> +++ b/doc/man1/notmuch-insert.rst
> @@ -66,6 +66,11 @@ Supported options for **insert** include
> umask. By default, delivered mail is only readable by the current
> user.
>
> +.. option:: --emit-message-id
> +
> + On successful exit (or with ``--keep``),
> + print the message ID of the newly indexed message.
> +
I'm a bit confused here. If indexing fails with --keep, the
printed id will not exist in the database, right? So how is the user
supposed to detect that kind of failure?
> -add_file (notmuch_database_t *notmuch, const char *path, tag_op_list_t *tag_ops,
> +add_file (const void *ctx, notmuch_database_t *notmuch, const char *path, tag_op_list_t *tag_ops,
Since notmuch is already a talloc context, you should address the need
for a new context somewhere (either a comment or the commit message).
>
> DONE:
> - notmuch_message_destroy (message);
> -
> if (status) {
> if (keep) {
> status = NOTMUCH_STATUS_SUCCESS;
> @@ -458,6 +457,15 @@ add_file (notmuch_database_t *notmuch, const char *path, tag_op_list_t *tag_ops,
> }
> }
> }
> + if (message_id_out) {
> + if (!status) {
I can't quite explain why I don't mind if (status), but find "if
(!status)" for success a bit jarring/confusing, but an explicit test
against NOTMUCH_STATUS_SUCCESS would be nicer, IMHO.
A more substantial comment is that for new CLI features we need at least one
or two tests. Hopefully test/T070-insert.sh gives you enough clues, but
feel free to ask for help.
next prev parent reply other threads:[~2024-09-25 21:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-10 20:33 [PATCH] Add --emit-message-id flag to notmuch-insert Brennan Vincent
2024-09-11 15:00 ` [PATCH v2] " Brennan Vincent
2024-09-25 21:51 ` David Bremner [this message]
2024-10-03 17:35 ` When exactly is the post-insert hook called? Ralph Seichter
2024-10-03 17:59 ` Ralph Seichter
2024-09-11 16:09 ` [PATCH] emacs: Introduce notmuch-draftify-buffer command Brennan Vincent
2024-09-25 22:09 ` David Bremner
2024-09-29 0:36 ` Brennan Vincent
2024-09-26 20:25 ` [PATCH v3] Add --emit-message-id flag to notmuch-insert Brennan Vincent
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87plorl7vq.fsf@tethera.net \
--to=david@tethera.net \
--cc=brennan@umanwizard.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).