unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH 1/6] emacs: update defcustom for notmuch-search-result-format.
Date: Sat, 16 Jul 2022 17:22:23 -0400	[thread overview]
Message-ID: <20220716212228.56432-2-david@tethera.net> (raw)
In-Reply-To: <20220716212228.56432-1-david@tethera.net>

It seems redundant to have the previous example, since the default
value is always show by describe variable.

Enforce more restrictions on the keys in the alist, since arbitrary
strings don't work as field names.

Document that functions can be used in lieu of field names.
---
 emacs/notmuch.el | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 01a92997..5cb7acd2 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -90,11 +90,11 @@
     ("tags" . "(%s)"))
   "Search result formatting.
 
-Supported fields are: date, count, authors, subject, tags.
-For example:
-    (setq notmuch-search-result-format
-          \\='((\"authors\" . \"%-40s\")
-            (\"subject\" . \"%s\")))
+List of pairs of (field . format-string).  Supported field
+strings are: \"date\", \"count\", \"authors\", \"subject\",
+\"tags\".  It is also supported to pass a function in place of a
+field name. In this case the function is passed the thread
+object (plist) and format string.
 
 Line breaks are permitted in format strings (though this is
 currently experimental).  Note that a line break at the end of an
@@ -102,7 +102,16 @@ currently experimental).  Note that a line break at the end of an
 place it instead at the beginning of the following field.  To
 enter a line break when setting this variable with setq, use \\n.
 To enter a line break in customize, press \\[quoted-insert] C-j."
-  :type '(alist :key-type string :value-type string)
+  :type '(alist
+	  :key-type
+	  (choice
+	   (const :tag "Date" "date")
+	   (const :tag "Count" "count")
+	   (const :tag "Authors" "authors")
+	   (const :tag "Subject" "subject")
+	   (const :tag "Tags" "tags")
+	   function)
+	  :value-type (string :tag "Format"))
   :group 'notmuch-search)
 
 ;; The name of this variable `notmuch-init-file' is consistent with the
-- 
2.35.1

  reply	other threads:[~2022-07-16 21:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-16 21:22 update documentation for notmuch-*-result-format David Bremner
2022-07-16 21:22 ` David Bremner [this message]
2022-07-16 21:22 ` [PATCH 2/6] doc/emacs: add docstring and example for n-search-result-format David Bremner
2022-07-16 21:22 ` [PATCH 3/6] emacs: update defcustom for notmuch-search-result-format David Bremner
2022-07-16 21:22 ` [PATCH 4/6] doc/emacs: add docstring and example for n-tree-result-format David Bremner
2022-07-16 21:22 ` [PATCH 5/6] emacs: update defcustom for notmuch-unthreaded-result-format David Bremner
2022-07-16 21:22 ` [PATCH 6/6] doc/emacs: add docstring " David Bremner
2022-07-30 12:15   ` 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=20220716212228.56432-2-david@tethera.net \
    --to=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).