unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Protesilaos Stavrou <info@protesilaos.com>
To: notmuch@notmuchmail.org
Subject: [PATCH] emacs: use new face for notmuch-jump and related
Date: Fri, 21 May 2021 19:55:31 +0300	[thread overview]
Message-ID: <e5dcb5741c88c8281e3528f4ce21b8a8d06ddd93.1621615907.git.info@protesilaos.com> (raw)

The minibuffer-prompt face that was used before made it impossible to
differentiate between two distinct UI elements: (i) the prompt's text
which itself cannot be acted upon, (ii) the actionable keys used to
jump to searches/tags.

The use of a named face, notmuch-jump-key, makes it possible for users
or theme developers to apply properties that are specific to each of
those two cases.

In the interest of backward compatibility, the new face inherits from
minibuffer-prompt.
---
 NEWS                  | 4 ++++
 emacs/notmuch-jump.el | 9 +++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index c0ae6afe..83e42b44 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,10 @@ Emacs
 Restore the dynamically bound variables `tag-changes` and `query` in
 in `notmuch-before-tag-hook` and `notmuch-after-tag-hook`.
 
+Add `notmuch-jump-key` face to fontify keys in `notmuch-jump` and
+related functions.  To ensure backward compatibility, the new face
+inherits from `minibuffer-prompt`.
+
 Notmuch 0.32 (2021-05-02)
 =========================
 
diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
index 6fab5a79..e228c8a2 100644
--- a/emacs/notmuch-jump.el
+++ b/emacs/notmuch-jump.el
@@ -62,6 +62,11 @@ (defun notmuch-jump-search ()
       (error "To use notmuch-jump, %s"
 	     "please customize shortcut keys in notmuch-saved-searches."))))
 
+(defface notmuch-jump-key
+  '((t :inherit minibuffer-prompt))
+  "Default face used for keys in `notmuch-jump' and related."
+  :group 'notmuch-faces)
+
 (defvar notmuch-jump--action nil)
 
 ;;;###autoload
@@ -88,7 +93,7 @@ (defun notmuch-jump (action-map prompt)
 	    (buffer-string)))
 	 (full-prompt
 	  (concat table "\n\n"
-		  (propertize prompt 'face 'minibuffer-prompt)))
+		  (propertize prompt 'face 'notmuch-jump-key)))
 	 ;; By default, the minibuffer applies the minibuffer face to
 	 ;; the entire prompt.  However, we want to clearly
 	 ;; distinguish bindings (which we put in the prompt face
@@ -123,7 +128,7 @@ (defun notmuch-jump--format-actions (action-map)
     ;; Format each action
     (mapcar (pcase-lambda (`(,key ,desc))
 	      (setq key (format-kbd-macro key))
-	      (concat (propertize key 'face 'minibuffer-prompt)
+	      (concat (propertize key 'face 'notmuch-jump-key)
 		      (make-string (- key-width (length key)) ? )
 		      " " desc))
 	    action-map)))
-- 
2.31.1



-- 
Protesilaos Stavrou
https://protesilaos.com

             reply	other threads:[~2021-05-21 17:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21 16:55 Protesilaos Stavrou [this message]
2021-05-25 19:41 ` [PATCH] emacs: use new face for notmuch-jump and related Tomi Ollila
2021-05-25 19:53   ` Protesilaos Stavrou
2021-06-27 16:39 ` David Bremner
2021-06-27 17:29   ` Protesilaos Stavrou
2021-07-07 10:28     ` 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=e5dcb5741c88c8281e3528f4ce21b8a8d06ddd93.1621615907.git.info@protesilaos.com \
    --to=info@protesilaos.com \
    --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).