emacs: make header line in notmuch-show buffers optional

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).
This commit is contained in:
jao 2022-01-10 03:05:23 +00:00 committed by David Bremner
parent 63d3b2b5cf
commit 332b3b639e
2 changed files with 14 additions and 5 deletions

View file

@ -222,6 +222,9 @@ Display of messages can be controlled by the following variables
:index:`notmuch-message-headers-visible` :index:`notmuch-message-headers-visible`
|docstring::notmuch-message-headers-visible| |docstring::notmuch-message-headers-visible|
:index:`notmuch-show-header-line`
|docstring::notmuch-show-header-line|
.. _show-copy: .. _show-copy:
Copy to kill-ring Copy to kill-ring

View file

@ -84,6 +84,11 @@ visible for any given message."
:type 'boolean :type 'boolean
:group 'notmuch-show) :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 (defcustom notmuch-show-relative-dates t
"Display relative dates in the message summary line." "Display relative dates in the message summary line."
:type 'boolean :type 'boolean
@ -1345,11 +1350,12 @@ If no messages match the query return NIL."
(notmuch-show-mapc (notmuch-show-mapc
(lambda () (notmuch-show-set-prop :orig-tags (notmuch-show-get-tags)))) (lambda () (notmuch-show-set-prop :orig-tags (notmuch-show-get-tags))))
;; Set the header line to the subject of the first message. ;; Set the header line to the subject of the first message.
(setq header-line-format (when notmuch-show-header-line
(replace-regexp-in-string "%" "%%" (setq header-line-format
(notmuch-sanitize (replace-regexp-in-string "%" "%%"
(notmuch-show-strip-re (notmuch-sanitize
(notmuch-show-get-subject))))) (notmuch-show-strip-re
(notmuch-show-get-subject))))))
(run-hooks 'notmuch-show-hook) (run-hooks 'notmuch-show-hook)
(if state (if state
(notmuch-show-apply-state state) (notmuch-show-apply-state state)