unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Edmondson <dme@dme.org>
To: notmuch@notmuchmail.org
Subject: [PATCH v1 1/2] emacs: show: Align the colon in header display
Date: Wed, 28 Dec 2016 12:18:24 +0000	[thread overview]
Message-ID: <20161228121825.11265-2-dme@dme.org> (raw)
In-Reply-To: <20161228121825.11265-1-dme@dme.org>

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

  reply	other threads:[~2016-12-28 12:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-28 12:18 [RFC] [PATCH v1 0/2] Improve the display of headers David Edmondson
2016-12-28 12:18 ` David Edmondson [this message]
2016-12-28 12:18 ` [PATCH v1 2/2] emacs: show: Wrap headers for display David Edmondson
2016-12-29 13:52 ` [RFC] [PATCH v1 0/2] Improve the display of headers David Bremner
2016-12-29 17:02   ` David Edmondson
2016-12-30  5:03     ` David Bremner
2016-12-30 12:10       ` David Edmondson
2017-01-05 15:28 ` Servilio Afre Puentes
2017-01-05 15:36   ` David Edmondson

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=20161228121825.11265-2-dme@dme.org \
    --to=dme@dme.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).