diff options
author | Glenn Morris <rgm@gnu.org> | 2020-10-17 09:48:54 -0700 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2020-10-17 09:48:54 -0700 |
commit | 3ac3a6503ebcf40ae6e179d92e1d168a4d440ea1 (patch) | |
tree | 48987d8f445159691efbf8b060e59731d43d8bb5 /lisp/minibuffer.el | |
parent | 2f45054208ccc3fbd53b7f4d6bbaba92afa075c1 (diff) | |
parent | 65078e0a760950783e56f6765465a59bd642e8e4 (diff) | |
download | emacs-3ac3a6503ebcf40ae6e179d92e1d168a4d440ea1.tar.gz |
Merge from origin/emacs-27
65078e0a76 * lisp/info.el (Info-hide-note-references): Doc fix. (Bug...
30305b543d Make lisp/progmodes/js.el dependent on CC Mode in the Make...
c37b2a9b42 Yet another fix for 'set-minibuffer-message'
72dd911981 Fix posn-at-x-y in builds --without-x
ace25f2066 Clarify the seq-reduce documentation
7d598e281d Make tramp-completion-reread-directory-timeout obsolete (B...
2c31ce18ea Fix 'message' when there's active minibuffer on another frame
# Conflicts:
# doc/misc/tramp.texi
# etc/NEWS
Diffstat (limited to 'lisp/minibuffer.el')
-rw-r--r-- | lisp/minibuffer.el | 82 |
1 files changed, 44 insertions, 38 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 427636e8662..5a41e2f30bd 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -776,44 +776,50 @@ The text is displayed for `minibuffer-message-clear-timeout' seconds whichever comes first. Unlike `minibuffer-message', this function is called automatically via `set-message-function'." - (when (and (not noninteractive) - (window-live-p (active-minibuffer-window))) - (with-current-buffer (window-buffer (active-minibuffer-window)) - (setq message (if (string-match-p "\\` *\\[.+\\]\\'" message) - ;; Make sure we can put-text-property. - (copy-sequence message) - (concat " [" message "]"))) - (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))) - - (clear-minibuffer-message) - - (let ((ovpos (minibuffer--message-overlay-pos))) - (setq minibuffer-message-overlay - (make-overlay ovpos ovpos nil t t))) - (unless (zerop (length message)) - ;; The current C cursor code doesn't know to use the overlay's - ;; marker's stickiness to figure out whether to place the cursor - ;; before or after the string, so let's spoon-feed it the pos. - (put-text-property 0 1 'cursor 1 message)) - (overlay-put minibuffer-message-overlay 'after-string message) - ;; Make sure the overlay with the message is displayed before - ;; any other overlays in that position, in case they have - ;; resize-mini-windows set to nil and the other overlay strings - ;; are too long for the mini-window width. This makes sure the - ;; temporary message will always be visible. - (overlay-put minibuffer-message-overlay 'priority 1100) - - (when (numberp minibuffer-message-clear-timeout) - (setq minibuffer-message-timer - (run-with-timer minibuffer-message-clear-timeout nil - #'clear-minibuffer-message))) - - ;; Return `t' telling the caller that the message - ;; was handled specially by this function. - t))) + (let* ((minibuf-window (active-minibuffer-window)) + (minibuf-frame (and (window-live-p minibuf-window) + (window-frame minibuf-window)))) + (when (and (not noninteractive) + (window-live-p minibuf-window) + (or (eq (window-frame) minibuf-frame) + (eq (frame-parameter minibuf-frame 'minibuffer) 'only))) + (with-current-buffer (window-buffer minibuf-window) + (setq message (if (string-match-p "\\` *\\[.+\\]\\'" message) + ;; Make sure we can put-text-property. + (copy-sequence message) + (concat " [" message "]"))) + (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))) + + (clear-minibuffer-message) + + (let ((ovpos (minibuffer--message-overlay-pos))) + (setq minibuffer-message-overlay + (make-overlay ovpos ovpos nil t t))) + (unless (zerop (length message)) + ;; The current C cursor code doesn't know to use the overlay's + ;; marker's stickiness to figure out whether to place the cursor + ;; before or after the string, so let's spoon-feed it the pos. + (put-text-property 0 1 'cursor 1 message)) + (overlay-put minibuffer-message-overlay 'after-string message) + ;; Make sure the overlay with the message is displayed before + ;; any other overlays in that position, in case they have + ;; resize-mini-windows set to nil and the other overlay strings + ;; are too long for the mini-window width. This makes sure the + ;; temporary message will always be visible. + (overlay-put minibuffer-message-overlay 'priority 1100) + + (when (numberp minibuffer-message-clear-timeout) + (setq minibuffer-message-timer + (run-with-timer minibuffer-message-clear-timeout nil + #'clear-minibuffer-message))) + + ;; Return `t' telling the caller that the message + ;; was handled specially by this function. + t)))) (setq set-message-function 'set-minibuffer-message) |