unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: jao <jao@gnu.org>
To: notmuch@notmuchmail.org
Cc: jao <jao@gnu.org>
Subject: [PATCH v2] emacs: make header line in notmuch-show buffers optional
Date: Mon, 10 Jan 2022 03:05:23 +0000	[thread overview]
Message-ID: <20220110030523.1225508-1-jao@gnu.org> (raw)

New notmuch-show-header-line customizable boolean to allow inhibiting
a header line in notmuch-show-mode buffers (for instance, because one
prefers to just include Subject in notmuch-message-headers).

---

Second version: includes a link to the new variable's docstring in
notmuch-show section of notmuch-emacs.rst

Signed-off-by: jao <jao@gnu.org>
---
 doc/notmuch-emacs.rst |  3 +++
 emacs/notmuch-show.el | 16 +++++++++++-----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst
index 22aee340..fed619b7 100644
--- a/doc/notmuch-emacs.rst
+++ b/doc/notmuch-emacs.rst
@@ -222,6 +222,9 @@ Display of messages can be controlled by the following variables
 :index:`notmuch-message-headers-visible`
        |docstring::notmuch-message-headers-visible|
 
+:index:`notmuch-show-header-line`
+       |docstring::notmuch-show-header-line|
+
 .. _show-copy:
 
 Copy to kill-ring
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 4de3e423..7c1f02c9 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -84,6 +84,11 @@ visible for any given message."
   :type 'boolean
   :group 'notmuch-show)
 
+(defcustom notmuch-show-header-line t
+  "Show a header line with the current message's subject."
+  :type 'boolean
+  :group 'notmuch-show)
+
 (defcustom notmuch-show-relative-dates t
   "Display relative dates in the message summary line."
   :type 'boolean
@@ -1345,11 +1350,12 @@ If no messages match the query return NIL."
       (notmuch-show-mapc
        (lambda () (notmuch-show-set-prop :orig-tags (notmuch-show-get-tags))))
       ;; Set the header line to the subject of the first message.
-      (setq header-line-format
-	    (replace-regexp-in-string "%" "%%"
-				      (notmuch-sanitize
-				       (notmuch-show-strip-re
-					(notmuch-show-get-subject)))))
+      (when notmuch-show-header-line
+	(setq header-line-format
+	      (replace-regexp-in-string "%" "%%"
+					(notmuch-sanitize
+					 (notmuch-show-strip-re
+					  (notmuch-show-get-subject))))))
       (run-hooks 'notmuch-show-hook)
       (if state
 	  (notmuch-show-apply-state state)
-- 
2.34.1

             reply	other threads:[~2022-01-10  3:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10  3:05 jao [this message]
2022-01-10 12:26 ` [PATCH v2] emacs: make header line in notmuch-show buffers optional 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=20220110030523.1225508-1-jao@gnu.org \
    --to=jao@gnu.org \
    --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).