From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#39379: 27.0.60; Fix for #38457 broke ido-vertical-mode Date: Wed, 12 Feb 2020 20:18:33 +0200 Message-ID: <83pnejr7nq.fsf@gnu.org> References: <83a762k9p2.fsf@gnu.org> <71c2898c-aca7-ea92-e7d2-f4fd122b566d@gmail.com> <83ftfthsqs.fsf@gnu.org> <83d0awj42l.fsf@gnu.org> <83a760j23r.fsf@gnu.org> <83zhdqbg6v.fsf@gnu.org> <42a997dd-0667-da4d-7605-aa8267018869@yandex.ru> Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="97717"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 39379@debbugs.gnu.org, wyuenho@gmail.com To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 12 19:19:15 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j1wbS-000PI1-O4 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 12 Feb 2020 19:19:14 +0100 Original-Received: from localhost ([::1]:41752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1wbR-00012r-MT for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 12 Feb 2020 13:19:13 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52313) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1wbI-00012R-0g for bug-gnu-emacs@gnu.org; Wed, 12 Feb 2020 13:19:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j1wbG-0004b3-SB for bug-gnu-emacs@gnu.org; Wed, 12 Feb 2020 13:19:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53049) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j1wbG-0004aw-Ok for bug-gnu-emacs@gnu.org; Wed, 12 Feb 2020 13:19:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j1wbG-0007Jf-LF for bug-gnu-emacs@gnu.org; Wed, 12 Feb 2020 13:19:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 12 Feb 2020 18:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39379 X-GNU-PR-Package: emacs Original-Received: via spool by 39379-submit@debbugs.gnu.org id=B39379.158153152128087 (code B ref 39379); Wed, 12 Feb 2020 18:19:02 +0000 Original-Received: (at 39379) by debbugs.gnu.org; 12 Feb 2020 18:18:41 +0000 Original-Received: from localhost ([127.0.0.1]:59021 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j1wav-0007Ix-9A for submit@debbugs.gnu.org; Wed, 12 Feb 2020 13:18:41 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:37136) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j1wat-0007Ij-Fo for 39379@debbugs.gnu.org; Wed, 12 Feb 2020 13:18:40 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:39730) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1j1wao-0004Q3-Bo; Wed, 12 Feb 2020 13:18:34 -0500 Original-Received: from [176.228.60.248] (port=4402 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1j1wan-0005gD-Pz; Wed, 12 Feb 2020 13:18:34 -0500 In-reply-to: <42a997dd-0667-da4d-7605-aa8267018869@yandex.ru> (message from Dmitry Gutov on Wed, 12 Feb 2020 01:42:22 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:175973 Archived-At: > Cc: wyuenho@gmail.com, 39379@debbugs.gnu.org > From: Dmitry Gutov > 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