Re: configurable summary line for notmuch search

Subject: Re: configurable summary line for notmuch search

Date: Sat, 28 Aug 2021 22:30:59 +0100

To: David Bremner,


From: Jose Antonio Ortega Ruiz

On Sat, Aug 28 2021, David Bremner wrote:

> I was idly thinking about how to provide custom summary formats for
> notmuch-search. I know this has been discussed a few times on IRC, but I
> can't remember the kind of things people were looking for. So if this a
> feature you're interested in, what specifically are you looking for?

I actually have a patch in my queue that implements a form of this, in
two ways.  By allowing the "field" to be a function that gets called with
the message property and returns a string, and by allowing the format
string to be a function that takes the value of the field and further
formats it.  This is the relevant patch with simple examples in the

and this is an example of how i use it to have a marker in my result
lists that tells me if i'm the recipient of the displayed email and to
trunctate the subject to a maximum length:

      (setq notmuch-tree-result-format
            '(("date" . "%12s  ")
              ("authors" . "%-35s")
              ("subject" . jao-notmuch-truncate)
              ("tags" . "  (%s)")))

      (defun jao-notmuch-msg-ticks (msg)
        (let ((headers (plist-get msg :headers)))
          (cond ((string-match-p jao-mails-regexp (or (plist-get headers :To) ""))
                 (propertize " »" 'face 'notmuch-tree-match-tree-face))
                ((string-match-p jao-mails-regexp (or (plist-get headers :Cc) ""))
                 (propertize " ¬" 'face 'notmuch-tree-match-tree-face))
                (t "  "))))

      (defun jao-notmuch-truncate (x)
        (truncate-string-to-width (format "%-102s" x) 102 nil nil t))

what do you think?

I never lose sight of the fact that just being is fun.
  -Katharine Hepburn, actress (1907-2003)
notmuch mailing list --
To unsubscribe send an email to