Re: [PATCH] emacs: notmuch-show-header-line: allow format strings and functions

Subject: Re: [PATCH] emacs: notmuch-show-header-line: allow format strings and functions

Date: Fri, 27 May 2022 01:26:03 +0100

To: David Bremner,


From: Jose A Ortega Ruiz

On Thu, May 26 2022, David Bremner wrote:

> jao <> writes:
>> If a string value is assigned to notmuch-show-header-line, it's used
>> as a format string to be passed passed to format-spec with `%s`
>> substituted by the message's subject.  If a function is given, it's
>> called with the subject as argument, and its return value used as
>> header line.
> The API defined here (function taking the subject as a string) seems a
> bit limited. What if the user wants to use some other message header in
> the header-line? Or list tags?

well, the function is called with the message buffer being current, so
it has access to all the message properties... we could even remove the
subject argument, but there's some convenient cleaning up on it that, i
think, makes it convenient.

> I would complain about missing test, but I think the test machinery
> works via buffer-substring-no-properties, which excludes header and
> mode lines.

yes, i didn't find an easy way of testing.

> On the other hand, it should be possible to update the manual, at
> least with a copy of the docstring.

yes, i'll add it once we settle on a final version.  one can play nice
tricks with this, such as returning a mode line format specification
from that function (since the result is assigned to the
header-line-format), and have an even more dynamic header (i put in
there an '(:eval fun-that-computes-thread-message-read/unread-counts) 

"It is easy to be blinded to the essential uselessness of computers by
the sense of accomplishment you get from getting them to work at all."
 - Douglas Adams
notmuch mailing list --
To unsubscribe send an email to