GNU bug report logs - #21112
25; Patch: show minibuffer messages with a face

Previous Next

Package: emacs;

Reported by: Raffaele Ricciardi <rfflrccrd <at> gmail.com>

Date: Wed, 22 Jul 2015 12:49:02 UTC

Severity: wishlist

Tags: patch

Fixed in version 27.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 21112 in the body.
You can then email your comments to 21112 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#21112; Package emacs. (Wed, 22 Jul 2015 12:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Raffaele Ricciardi <rfflrccrd <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 22 Jul 2015 12:49:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Raffaele Ricciardi <rfflrccrd <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25; Patch: show minibuffer messages with a face
Date: Wed, 22 Jul 2015 14:46:49 +0200
[Message part 1 (text/plain, inline)]
Dear GNU Emacs maintainers,

this patch against the Git repository makes the minibuffer messages
appear with the same face as the minibuffer prompt, to make them more
visually distinguished from user input.

Thanks for your attention.
Best Regards
[0001-minibuffer.el-Make-minibuffer-message-use-minibuffer.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21112; Package emacs. (Wed, 22 Jul 2015 13:43:02 GMT) Full text and rfc822 format available.

Message #8 received at 21112 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Raffaele Ricciardi <rfflrccrd <at> gmail.com>, 21112 <at> debbugs.gnu.org
Subject: RE: bug#21112: 25; Patch: show minibuffer messages with a face
Date: Wed, 22 Jul 2015 06:42:24 -0700 (PDT)
> this patch against the Git repository makes the minibuffer messages
> appear with the same face as the minibuffer prompt, to make them
> more visually distinguished from user input.

FWIW, I hope this does not get applied in general.

Currently, *users* have control over the faces used in message
echoes.  It should remain that way.  It is trivial for user code
to control the output appearance now.  Let's not mess this up.

In fact, we should not even apply a face by default to the prompt.
That was a step backward (misguided), IMHO.  If a user (or library)
wants something different (other than customizing the prompt face,
which still gives the same appearance to the whole prompt), then
s?he now needs to fiddle.

Shouldn't be necessary.  We should have just left things
unhighlighted by default, letting users themselves (again,
trivially) propertize the prompt string any way they want.

Doing the kind of thing suggested by this enhancement request
does not add a feature.  It takes away a feature.  We already,
everyone, have the ability to propertize messages in any way
we like.  If you want them all to have face `minibuffer-prompt'
then you can accomplish that trivially - for your own use.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21112; Package emacs. (Wed, 22 Jul 2015 13:46:02 GMT) Full text and rfc822 format available.

Message #11 received at 21112 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Raffaele Ricciardi <rfflrccrd <at> gmail.com>, 21112 <at> debbugs.gnu.org
Subject: RE: bug#21112: 25; Patch: show minibuffer messages with a face
Date: Wed, 22 Jul 2015 06:44:50 -0700 (PDT)
I haven't looked at the patch, and I misread the request as applying
to `message' output, not `minibuffer-message'.  But I have the same
response in the latter case - leave it alone, so users can do with
it what they like.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21112; Package emacs. (Wed, 22 Jul 2015 15:28:02 GMT) Full text and rfc822 format available.

Message #14 received at 21112 <at> debbugs.gnu.org (full text, mbox):

From: Raffaele Ricciardi <rfflrccrd <at> gmail.com>
To: Drew Adams <drew.adams <at> oracle.com>, 21112 <at> debbugs.gnu.org
Subject: Re: bug#21112: 25; Patch: show minibuffer messages with a face
Date: Wed, 22 Jul 2015 17:27:47 +0200
On 22/07/15 15:44, Drew Adams wrote:
> I haven't looked at the patch, and I misread the request as applying
> to `message' output, not `minibuffer-message'. But I have the same
> response in the latter case - leave it alone, so users can do with
> it what they like.

I understand what you mean and I agree when you say that the current
implementation is more flexible.  The problem that this patch tries to
solve is that -- as far as I can see -- all Emacs messages are
currently passed as plain strings, and thus appear in the same face as
user input, making it seem that Emacs is meddling with user input,
which is not the case.  Now, requiring callers to specify a face for
every single message would be burdensome, wouldn't it?  Maybe, could
we make `minibuffer-message' apply the `minibuffer-prompt' face only
if the message lacks its own faces?  Or maybe, could we split
`minibuffer-message' in two functions, one -- internal -- that applies
the `minibuffer-prompt' face and one that doesn't?  The same approach
could be applied to the minibuffer prompt, too.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21112; Package emacs. (Wed, 22 Jul 2015 15:43:01 GMT) Full text and rfc822 format available.

Message #17 received at 21112 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Raffaele Ricciardi <rfflrccrd <at> gmail.com>, 21112 <at> debbugs.gnu.org
Subject: RE: bug#21112: 25; Patch: show minibuffer messages with a face
Date: Wed, 22 Jul 2015 08:42:44 -0700 (PDT)
> > I haven't looked at the patch, and I misread the request as
> applying
> > to `message' output, not `minibuffer-message'. But I have the same
> > response in the latter case - leave it alone, so users can do with
> > it what they like.
> 
> I understand what you mean and I agree when you say that the current
> implementation is more flexible.  The problem that this patch tries
> to
> solve is that -- as far as I can see -- all Emacs messages are
> currently passed as plain strings, and thus appear in the same face
> as
> user input, making it seem that Emacs is meddling with user input,
> which is not the case.  Now, requiring callers to specify a face for
> every single message would be burdensome, wouldn't it?  Maybe, could
> we make `minibuffer-message' apply the `minibuffer-prompt' face only
> if the message lacks its own faces?  Or maybe, could we split
> `minibuffer-message' in two functions, one -- internal -- that
> applies
> the `minibuffer-prompt' face and one that doesn't?  The same
> approach
> could be applied to the minibuffer prompt, too.

I hear you, but I would (still) say leave it alone.

It is not just that the string that might already have faces.
A user can have a standalone minibuffer with a default face, etc.

YAGNI - my 2 cents




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21112; Package emacs. (Tue, 23 Feb 2016 09:35:01 GMT) Full text and rfc822 format available.

Message #20 received at 21112 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Raffaele Ricciardi <rfflrccrd <at> gmail.com>
Cc: 21112 <at> debbugs.gnu.org
Subject: Re: bug#21112: 25; Patch: show minibuffer messages with a face
Date: Tue, 23 Feb 2016 20:34:24 +1100
Raffaele Ricciardi <rfflrccrd <at> gmail.com> writes:

> Dear GNU Emacs maintainers,
>
> this patch against the Git repository makes the minibuffer messages
> appear with the same face as the minibuffer prompt, to make them more
> visually distinguished from user input.

[...]

>      (when args (setq message (apply 'format message args)))
> +    (setq message (propertize message 'face 'minibuffer-prompt))

I think it might be a good idea to use a different face for these
temporary messages, but you can currently do this:

(minibuffer-message (propertize "Foo" 'face 'bold))

And overwriting the specified face isn't a good idea.  But perhaps it
could apply a default face to the string if no face has already been
set?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21112; Package emacs. (Tue, 25 Jun 2019 15:51:02 GMT) Full text and rfc822 format available.

Message #23 received at 21112 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Raffaele Ricciardi <rfflrccrd <at> gmail.com>
Cc: 21112 <at> debbugs.gnu.org
Subject: Re: bug#21112: 25; Patch: show minibuffer messages with a face
Date: Tue, 25 Jun 2019 17:50:50 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

>>      (when args (setq message (apply 'format message args)))
>> +    (setq message (propertize message 'face 'minibuffer-prompt))
>
> I think it might be a good idea to use a different face for these
> temporary messages, but you can currently do this:
>
> (minibuffer-message (propertize "Foo" 'face 'bold))

So I don't think this is something that we want; closing the bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 25 Jun 2019 15:51:03 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 21112 <at> debbugs.gnu.org and Raffaele Ricciardi <rfflrccrd <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 25 Jun 2019 15:51:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21112; Package emacs. (Tue, 25 Jun 2019 20:11:01 GMT) Full text and rfc822 format available.

Message #30 received at 21112 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 21112 <at> debbugs.gnu.org, Raffaele Ricciardi <rfflrccrd <at> gmail.com>
Subject: Re: bug#21112: 25; Patch: show minibuffer messages with a face
Date: Tue, 25 Jun 2019 22:47:06 +0300
[Message part 1 (text/plain, inline)]
>>>      (when args (setq message (apply 'format message args)))
>>> +    (setq message (propertize message 'face 'minibuffer-prompt))
>>
>> I think it might be a good idea to use a different face for these
>> temporary messages, but you can currently do this:
>>
>> (minibuffer-message (propertize "Foo" 'face 'bold))
>
> So I don't think this is something that we want; closing the bug report.

For consistency with isearch messages that are highlighted with the
minibuffer-prompt face, minibuffer-message needs to do the same.

But since a message is displayed at different part of the minibuffer,
it should be highlighted using a new separate customizable variable
similar to minibuffer-prompt-properties:

[minibuffer-message-properties.patch (text/x-diff, inline)]
diff --git a/lisp/isearch.el b/lisp/isearch.el
index bb29c2914b..b527a210ac 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1996,7 +1996,7 @@ isearch--momentary-message
     (message "%s%s%s"
              (isearch-message-prefix nil isearch-nonincremental)
              isearch-message
-             (propertize (format " [%s]" string) 'face 'minibuffer-prompt)))
+             (apply #'propertize (format " [%s]" string) minibuffer-message-properties)))
   (sit-for 1))
 
 (isearch-define-mode-toggle lax-whitespace " " nil
@@ -3200,18 +3200,18 @@ isearch-message-prefix
 			(concat " [" current-input-method-title "]: "))
 		     ": ")
 		   )))
-    (propertize (concat (isearch-lazy-count-format)
+    (apply #'propertize (concat (isearch-lazy-count-format)
                         (upcase (substring m 0 1)) (substring m 1))
-		'face 'minibuffer-prompt)))
+	   minibuffer-message-properties)))
 
 (defun isearch-message-suffix (&optional c-q-hack)
-  (propertize (concat (if c-q-hack "^Q" "")
+  (apply #'propertize (concat (if c-q-hack "^Q" "")
 		      (isearch-lazy-count-format 'suffix)
 		      (if isearch-error
 			  (concat " [" isearch-error "]")
 			"")
 		      (or isearch-message-suffix-add ""))
-	      'face 'minibuffer-prompt))
+	 minibuffer-message-properties))
 
 (defun isearch-lazy-count-format (&optional suffix-p)
   "Format the current match number and the total number of matches.
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 57702760fb..5f3986697b 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -693,6 +693,9 @@ minibuffer
   :link '(custom-manual "(emacs)Minibuffer")
   :group 'environment)
 
+(defvar minibuffer-message-properties minibuffer-prompt-properties
+  "Text properties that are added to minibuffer messages.")
+
 (defun minibuffer-message (message &rest args)
   "Temporarily display MESSAGE at the end of the minibuffer.
 The text is displayed for `minibuffer-message-timeout' seconds,
@@ -714,6 +717,7 @@ minibuffer-message
                       (copy-sequence message)
                     (concat " [" message "]")))
     (when args (setq message (apply #'format-message message args)))
+    (setq message (apply #'propertize message minibuffer-message-properties))
     (let ((ol (make-overlay (point-max) (point-max) nil t t))
           ;; A quit during sit-for normally only interrupts the sit-for,
           ;; but since minibuffer-message is used at the end of a command,

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21112; Package emacs. (Tue, 25 Jun 2019 20:44:02 GMT) Full text and rfc822 format available.

Message #33 received at 21112 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 21112 <at> debbugs.gnu.org, Raffaele Ricciardi <rfflrccrd <at> gmail.com>
Subject: Re: bug#21112: 25; Patch: show minibuffer messages with a face
Date: Tue, 25 Jun 2019 22:43:30 +0200
Juri Linkov <juri <at> linkov.net> writes:

>>> I think it might be a good idea to use a different face for these
>>> temporary messages, but you can currently do this:
>>>
>>> (minibuffer-message (propertize "Foo" 'face 'bold))
>>
>> So I don't think this is something that we want; closing the bug report.
>
> For consistency with isearch messages that are highlighted with the
> minibuffer-prompt face, minibuffer-message needs to do the same.

[...]

> +    (setq message (apply #'propertize message minibuffer-message-properties))

But this will overwrite the face properties the caller has set, right?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21112; Package emacs. (Tue, 25 Jun 2019 20:55:02 GMT) Full text and rfc822 format available.

Message #36 received at 21112 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Juri Linkov <juri <at> linkov.net>, Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 21112 <at> debbugs.gnu.org, Raffaele Ricciardi <rfflrccrd <at> gmail.com>
Subject: RE: bug#21112: 25; Patch: show minibuffer messages with a face
Date: Tue, 25 Jun 2019 13:54:10 -0700 (PDT)
> For consistency with isearch messages that are highlighted with the
> minibuffer-prompt face, minibuffer-message needs to do the same.

Neither Isearch prompts nor `minibuffer-message' output
should be highlighted with face `minibuffer-prompt'.

Isearch doesn't use the minibuffer.
And `minibuffer-message' is not a prompt.

> But since a message is displayed at different part of the minibuffer,
> it should be highlighted using a new separate customizable variable
> similar to minibuffer-prompt-properties:

1. If you go that route, which lets libraries and
users easily change the properties (good), please
separate Isearch and `minibuffer-message'.  Use two
different variables.  They are not the same species.

The default value could be, but it need not be,
the same for both.

On the other hand, it could be helpful to separate
out property `face', defining an actual face (for
each of Isearch and `minibuffer-message') that
users can customize for this.  That also has the
benefit that one can inherit from one to the other.

The other properties would be applied first, so that
if `face' is among them for some reason it will be
overridden by the face provided specifically for this.

2. The doc string of `minibuffer-message-properties'
should not say that the properties are added to
"minibuffer messages" - that's too broad.  It should
say that they are added to the text shown by function
`minibuffer-message' - or else describe that text,
and only that text, in another way.

The doc string of the similar variable for Isearch
should say that the properties are added to "the
search prompt" or some such.  Not sure whether the
right description is "prompt", but whatever is the
best way to describe it should be used in the doc
string.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21112; Package emacs. (Wed, 26 Jun 2019 21:38:02 GMT) Full text and rfc822 format available.

Message #39 received at 21112 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 21112 <at> debbugs.gnu.org, Raffaele Ricciardi <rfflrccrd <at> gmail.com>
Subject: Re: bug#21112: 25; Patch: show minibuffer messages with a face
Date: Thu, 27 Jun 2019 00:28:06 +0300
[Message part 1 (text/plain, inline)]
>>>> I think it might be a good idea to use a different face for these
>>>> temporary messages, but you can currently do this:
>>>>
>>>> (minibuffer-message (propertize "Foo" 'face 'bold))
>>>
>>> So I don't think this is something that we want; closing the bug report.
>>
>> For consistency with isearch messages that are highlighted with the
>> minibuffer-prompt face, minibuffer-message needs to do the same.
>
> [...]
>
>> +    (setq message (apply #'propertize message minibuffer-message-properties))
>
> But this will overwrite the face properties the caller has set, right?

This patch checks for existing face properties to not overwrite them:

[minibuffer-message-properties.3.patch (text/x-diff, inline)]
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 57702760fb..9a473b6867 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -714,6 +717,9 @@ minibuffer-message
                       (copy-sequence message)
                     (concat " [" message "]")))
     (when args (setq message (apply #'format-message message args)))
+    ;; If not already propertized:
+    (unless (or (text-properties-at 0 message) (next-property-change 0 message))
+      (setq message (apply #'propertize message minibuffer-message-properties)))
     (let ((ol (make-overlay (point-max) (point-max) nil t t))
           ;; A quit during sit-for normally only interrupts the sit-for,
           ;; but since minibuffer-message is used at the end of a command,

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21112; Package emacs. (Wed, 26 Jun 2019 21:38:02 GMT) Full text and rfc822 format available.

Message #42 received at 21112 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>,
 Raffaele Ricciardi <rfflrccrd <at> gmail.com>, 21112 <at> debbugs.gnu.org
Subject: Re: bug#21112: 25; Patch: show minibuffer messages with a face
Date: Thu, 27 Jun 2019 00:30:33 +0300
[Message part 1 (text/plain, inline)]
>> But since a message is displayed at different part of the minibuffer,
>> it should be highlighted using a new separate customizable variable
>> similar to minibuffer-prompt-properties:
>
> 1. If you go that route, which lets libraries and
> users easily change the properties (good), please
> separate Isearch and `minibuffer-message'.  Use two
> different variables.  They are not the same species.
>
> The default value could be, but it need not be,
> the same for both.

OK, implemented in the following patch.

> On the other hand, it could be helpful to separate
> out property `face', defining an actual face (for
> each of Isearch and `minibuffer-message') that
> users can customize for this.  That also has the
> benefit that one can inherit from one to the other.
>
> The other properties would be applied first, so that
> if `face' is among them for some reason it will be
> overridden by the face provided specifically for this.

There are already too many faces in M-x list-faces-display
for users to comprehend that adding three more faces with
the same color would make matters worse.

> 2. The doc string of `minibuffer-message-properties'
> should not say that the properties are added to
> "minibuffer messages" - that's too broad.  It should
> say that they are added to the text shown by function
> `minibuffer-message' - or else describe that text,
> and only that text, in another way.

OK, fixed in the attached patch.

> The doc string of the similar variable for Isearch
> should say that the properties are added to "the
> search prompt" or some such.  Not sure whether the
> right description is "prompt", but whatever is the
> best way to describe it should be used in the doc
> string.

OK, added to this patch:

[minibuffer-message-properties.2.patch (text/x-diff, inline)]
diff --git a/lisp/isearch.el b/lisp/isearch.el
index f150a3bba4..94c30eb57b 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1992,13 +1992,17 @@ isearch-define-mode-toggle
   (setq isearch-regexp (not isearch-regexp))
   (if isearch-regexp (setq isearch-regexp-function nil)))
 
+(defvar isearch-message-properties minibuffer-prompt-properties
+  "Text properties that are added to the isearch prompt.")
+
 (defun isearch--momentary-message (string)
   "Print STRING at the end of the isearch prompt for 1 second"
   (let ((message-log-max nil))
     (message "%s%s%s"
              (isearch-message-prefix nil isearch-nonincremental)
              isearch-message
-             (propertize (format " [%s]" string) 'face 'minibuffer-prompt)))
+             (apply #'propertize (format " [%s]" string)
+                    isearch-message-properties)))
   (sit-for 1))
 
 (isearch-define-mode-toggle lax-whitespace " " nil
@@ -3202,18 +3206,18 @@ isearch-message-prefix
 			(concat " [" current-input-method-title "]: "))
 		     ": ")
 		   )))
-    (propertize (concat (isearch-lazy-count-format)
+    (apply #'propertize (concat (isearch-lazy-count-format)
                         (upcase (substring m 0 1)) (substring m 1))
-		'face 'minibuffer-prompt)))
+	   isearch-message-properties)))
 
 (defun isearch-message-suffix (&optional c-q-hack)
-  (propertize (concat (if c-q-hack "^Q" "")
+  (apply #'propertize (concat (if c-q-hack "^Q" "")
 		      (isearch-lazy-count-format 'suffix)
 		      (if isearch-error
 			  (concat " [" isearch-error "]")
 			"")
 		      (or isearch-message-suffix-add ""))
-	      'face 'minibuffer-prompt))
+	 isearch-message-properties))
 
 (defun isearch-lazy-count-format (&optional suffix-p)
   "Format the current match number and the total number of matches.
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 57702760fb..9a473b6867 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -693,6 +693,9 @@ minibuffer
   :link '(custom-manual "(emacs)Minibuffer")
   :group 'environment)
 
+(defvar minibuffer-message-properties minibuffer-prompt-properties
+  "Text properties added to the text shown by `minibuffer-message'.")
+
 (defun minibuffer-message (message &rest args)
   "Temporarily display MESSAGE at the end of the minibuffer.
 The text is displayed for `minibuffer-message-timeout' seconds,

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21112; Package emacs. (Wed, 26 Jun 2019 22:14:01 GMT) Full text and rfc822 format available.

Message #45 received at 21112 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>,
 Raffaele Ricciardi <rfflrccrd <at> gmail.com>, 21112 <at> debbugs.gnu.org
Subject: RE: bug#21112: 25; Patch: show minibuffer messages with a face
Date: Wed, 26 Jun 2019 15:13:00 -0700 (PDT)
> >> But since a message is displayed at different part of the minibuffer,
> >> it should be highlighted using a new separate customizable variable
> >> similar to minibuffer-prompt-properties:
> >
> > 1. If you go that route, which lets libraries and
> > users easily change the properties (good), please
> > separate Isearch and `minibuffer-message'.  Use two
> > different variables.  They are not the same species.
> >
> > The default value could be, but it need not be,
> > the same for both.
> 
> OK, implemented in the following patch.
> 
> > On the other hand, it could be helpful to separate
> > out property `face', defining an actual face (for
> > each of Isearch and `minibuffer-message') that
> > users can customize for this.  That also has the
> > benefit that one can inherit from one to the other.
> >
> > The other properties would be applied first, so that
> > if `face' is among them for some reason it will be
> > overridden by the face provided specifically for this.
> 
> There are already too many faces in M-x list-faces-display
> for users to comprehend that adding three more faces with
> the same color would make matters worse.

That's not a good argument for not adding faces.
Users and libraries can already create any
number of faces.

The solution for that problem, which is not
relevant here, is to give `list-faces-display'
a way to filter (e.g. on an input pattern).

Users deserve an easy way to have whatever
faces they want for such prompts/msgs, including
being able to inherit etc.  Let them, not you/us,
decide individually whether/when faces should
appear the same.

Easy to do.  No penalty.  But yes,
`list-faces-display', like `list-colors-display'
and some others, could benefit from incremental
filtering.

> > 2. The doc string of `minibuffer-message-properties'
> > should not say that the properties are added to
> > "minibuffer messages" - that's too broad.  It should
> > say that they are added to the text shown by function
> > `minibuffer-message' - or else describe that text,
> > and only that text, in another way.
> 
> OK, fixed in the attached patch.
> 
> > The doc string of the similar variable for Isearch
> > should say that the properties are added to "the
> > search prompt" or some such.  Not sure whether the
> > right description is "prompt", but whatever is the
> > best way to describe it should be used in the doc
> > string.
> 
> OK, added to this patch:

Haven't looked at the patch (no time now), but
I'm sure it's an improvement.  Thx.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21112; Package emacs. (Thu, 27 Jun 2019 10:29:01 GMT) Full text and rfc822 format available.

Message #48 received at 21112 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 21112 <at> debbugs.gnu.org, Raffaele Ricciardi <rfflrccrd <at> gmail.com>
Subject: Re: bug#21112: 25; Patch: show minibuffer messages with a face
Date: Thu, 27 Jun 2019 12:28:35 +0200
Juri Linkov <juri <at> linkov.net> writes:

> This patch checks for existing face properties to not overwrite them:

I'm not really convinced that there should be any face properties on the
minibuffer messages at all, though.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21112; Package emacs. (Thu, 27 Jun 2019 14:23:02 GMT) Full text and rfc822 format available.

Message #51 received at 21112 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, Juri Linkov <juri <at> linkov.net>
Cc: 21112 <at> debbugs.gnu.org, Raffaele Ricciardi <rfflrccrd <at> gmail.com>
Subject: RE: bug#21112: 25; Patch: show minibuffer messages with a face
Date: Thu, 27 Jun 2019 07:22:40 -0700 (PDT)
> I'm not really convinced that there should be any face properties on the
> minibuffer messages at all, though.  :-)

Yes, and a caller can always add whatever properties
it wants/needs.  It's not hard to pass a propertized
string to `minibuffer-message'.

At any rate, if we do provide for properties in some
way, it needs to be easy for a user or calling code
to control the properties.  It not kosher to hard-code
properties for such things.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21112; Package emacs. (Thu, 27 Jun 2019 20:37:01 GMT) Full text and rfc822 format available.

Message #54 received at 21112 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 21112 <at> debbugs.gnu.org, Raffaele Ricciardi <rfflrccrd <at> gmail.com>
Subject: Re: bug#21112: 25; Patch: show minibuffer messages with a face
Date: Thu, 27 Jun 2019 23:28:52 +0300
>> This patch checks for existing face properties to not overwrite them:
>
> I'm not really convinced that there should be any face properties on the
> minibuffer messages at all, though.  :-)

Without highlighting of minibuffer messages there is a danger that the
message will remain unnoticed, especially in the multiline minibuffer.

So minibuffer messages need to be highlighted for the same reason
why the minibuffer prompt is already highlighted:

1. to designate non-editable read-only parts of the minibuffer;

2. to help the users to turn attention to the active part
   of the minibuffer.

Thus all informational text in the minibuffer should be highlighted
consistently in one color to help not to miss important message.

Isn't it so already that elsewhere in Emacs font-lock is used
to highlight more important parts of the buffer?

PS: I already added configurability in the previous patch,
so now we are discussing the default value.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21112; Package emacs. (Thu, 27 Jun 2019 20:37:02 GMT) Full text and rfc822 format available.

Message #57 received at 21112 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>,
 Raffaele Ricciardi <rfflrccrd <at> gmail.com>, 21112 <at> debbugs.gnu.org
Subject: Re: bug#21112: 25; Patch: show minibuffer messages with a face
Date: Thu, 27 Jun 2019 23:29:16 +0300
>> I'm not really convinced that there should be any face properties on the
>> minibuffer messages at all, though.  :-)
>
> Yes, and a caller can always add whatever properties
> it wants/needs.  It's not hard to pass a propertized
> string to `minibuffer-message'.

It makes no sense for a caller of a particular command
to decide whether to highlight the message or not.

It should be user's preference whether to highlight
all messages from all commands, or none at all.

If the user decided "I don't want caller's highlighting",
a caller should not have the right to override user's preference.

So we should not allow a caller to overwrite the default
face properties, and I retract that part of my previous patch.

This is a better patch that uses caller's properties
only when minibuffer-message-properties is nil:

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 57702760fb..fa45616bf3 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -693,6 +693,9 @@ minibuffer
   :link '(custom-manual "(emacs)Minibuffer")
   :group 'environment)
 
+(defvar minibuffer-message-properties minibuffer-prompt-properties
+  "Text properties added to the text shown by `minibuffer-message'.")
+
 (defun minibuffer-message (message &rest args)
   "Temporarily display MESSAGE at the end of the minibuffer.
 The text is displayed for `minibuffer-message-timeout' seconds,
@@ -714,6 +717,8 @@ minibuffer-message
                       (copy-sequence message)
                     (concat " [" message "]")))
     (when args (setq message (apply #'format-message message args)))
+    (when minibuffer-message-properties
+      (setq message (apply #'propertize message minibuffer-message-properties)))
     (let ((ol (make-overlay (point-max) (point-max) nil t t))
           ;; A quit during sit-for normally only interrupts the sit-for,
           ;; but since minibuffer-message is used at the end of a command,





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21112; Package emacs. (Thu, 27 Jun 2019 21:20:02 GMT) Full text and rfc822 format available.

Message #60 received at 21112 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>,
 Raffaele Ricciardi <rfflrccrd <at> gmail.com>, 21112 <at> debbugs.gnu.org
Subject: RE: bug#21112: 25; Patch: show minibuffer messages with a face
Date: Thu, 27 Jun 2019 14:19:45 -0700 (PDT)
> >> I'm not really convinced that there should be any face properties on the
> >> minibuffer messages at all, though.  :-)
> >
> > Yes, and a caller can always add whatever properties
> > it wants/needs.  It's not hard to pass a propertized
> > string to `minibuffer-message'.
> 
> It makes no sense for a caller of a particular command
> to decide whether to highlight the message or not.

Why would you decide that for everyone?  Can't you
imagine that it might make sense for some calling
code to do that?

Who said "command"?  Why shouldn't some code that calls
`minibuffer-message' propertize parts of that message
any way its author sees fit?  The caller can choose the
text to display; why shouldn't it be able to choose how
to emphasize (or whatever) particular parts of it?

> It should be user's preference whether to highlight
> all messages from all commands, or none at all.

All or nothing, eh?  Why so limited?

In any case, a user should also be able to choose
to use some library or other code that highlights
some text displayed by `minibuffer-message' in a
way deemed appropriate (by that code and that user).

User choices are not limited to user options and
faces.

A one-size-fits-all outlook is not Emacsy.  It
"makes no sense" for Emacs design to do that.

Emacs typically gives users (including coders)
enough rope to hang themselves on - on purpose,
because it tries to be flexible and maximize
their possibilities.

> If the user decided "I don't want caller's highlighting",
> a caller should not have the right to override user's preference.

If a user decides to use code that does the
kind of highlighting s?he wants, s?he should
be able to do that.

Customize is not the only knob users have, to
express choices.  Among the most common ways
to express choice are choosing to turn on
particular modes and load particular libraries.

> So we should not allow a caller to overwrite the default
> face properties, and I retract that part of my previous patch.

Whatever.

Many users are also code writers.  Most code
writers are also users.  Give users the
ability to adapt and adopt whatever they want
to, however they want to.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21112; Package emacs. (Thu, 27 Jun 2019 21:38:01 GMT) Full text and rfc822 format available.

Message #63 received at 21112 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Juri Linkov <juri <at> linkov.net>, Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 21112 <at> debbugs.gnu.org, Raffaele Ricciardi <rfflrccrd <at> gmail.com>
Subject: RE: bug#21112: 25; Patch: show minibuffer messages with a face
Date: Thu, 27 Jun 2019 14:37:45 -0700 (PDT)
> Without highlighting of minibuffer messages there is a danger that the
> message will remain unnoticed, especially in the multiline minibuffer.

Danger?  Really?

Some people don't like danger notices.
Some people don't like (what they call) "angry
fruit salad".  Some people don't like lots of
highlighting - or even any highlighting, e.g.
in something like Dired.  Some people even
turn off `font-lock-mode'.

(I'm not one of those people, but they exist.)

People are different.  Their use cases and
contexts of use are different.  One size does
not fit all.

> So minibuffer messages need to be highlighted for the same reason
> why the minibuffer prompt is already highlighted:


"Need to be"?  Neither of those things _needs_
to be highlighted.  Lots of us users will
appreciate that they can be highlighted.

We'll also appreciate being able to choose
how, how much, and whether they're highlighted.

> 1. to designate non-editable read-only parts of the minibuffer;
> 2. to help the users to turn attention to the active part
>    of the minibuffer.

I agree (personally and generally) with those
aids - helpful.  I don't agree about there
being "danger" if they are absent.

> Thus all informational text in the minibuffer should be highlighted
> consistently in one color to help not to miss important message.

"Thus"?  That doesn't follow, even if one accepts
your argument above.  Nothing in that argument
implies that ALL informational text in the
minibuffer should be highlighted CONSISTENTLY IN
ONE COLOR.

It's quite possible for important messages not to
be missed without such a paint-it-all-the-same
approach.  It's quite possible that some code
wants (and the users who choose to use that code
want) to emphasize certain parts of a message
specially - including precisely "to help not to
miss" something particularly noteworthy.

What is true in this regard of `message' is also
true of `minibuffer-message'.  Are you thinking
of imposing the same kind of blanket treatment
for `message'?  If not, why not?  Why doesn't
that apply also to `minibuffer-message'?

> Isn't it so already that elsewhere in Emacs font-lock is used
> to highlight more important parts of the buffer?

Font-lock does not impose a single face
("consistently in one color") for all its
highlighting, does it?  Why not?  Because it
can be useful to emphasize different things
differently...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21112; Package emacs. (Thu, 04 Jul 2019 22:03:02 GMT) Full text and rfc822 format available.

Message #66 received at 21112 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 21112 <at> debbugs.gnu.org, Raffaele Ricciardi <rfflrccrd <at> gmail.com>
Subject: Re: bug#21112: 25; Patch: show minibuffer messages with a face
Date: Fri, 05 Jul 2019 01:01:18 +0300
tags 21112 - wontfix
fixed 21112 27.0.50
thanks

> But this will overwrite the face properties the caller has set, right?

I pushed to master the patch that doesn't overwrite the face properties
the caller has set, and doesn't set face properties on all minibuffer messages
(nil by default).




Removed tag(s) wontfix. Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Thu, 04 Jul 2019 22:03:03 GMT) Full text and rfc822 format available.

bug Marked as fixed in versions 27.0.50. Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Thu, 04 Jul 2019 22:03:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 02 Aug 2019 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 261 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.