bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21112: 25; Patch: show minibuffer messages with a face


From: Juri Linkov
Subject: bug#21112: 25; Patch: show minibuffer messages with a face
Date: Tue, 25 Jun 2019 22:47:06 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>>>      (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:

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,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]