From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id DFB536DE0278 for ; Sun, 10 Nov 2019 01:41:41 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.164 X-Spam-Level: X-Spam-Status: No, score=-0.164 tagged_above=-999 required=5 tests=[AWL=-0.163, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id O84lV5m83e7i for ; Sun, 10 Nov 2019 01:41:39 -0800 (PST) Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by arlo.cworth.org (Postfix) with ESMTPS id 8A3536DE0240 for ; Sun, 10 Nov 2019 01:41:39 -0800 (PST) Received: by mail-lf1-f44.google.com with SMTP id j26so516799lfh.7 for ; Sun, 10 Nov 2019 01:41:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nikula-org.20150623.gappssmtp.com; s=20150623; h=from:to:subject:in-reply-to:references:date:message-id:mime-version; bh=Eun0FJD3QEW++VzD1vY2oMDll3rP5JrAexpM5ptp2MQ=; b=Y87AB2OGykt58OdDIcjZkSVsOZFkXFjRAoS1MVfnr7HbYMh5wjYuF0WVoafj3oLxFc eFcun8xdgXoDWI8KXKwfML69e0rKAiZi1CYJHFX3ilp+aILH8aX3EYQe3Ql0HxX41zgv BQbfKwkKMbioy11aPk1rN9wDIVpXlGL5HcntPFAvtGHATFi4+ZyzK/kHMic5HhQMoyd1 q3gadPNoCGW1+iQWnjQe+Cn1xwA435+wg7mM0AJPWYklJJvUfxuhkqsAn+M0Rjzs9ngP AX1RVfjgPCQZmIhHht9ROFyiWFeMezEIAel4Z7rHcGn6nzkk7dT91cjIaT4wwrq12gsJ Hmrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version; bh=Eun0FJD3QEW++VzD1vY2oMDll3rP5JrAexpM5ptp2MQ=; b=I4hbiFuYR4p7WH1wcmyzy/zbLDrFG3qFpGUhXuCOEfQ8JlN1HuHyPS4w9MczgbDwzX yR07b1byXQXDzOy5UhRhujRd/AIdwAKo9rROl6kI+Uukz6QXJZ03c36jd7fUjiUk4IoW fEOsMAyZxNRMx3jWlzMBGuY12OVragnTPc8407/9NVxgrI+onWlbWhpakVz2Xfq3J7dO nygSfDtqYFydzCTA7r5m777ICoGE2uqwGSfVdJwbv4YQgnIWXAshjmsuGSYsMvHoZibY 4tbe570KzsRBRpN+ieBV76cJ6hdw6YrrQD35rDqqN75ePBEHNPumzO/3IMWX4s14gTt3 PSRQ== X-Gm-Message-State: APjAAAU5XAS2CVn8ITVTew11gF6KtLkdVbBNnLZaagpgooeLXpuoHrmk TC6QX4PRtPtAZ9pN9XwDVAnJbQ== X-Google-Smtp-Source: APXvYqxU6zicPUEo+EVtuzj4xqGvwT0EZerlcLt7jmhoVperXpMpA8CBZjuHOkTtkLjGweEwHEmicw== X-Received: by 2002:a19:9144:: with SMTP id y4mr11528419lfj.168.1573378895795; Sun, 10 Nov 2019 01:41:35 -0800 (PST) Received: from localhost (213-216-249-106.bb.dnainternet.fi. [213.216.249.106]) by smtp.gmail.com with ESMTPSA id g21sm5359192ljh.2.2019.11.10.01.41.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Nov 2019 01:41:35 -0800 (PST) From: Jani Nikula To: Tomi Ollila , notmuch@notmuchmail.org Subject: Re: [PATCH] Fix format_headers_sprinter to return all headers (v2) In-Reply-To: References: <20191109221358.4349-1-johan.parin@gmail.com> Date: Sun, 10 Nov 2019 11:41:31 +0200 Message-ID: <87h83cax10.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 09:41:42 -0000 On Sun, 10 Nov 2019, Tomi Ollila wrote: > Subject line not updated > > On Sat, Nov 09 2019, Johan Parin wrote: > >> So this version only returns a fixed limited set of extra >> headers. Hopefully this eliminates any concern for a performance >> penalty. Of course it limits the usefulness of the >> notmuch-message-headers variable. > > headers to request based on command line parameter (and default to current > set) could be an option (kinda Jani already suggested). Quick (not perhaps > well thought) one could be: > > --message-headers=To,Cc,X-Face Yes, something like this is what I had in mind. But this needs to be carefully thought out. Obviously we need a default set. Is it possible to remove headers from the default set? Does --message-headers=Foo override the default set too? Should we force the inclusion of certain "fundamental" headers? Etc. As I said, the notmuch-show interface is a bit confusing already, better not make it more confusing. > and in the other mail -- mostly style comments (for future reference) > > On Sat, Nov 09 2019, Johan Parin wrote: > > >> Modify format_headers_sprinter so that it returns some additional headers in the >> sexp, instead of a small fixed set of headers. >> >> This version includes the following headers: >> >> - Maildir >> - Mailing-list >> - Tags >> - Attachments >> - Signature >> - Decryption >> - User-agent >> - X-Mailer >> >> This is required in order for the elisp variable >> `notmuch-message-headers' to work to some extent. >> >> See this bug report: >> >> https://notmuchmail.org/pipermail/notmuch/2017/026069.html >> --- >> notmuch-show.c | 19 +++++++++++++++++++ >> 1 file changed, 19 insertions(+) >> >> diff --git a/notmuch-show.c b/notmuch-show.c >> index 21792a57..86ddb491 100644 >> --- a/notmuch-show.c >> +++ b/notmuch-show.c >> @@ -205,6 +205,12 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage *message, >> char *recipients_string; >> const char *reply_to_string; >> void *local = talloc_new (sp); >> + GMimeHeaderList *header_list; > >> + GMimeHeader *header; > > could be dropped here and had only in scope where it is used below... > >> + const char* interesting_headers[] = { >> + "Maildir", "Mailing-list", "Tags", "Attachments", "Signature", >> + "Decryption", "User-agent", "X-Mailer"}; >> + const int interesting_header_count = sizeof(interesting_headers) / sizeof(char *); > > more "idiomatic" could be ... sizeof (interesting_headers) / sizeof (interesting_headers[0]); Yes, but please use ARRAY_SIZE() instead. ;) BR, Jani. > >> sp->begin_map (sp); >> >> @@ -255,6 +261,19 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage *message, >> sp->string (sp, g_mime_message_get_date_string (sp, message)); >> } >> >> + header_list = g_mime_object_get_header_list (GMIME_OBJECT(message)); > > two (2) spaces, then no space after GMIME_OBJECT > >> + >> + for (int i = 0; i < interesting_header_count; i++) { >> + > > ... here GMimeHeader *header; is only used > >> + header = g_mime_header_list_get_header( >> + header_list, interesting_headers[i]); >> + if (header == NULL) >> + continue; >> + >> + sp->map_key (sp, g_mime_header_get_name(header)); >> + sp->string (sp, g_mime_header_get_value(header)); > > spaces before '(' > >> + } >> + >> sp->end (sp); >> talloc_free (local); >> } >> -- >> 2.21.0 (Apple Git-122) >> >> _______________________________________________ >> notmuch mailing list >> notmuch@notmuchmail.org >> https://notmuchmail.org/mailman/listinfo/notmuch > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > https://notmuchmail.org/mailman/listinfo/notmuch