diff options
| author | Juri Linkov | 2019-07-05 01:01:01 +0300 |
|---|---|---|
| committer | Juri Linkov | 2019-07-05 01:01:01 +0300 |
| commit | 44f199648b0c986a0ac7608f4e9d803c619ae2d6 (patch) | |
| tree | fe96158d4d64d8e91274cbd88b56ff6fa12011e6 | |
| parent | 19b1cefa3ba00ea383bd0910523c6e972fedbe02 (diff) | |
| download | emacs-44f199648b0c986a0ac7608f4e9d803c619ae2d6.tar.gz emacs-44f199648b0c986a0ac7608f4e9d803c619ae2d6.zip | |
* 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)
| -rw-r--r-- | lisp/isearch.el | 14 | ||||
| -rw-r--r-- | lisp/minibuffer.el | 7 | ||||
| -rw-r--r-- | lisp/simple.el | 3 |
3 files changed, 18 insertions, 6 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el index f150a3bba4b..94c30eb57be 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -1992,13 +1992,17 @@ Turning on character-folding turns off regexp mode.") | |||
| 1992 | (setq isearch-regexp (not isearch-regexp)) | 1992 | (setq isearch-regexp (not isearch-regexp)) |
| 1993 | (if isearch-regexp (setq isearch-regexp-function nil))) | 1993 | (if isearch-regexp (setq isearch-regexp-function nil))) |
| 1994 | 1994 | ||
| 1995 | (defvar isearch-message-properties minibuffer-prompt-properties | ||
| 1996 | "Text properties that are added to the isearch prompt.") | ||
| 1997 | |||
| 1995 | (defun isearch--momentary-message (string) | 1998 | (defun isearch--momentary-message (string) |
| 1996 | "Print STRING at the end of the isearch prompt for 1 second" | 1999 | "Print STRING at the end of the isearch prompt for 1 second" |
| 1997 | (let ((message-log-max nil)) | 2000 | (let ((message-log-max nil)) |
| 1998 | (message "%s%s%s" | 2001 | (message "%s%s%s" |
| 1999 | (isearch-message-prefix nil isearch-nonincremental) | 2002 | (isearch-message-prefix nil isearch-nonincremental) |
| 2000 | isearch-message | 2003 | isearch-message |
| 2001 | (propertize (format " [%s]" string) 'face 'minibuffer-prompt))) | 2004 | (apply #'propertize (format " [%s]" string) |
| 2005 | isearch-message-properties))) | ||
| 2002 | (sit-for 1)) | 2006 | (sit-for 1)) |
| 2003 | 2007 | ||
| 2004 | (isearch-define-mode-toggle lax-whitespace " " nil | 2008 | (isearch-define-mode-toggle lax-whitespace " " nil |
| @@ -3202,18 +3206,18 @@ the word mode." | |||
| 3202 | (concat " [" current-input-method-title "]: ")) | 3206 | (concat " [" current-input-method-title "]: ")) |
| 3203 | ": ") | 3207 | ": ") |
| 3204 | ))) | 3208 | ))) |
| 3205 | (propertize (concat (isearch-lazy-count-format) | 3209 | (apply #'propertize (concat (isearch-lazy-count-format) |
| 3206 | (upcase (substring m 0 1)) (substring m 1)) | 3210 | (upcase (substring m 0 1)) (substring m 1)) |
| 3207 | 'face 'minibuffer-prompt))) | 3211 | isearch-message-properties))) |
| 3208 | 3212 | ||
| 3209 | (defun isearch-message-suffix (&optional c-q-hack) | 3213 | (defun isearch-message-suffix (&optional c-q-hack) |
| 3210 | (propertize (concat (if c-q-hack "^Q" "") | 3214 | (apply #'propertize (concat (if c-q-hack "^Q" "") |
| 3211 | (isearch-lazy-count-format 'suffix) | 3215 | (isearch-lazy-count-format 'suffix) |
| 3212 | (if isearch-error | 3216 | (if isearch-error |
| 3213 | (concat " [" isearch-error "]") | 3217 | (concat " [" isearch-error "]") |
| 3214 | "") | 3218 | "") |
| 3215 | (or isearch-message-suffix-add "")) | 3219 | (or isearch-message-suffix-add "")) |
| 3216 | 'face 'minibuffer-prompt)) | 3220 | isearch-message-properties)) |
| 3217 | 3221 | ||
| 3218 | (defun isearch-lazy-count-format (&optional suffix-p) | 3222 | (defun isearch-lazy-count-format (&optional suffix-p) |
| 3219 | "Format the current match number and the total number of matches. | 3223 | "Format the current match number and the total number of matches. |
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 57702760fbc..52455ccc40c 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el | |||
| @@ -693,6 +693,9 @@ for use at QPOS." | |||
| 693 | :link '(custom-manual "(emacs)Minibuffer") | 693 | :link '(custom-manual "(emacs)Minibuffer") |
| 694 | :group 'environment) | 694 | :group 'environment) |
| 695 | 695 | ||
| 696 | (defvar minibuffer-message-properties nil | ||
| 697 | "Text properties added to the text shown by `minibuffer-message'.") | ||
| 698 | |||
| 696 | (defun minibuffer-message (message &rest args) | 699 | (defun minibuffer-message (message &rest args) |
| 697 | "Temporarily display MESSAGE at the end of the minibuffer. | 700 | "Temporarily display MESSAGE at the end of the minibuffer. |
| 698 | The text is displayed for `minibuffer-message-timeout' seconds, | 701 | The text is displayed for `minibuffer-message-timeout' seconds, |
| @@ -714,6 +717,10 @@ If ARGS are provided, then pass MESSAGE through `format-message'." | |||
| 714 | (copy-sequence message) | 717 | (copy-sequence message) |
| 715 | (concat " [" message "]"))) | 718 | (concat " [" message "]"))) |
| 716 | (when args (setq message (apply #'format-message message args))) | 719 | (when args (setq message (apply #'format-message message args))) |
| 720 | (unless (or (null minibuffer-message-properties) | ||
| 721 | ;; Don't overwrite the face properties the caller has set | ||
| 722 | (text-properties-at 0 message)) | ||
| 723 | (setq message (apply #'propertize message minibuffer-message-properties))) | ||
| 717 | (let ((ol (make-overlay (point-max) (point-max) nil t t)) | 724 | (let ((ol (make-overlay (point-max) (point-max) nil t t)) |
| 718 | ;; A quit during sit-for normally only interrupts the sit-for, | 725 | ;; A quit during sit-for normally only interrupts the sit-for, |
| 719 | ;; but since minibuffer-message is used at the end of a command, | 726 | ;; but since minibuffer-message is used at the end of a command, |
diff --git a/lisp/simple.el b/lisp/simple.el index 766cb017b7d..5f27b75a4c7 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -2459,7 +2459,8 @@ the minibuffer contents." | |||
| 2459 | (let ((inhibit-message t)) | 2459 | (let ((inhibit-message t)) |
| 2460 | (message "%s%s" (if caller (format "%s: " caller) "") string)) | 2460 | (message "%s%s" (if caller (format "%s: " caller) "") string)) |
| 2461 | ;; Display an error message at the end of the minibuffer. | 2461 | ;; Display an error message at the end of the minibuffer. |
| 2462 | (minibuffer-message (concat context string)))) | 2462 | (minibuffer-message (apply #'propertize (format " [%s%s]" context string) |
| 2463 | minibuffer-prompt-properties)))) | ||
| 2463 | 2464 | ||
| 2464 | 2465 | ||
| 2465 | ;Put this on C-x u, so we can force that rather than C-_ into startup msg | 2466 | ;Put this on C-x u, so we can force that rather than C-_ into startup msg |