unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: use new face for notmuch-jump and related
@ 2021-05-21 16:55 Protesilaos Stavrou
  2021-05-25 19:41 ` Tomi Ollila
  2021-06-27 16:39 ` David Bremner
  0 siblings, 2 replies; 6+ messages in thread
From: Protesilaos Stavrou @ 2021-05-21 16:55 UTC (permalink / raw)
  To: notmuch

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

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

* Re: [PATCH] emacs: use new face for notmuch-jump and related
  2021-05-21 16:55 [PATCH] emacs: use new face for notmuch-jump and related Protesilaos Stavrou
@ 2021-05-25 19:41 ` Tomi Ollila
  2021-05-25 19:53   ` Protesilaos Stavrou
  2021-06-27 16:39 ` David Bremner
  1 sibling, 1 reply; 6+ messages in thread
From: Tomi Ollila @ 2021-05-25 19:41 UTC (permalink / raw)
  To: Protesilaos Stavrou, notmuch

On Fri, May 21 2021, Protesilaos Stavrou wrote:

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

This looks like a good change. How does one test this
and see the difference?

Tomi

> ---
>  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
> _______________________________________________
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-leave@notmuchmail.org

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

* Re: [PATCH] emacs: use new face for notmuch-jump and related
  2021-05-25 19:41 ` Tomi Ollila
@ 2021-05-25 19:53   ` Protesilaos Stavrou
  0 siblings, 0 replies; 6+ messages in thread
From: Protesilaos Stavrou @ 2021-05-25 19:53 UTC (permalink / raw)
  To: Tomi Ollila; +Cc: notmuch

On 2021-05-25, 22:41 +0300, Tomi Ollila <tomi.ollila@iki.fi> wrote:

> On Fri, May 21 2021, Protesilaos Stavrou wrote:
>
>> 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.
>
> This looks like a good change. How does one test this
> and see the difference?
>
> Tomi

Hello Tomi!

By default there will be no visual difference with how it was before.
Just so that we do not upset existing users.

Something like this can be used to change the new face (for demo
purposes):

(set-face-attribute 'notmuch-jump-key nil :background "blue" :foreground "white" :weight 'bold)

All the best,
Prot


-- 
Protesilaos Stavrou
https://protesilaos.com

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

* Re: [PATCH] emacs: use new face for notmuch-jump and related
  2021-05-21 16:55 [PATCH] emacs: use new face for notmuch-jump and related Protesilaos Stavrou
  2021-05-25 19:41 ` Tomi Ollila
@ 2021-06-27 16:39 ` David Bremner
  2021-06-27 17:29   ` Protesilaos Stavrou
  1 sibling, 1 reply; 6+ messages in thread
From: David Bremner @ 2021-06-27 16:39 UTC (permalink / raw)
  To: Protesilaos Stavrou, notmuch

Protesilaos Stavrou <info@protesilaos.com> writes:

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

applied to master, thanks

d

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

* Re: [PATCH] emacs: use new face for notmuch-jump and related
  2021-06-27 16:39 ` David Bremner
@ 2021-06-27 17:29   ` Protesilaos Stavrou
  2021-07-07 10:28     ` David Bremner
  0 siblings, 1 reply; 6+ messages in thread
From: Protesilaos Stavrou @ 2021-06-27 17:29 UTC (permalink / raw)
  To: David Bremner, notmuch

[-- Attachment #1: Type: text/plain, Size: 522 bytes --]

On 2021-06-27, 13:39 -0300, David Bremner <david@tethera.net> wrote:

> Protesilaos Stavrou <info@protesilaos.com> writes:
>
>> 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.
>>
>
> applied to master, thanks

You are welcome!  I just noticed a mistake from my side.  Please refer
to the attached patch.  Shall I start a new thread of will this one
suffice?

-- 
Protesilaos Stavrou
https://protesilaos.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Amend-commit-5cc106b0-about-notmuch-jump-key-face.patch --]
[-- Type: text/x-patch, Size: 1244 bytes --]

From 7a83f7e978ab47ebd75438af3ede6280c870f529 Mon Sep 17 00:00:00 2001
Message-Id: <7a83f7e978ab47ebd75438af3ede6280c870f529.1624814747.git.info@protesilaos.com>
From: Protesilaos Stavrou <info@protesilaos.com>
Date: Sun, 27 Jun 2021 20:25:26 +0300
Subject: [PATCH] Amend commit 5cc106b0 about notmuch-jump-key face

The intent of that face is to allow users/themes to differentiate the
text of the minibuffer prompt from the keys that are associated with
jump actions.  Commit 5cc106b0 correctly introduced the new
'notmuch-jump-key' face for keys, but mistakenly applied it to the
prompt as well.
---
 emacs/notmuch-jump.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
index e228c8a2..5ec8eb9c 100644
--- a/emacs/notmuch-jump.el
+++ b/emacs/notmuch-jump.el
@@ -93,7 +93,7 @@ (defun notmuch-jump (action-map prompt)
 	    (buffer-string)))
 	 (full-prompt
 	  (concat table "\n\n"
-		  (propertize prompt 'face 'notmuch-jump-key)))
+		  (propertize prompt 'face 'minibuffer-prompt)))
 	 ;; 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
-- 
2.32.0


[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



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

* Re: [PATCH] emacs: use new face for notmuch-jump and related
  2021-06-27 17:29   ` Protesilaos Stavrou
@ 2021-07-07 10:28     ` David Bremner
  0 siblings, 0 replies; 6+ messages in thread
From: David Bremner @ 2021-07-07 10:28 UTC (permalink / raw)
  To: Protesilaos Stavrou, notmuch

Protesilaos Stavrou <info@protesilaos.com> writes:

> On 2021-06-27, 13:39 -0300, David Bremner <david@tethera.net> wrote:
>
>> Protesilaos Stavrou <info@protesilaos.com> writes:
>>
>>> 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.
>>>
>>
>> applied to master, thanks
>
> You are welcome!  I just noticed a mistake from my side.  Please refer
> to the attached patch.  Shall I start a new thread of will this one
> suffice?

I guess you should start a new thread. Please use a more informative
patch subject; you can mention the commit you are updating in the body
of the commit message. I would avoid the word "amend" because that has a
specific technical meaning in the context of git, and we're not going to
rewrite published history.

Thanks

David

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

end of thread, other threads:[~2021-07-07 10:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-21 16:55 [PATCH] emacs: use new face for notmuch-jump and related Protesilaos Stavrou
2021-05-25 19:41 ` 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

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