all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 39379@debbugs.gnu.org, wyuenho@gmail.com
Subject: bug#39379: 27.0.60; Fix for #38457 broke ido-vertical-mode
Date: Wed, 12 Feb 2020 20:18:33 +0200	[thread overview]
Message-ID: <83pnejr7nq.fsf@gnu.org> (raw)
In-Reply-To: <42a997dd-0667-da4d-7605-aa8267018869@yandex.ru> (message from Dmitry Gutov on Wed, 12 Feb 2020 01:42:22 +0200)

> Cc: wyuenho@gmail.com, 39379@debbugs.gnu.org
> From: Dmitry Gutov <dgutov@yandex.ru>
> Date: Wed, 12 Feb 2020 01:42:22 +0200
> 
> The patch more or less works, with the exception of the case where POS 
> is EOB (e.g. when the sole completion is fully typed out). But that 
> should be fixable as well.

Right, updated patch below.

> The reason I used after-string, though, is that icomplete-mode does 
> that. And either it should have the same problems, or ido creates some 
> circumstances where the problems show up.
> 
> The former seems to be the case, though. Like, if I set 
> max-mini-window-height to 1, then icomplete-mode also exhibits bug#39433.

OK, but this is an old problem, because I see the same in Emacs 26.3.
It wasn't caused by the new implementation of set-minibuffer-message.

> And while there is no xxx-vertical-mode for icomplete-mode, we would 
> probably want one to be written someday. Sounds like when that happens, 
> icomplete-vertical-mode would trigger this same bug as well unless we 
> fix it in the display engine or find some other general way to avoid it.

Well, we hardly ever fix future bugs.  And limiting mini-windows to
such small height is asking for trouble.

But okay, I'm fine with leaving this bug open, and will try to fix the
problem on master.  I do want to install the patch below, because it
fixes a problem directly caused by set-minibuffer-message, so we
should fix this in Emacs 27.  Any objections?

diff --git a/lisp/ido.el b/lisp/ido.el
index 6707d81407..d74ea69ae3 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -4728,16 +4728,11 @@ ido-exhibit
 	(let ((inf (ido-completions contents)))
 	  (setq ido-show-confirm-message nil)
 	  (ido-trace "inf" inf)
-          (when ido--overlay
-            (delete-overlay ido--overlay))
-          (let ((o (make-overlay (point-max) (point-max) nil t t)))
-            (when (> (length inf) 0)
-              ;; For hacks that redefine ido-completions function (bug#39379)
-              (when (eq (aref inf 0) ?\n)
-                (setq inf (concat " " inf)))
-              (put-text-property 0 1 'cursor t inf))
-            (overlay-put o 'after-string inf)
-            (setq ido--overlay o)))
+          (let ((pos (point)))
+            (insert inf)
+            (if (< pos (point-max))
+                (put-text-property pos (1+ pos) 'minibuffer-message t)))
+          )
 	))))
 
 (defun ido-completions (name)
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 0589211877..767fc8dff8 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -763,6 +763,16 @@ minibuffer-message-clear-timeout
 (defvar minibuffer-message-timer nil)
 (defvar minibuffer-message-overlay nil)
 
+(defun minibuffer--message-overlay-pos ()
+  "Return position where `set-minibuffer-message' shall put message overlay."
+  ;; Starting from point, look for non-nil 'minibuffer-message'
+  ;; property, and return its position.  If none found, return the EOB
+  ;; position.
+  (let* ((pt (point))
+         (propval (get-text-property pt 'minibuffer-message)))
+    (if propval pt
+      (next-single-property-change pt 'minibuffer-message nil (point-max)))))
+
 (defun set-minibuffer-message (message)
   "Temporarily display MESSAGE at the end of the minibuffer.
 The text is displayed for `minibuffer-message-clear-timeout' seconds
@@ -784,8 +794,9 @@ set-minibuffer-message
 
       (clear-minibuffer-message)
 
-      (setq minibuffer-message-overlay
-            (make-overlay (point-max) (point-max) nil t t))
+      (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





  reply	other threads:[~2020-02-12 18:18 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31 23:53 bug#39379: 27.0.60; Fix for #38457 broke ido-vertical-mode Jimmy Yuen Ho Wong
2020-02-01  8:12 ` Eli Zaretskii
2020-02-02 13:58   ` Jimmy Yuen Ho Wong
2020-02-02 16:13     ` Eli Zaretskii
2020-02-02 17:23       ` Eli Zaretskii
2020-02-02 18:06         ` Eli Zaretskii
2020-02-02 18:38           ` Eli Zaretskii
2020-02-02 21:33             ` Jimmy Yuen Ho Wong
2020-02-03  3:21               ` Eli Zaretskii
2020-02-03 13:19               ` Dmitry Gutov
2020-02-03 15:40                 ` Eli Zaretskii
2020-02-03 21:51                   ` Dmitry Gutov
2020-02-04  3:27                     ` Eli Zaretskii
2020-02-04 13:19                       ` Dmitry Gutov
2020-02-04 15:40                         ` Eli Zaretskii
2020-02-04 23:55                           ` Dmitry Gutov
2020-02-05  3:36                             ` Eli Zaretskii
2020-02-10 15:44           ` Eli Zaretskii
2020-02-11 23:42             ` Dmitry Gutov
2020-02-12 18:18               ` Eli Zaretskii [this message]
2020-02-12 18:24                 ` Dmitry Gutov
2020-02-12 19:42                   ` Eli Zaretskii
2020-03-03 14:02                   ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83pnejr7nq.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=39379@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=wyuenho@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.