emacs-diffs
[Top][All Lists]
Advanced

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

emacs-27 c37b2a9: Yet another fix for 'set-minibuffer-message'


From: Eli Zaretskii
Subject: emacs-27 c37b2a9: Yet another fix for 'set-minibuffer-message'
Date: Fri, 16 Oct 2020 03:18:25 -0400 (EDT)

branch: emacs-27
commit c37b2a9b425a8f347015fb9404b512334b5a1f57
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Yet another fix for 'set-minibuffer-message'
    
    * lisp/minibuffer.el (set-minibuffer-message): Handle the case of
    separate minibuffer-only frame.  Suggested by Gregory Heytings
    <ghe@sdf.org>.
---
 lisp/minibuffer.el | 83 +++++++++++++++++++++++++++++-------------------------
 1 file changed, 44 insertions(+), 39 deletions(-)

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 10cfca8..942fb01 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -783,45 +783,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))
-             (eq (window-frame) (window-frame (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)
 



reply via email to

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