[PATCH v1 1/2] emacs: show: Align the colon in header display
David Edmondson
dme at dme.org
Wed Dec 28 04:18:24 PST 2016
When displaying headers, insert leading space so that the `:' in all
of the headers shown is aligned.
---
emacs/notmuch-show.el | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 364004b8..677405ba 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -345,11 +345,11 @@ operation on the contents of the current buffer."
(defun notmuch-show-fontify-header ()
(let ((face (cond
- ((looking-at "[Tt]o:")
+ ((looking-at " *[Tt]o:")
'message-header-to)
- ((looking-at "[Bb]?[Cc][Cc]:")
+ ((looking-at " *[Bb]?[Cc][Cc]:")
'message-header-cc)
- ((looking-at "[Ss]ubject:")
+ ((looking-at " *[Ss]ubject:")
'message-header-subject)
(t
'message-header-other))))
@@ -362,7 +362,7 @@ operation on the contents of the current buffer."
(defun notmuch-show-colour-headers ()
"Apply some colouring to the current headers."
(goto-char (point-min))
- (while (looking-at "^[A-Za-z][-A-Za-z0-9]*:")
+ (while (looking-at "^ *[A-Za-z][-A-Za-z0-9]*:")
(notmuch-show-fontify-header)
(forward-line)))
@@ -462,7 +462,8 @@ message at DEPTH in the current thread."
(defun notmuch-show-insert-header (header header-value)
"Insert a single header."
- (insert header ": " (notmuch-sanitize header-value) "\n"))
+ ;; `7' because `Subject' is the longest header.
+ (insert (format "%7s: %s\n" header (notmuch-sanitize header-value))))
(defun notmuch-show-insert-headers (headers)
"Insert the headers of the current message."
--
2.11.0
More information about the notmuch
mailing list