Re: [PATCH v1 1/3] notmuch: Include the format parameter of text/plain parts

Subject: Re: [PATCH v1 1/3] notmuch: Include the format parameter of text/plain parts

Date: Sat, 22 Dec 2018 07:41:37 +0900

To: David Edmondson, notmuch@notmuchmail.org

Cc:

From: David Bremner


David Edmondson <dme@dme.org> writes:

> During formatted output, if a content type of a text/plain part
> has a "format" paramter, include it in the output.
> ---
>  notmuch-show.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/notmuch-show.c b/notmuch-show.c
> index 07e9a5db..92d18bb8 100644
> --- a/notmuch-show.c
> +++ b/notmuch-show.c
> @@ -708,6 +708,19 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
>      }
>  
>      if (GMIME_IS_PART (node->part)) {
> +	/* Include the format parameter of text/plain parts if it
> +	 * exists, allowing the UI to adapt the display of the part as
> +	 * appropriate.
> +	 */
> +	if (g_mime_content_type_is_type (content_type, "text", "plain")) {
> +	    const char *format =
> +		g_mime_object_get_content_type_parameter (node->part, "format");
> +	    if (format) {
> +		sp->map_key (sp, "format");
> +		sp->string (sp, format);
> +	    }
> +	}
> +
>  	/* For non-HTML text parts, we include the content in the
>  	 * JSON. Since JSON must be Unicode, we handle charset
>  	 * decoding here and do not report a charset to the caller.

We need to update devel/schemata for this change.

Have you thought about the failure modes for mismatched notmuch.el <->
notmuch? Since you don't bump the format version, the emacs side has no
way of knowing if the notmuch side supports the 'format' key. That's
probably fine since the key is optional.
_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: