unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH v2] emacs: make header line in notmuch-show buffers optional
@ 2022-01-10  3:05 jao
  2022-01-10 12:26 ` David Bremner
  0 siblings, 1 reply; 2+ messages in thread
From: jao @ 2022-01-10  3:05 UTC (permalink / raw)
  To: notmuch; +Cc: jao

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] emacs: make header line in notmuch-show buffers optional
  2022-01-10  3:05 [PATCH v2] emacs: make header line in notmuch-show buffers optional jao
@ 2022-01-10 12:26 ` David Bremner
  0 siblings, 0 replies; 2+ messages in thread
From: David Bremner @ 2022-01-10 12:26 UTC (permalink / raw)
  To: jao, notmuch; +Cc: jao

jao <jao@gnu.org> writes:

> 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

applied to master

d

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-10 12:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-10  3:05 [PATCH v2] emacs: make header line in notmuch-show buffers optional jao
2022-01-10 12:26 ` David Bremner

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).