aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorEli Zaretskii2020-02-12 21:39:44 +0200
committerEli Zaretskii2020-02-12 21:39:44 +0200
commit027da652a4fc643a086a880aec30618b2bccb487 (patch)
treee4c94bb3ad04b794e1873e16b8f357de3ee4a77f /lisp
parent5a21aaff468ec3f0337117707cda4254cbef8de7 (diff)
downloademacs-027da652a4fc643a086a880aec30618b2bccb487.tar.gz
emacs-027da652a4fc643a086a880aec30618b2bccb487.zip
Fix display of minibuffer prompt in ido.el
* lisp/minibuffer.el (minibuffer--message-overlay-pos): New function. (set-minibuffer-message): Use it to determine where to show the overlay with the temporary message. * lisp/ido.el (ido-exhibit): Revert "Render Ido suggestions using an overlay"; this restores the original code which inserted the match-status information into the minibuffer, instead of displaying it in an overlay with an after-string. Put the special 'minibuffer-message' text property at the beginning of the inserted text. (Bug#39379) * etc/NEWS: * doc/lispref/display.texi (Displaying Messages): * doc/lispref/text.texi (Special Properties): Document the 'minibuffer-message' text property and its effect.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ido.el19
-rw-r--r--lisp/minibuffer.el18
2 files changed, 23 insertions, 14 deletions
diff --git a/lisp/ido.el b/lisp/ido.el
index 6707d814077..7198649e5a5 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -4492,8 +4492,6 @@ For details of keybindings, see `ido-find-file'."
4492 (ido-tidy)) 4492 (ido-tidy))
4493 (throw 'ido contents)))) 4493 (throw 'ido contents))))
4494 4494
4495(defvar ido--overlay nil)
4496
4497(defun ido-exhibit () 4495(defun ido-exhibit ()
4498 "Post command hook for Ido." 4496 "Post command hook for Ido."
4499 ;; Find matching files and display a list in the minibuffer. 4497 ;; Find matching files and display a list in the minibuffer.
@@ -4728,16 +4726,13 @@ For details of keybindings, see `ido-find-file'."
4728 (let ((inf (ido-completions contents))) 4726 (let ((inf (ido-completions contents)))
4729 (setq ido-show-confirm-message nil) 4727 (setq ido-show-confirm-message nil)
4730 (ido-trace "inf" inf) 4728 (ido-trace "inf" inf)
4731 (when ido--overlay 4729 (let ((pos (point)))
4732 (delete-overlay ido--overlay)) 4730 (insert inf)
4733 (let ((o (make-overlay (point-max) (point-max) nil t t))) 4731 (if (< pos (point-max))
4734 (when (> (length inf) 0) 4732 ;; Tell set-minibuffer-message where to display the
4735 ;; For hacks that redefine ido-completions function (bug#39379) 4733 ;; overlay with temporary messages.
4736 (when (eq (aref inf 0) ?\n) 4734 (put-text-property pos (1+ pos) 'minibuffer-message t)))
4737 (setq inf (concat " " inf))) 4735 )
4738 (put-text-property 0 1 'cursor t inf))
4739 (overlay-put o 'after-string inf)
4740 (setq ido--overlay o)))
4741 )))) 4736 ))))
4742 4737
4743(defun ido-completions (name) 4738(defun ido-completions (name)
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 0589211877a..49daabc44e3 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -763,8 +763,21 @@ and `clear-minibuffer-message' called automatically via
763(defvar minibuffer-message-timer nil) 763(defvar minibuffer-message-timer nil)
764(defvar minibuffer-message-overlay nil) 764(defvar minibuffer-message-overlay nil)
765 765
766(defun minibuffer--message-overlay-pos ()
767 "Return position where `set-minibuffer-message' shall put message overlay."
768 ;; Starting from point, look for non-nil 'minibuffer-message'
769 ;; property, and return its position. If none found, return the EOB
770 ;; position.
771 (let* ((pt (point))
772 (propval (get-text-property pt 'minibuffer-message)))
773 (if propval pt
774 (next-single-property-change pt 'minibuffer-message nil (point-max)))))
775
766(defun set-minibuffer-message (message) 776(defun set-minibuffer-message (message)
767 "Temporarily display MESSAGE at the end of the minibuffer. 777 "Temporarily display MESSAGE at the end of the minibuffer.
778If some part of the minibuffer text has the `minibuffer-message' property,
779the message will be displayed before the first such character, instead of
780at the end of the minibuffer.
768The text is displayed for `minibuffer-message-clear-timeout' seconds 781The text is displayed for `minibuffer-message-clear-timeout' seconds
769\(if the value is a number), or until the next input event arrives, 782\(if the value is a number), or until the next input event arrives,
770whichever comes first. 783whichever comes first.
@@ -784,8 +797,9 @@ via `set-message-function'."
784 797
785 (clear-minibuffer-message) 798 (clear-minibuffer-message)
786 799
787 (setq minibuffer-message-overlay 800 (let ((ovpos (minibuffer--message-overlay-pos)))
788 (make-overlay (point-max) (point-max) nil t t)) 801 (setq minibuffer-message-overlay
802 (make-overlay ovpos ovpos nil t t)))
789 (unless (zerop (length message)) 803 (unless (zerop (length message))
790 ;; The current C cursor code doesn't know to use the overlay's 804 ;; The current C cursor code doesn't know to use the overlay's
791 ;; marker's stickiness to figure out whether to place the cursor 805 ;; marker's stickiness to figure out whether to place the cursor