unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jose A Ortega Ruiz <jao@gnu.org>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Subject: Re: [PATCH] emacs: notmuch-show-header-line: allow format strings and functions
Date: Fri, 27 May 2022 01:26:03 +0100	[thread overview]
Message-ID: <87czfzg6sk.fsf@gnus.jao.io> (raw)
In-Reply-To: <87zgj34zuf.fsf@tethera.net>

On Thu, May 26 2022, David Bremner wrote:

> jao <jao@gnu.org> 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) 
one)...

cheers,
jao
-- 
"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

  reply	other threads:[~2022-05-27 10:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18 19:29 notmuch-show-header-line: allow format strings and functions jao
2022-05-18 19:29 ` [PATCH] emacs: " jao
2022-05-26 23:51   ` David Bremner
2022-05-27  0:26     ` Jose A Ortega Ruiz [this message]
2022-06-01  9:26       ` David Bremner
2022-06-01  9:56         ` Jose A Ortega Ruiz
2022-06-01 10:25           ` David Bremner
2022-06-01 10:34             ` Jose A Ortega Ruiz
2022-06-01 11:39               ` David Bremner

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=87czfzg6sk.fsf@gnus.jao.io \
    --to=jao@gnu.org \
    --cc=david@tethera.net \
    --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).