emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 44f1996: * lisp/minibuffer.el (minibuffer-message-p


From: Juri Linkov
Subject: [Emacs-diffs] master 44f1996: * lisp/minibuffer.el (minibuffer-message-properties): New variable.
Date: Thu, 4 Jul 2019 18:01:09 -0400 (EDT)

branch: master
commit 44f199648b0c986a0ac7608f4e9d803c619ae2d6
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    * lisp/minibuffer.el (minibuffer-message-properties): New variable.
    
    (minibuffer-message): Use it to propertize message unless already
    propertized by the caller.
    
    * lisp/simple.el (minibuffer-error-function): Propertize the error.
    
    * lisp/isearch.el (isearch-message-properties): New variable.
    (isearch--momentary-message, isearch-message-prefix)
    (isearch-message-suffix): Use it.  (Bug#21112)
---
 lisp/isearch.el    | 14 +++++++++-----
 lisp/minibuffer.el |  7 +++++++
 lisp/simple.el     |  3 ++-
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/lisp/isearch.el b/lisp/isearch.el
index f150a3b..94c30eb 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1992,13 +1992,17 @@ Turning on character-folding turns off regexp mode.")
   (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 @@ the word mode."
                        (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 5770276..52455cc 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -693,6 +693,9 @@ for use at QPOS."
   :link '(custom-manual "(emacs)Minibuffer")
   :group 'environment)
 
+(defvar minibuffer-message-properties nil
+  "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,10 @@ If ARGS are provided, then pass MESSAGE through 
`format-message'."
                       (copy-sequence message)
                     (concat " [" message "]")))
     (when args (setq message (apply #'format-message message args)))
+    (unless (or (null minibuffer-message-properties)
+                ;; Don't overwrite the face properties the caller has set
+                (text-properties-at 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,
diff --git a/lisp/simple.el b/lisp/simple.el
index 766cb01..5f27b75 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2459,7 +2459,8 @@ the minibuffer contents."
     (let ((inhibit-message t))
       (message "%s%s" (if caller (format "%s: " caller) "") string))
     ;; Display an error message at the end of the minibuffer.
-    (minibuffer-message (concat context string))))
+    (minibuffer-message (apply #'propertize (format " [%s%s]" context string)
+                               minibuffer-prompt-properties))))
 
 
 ;Put this on C-x u, so we can force that rather than C-_ into startup msg



reply via email to

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