GNU bug report logs - #77546
Regression in defaults: Re: Enhance 'icomplete-vertical-mode' customization options.

Previous Next

Package: emacs;

Reported by: João Távora <joaotavora <at> gmail.com>

Date: Sat, 5 Apr 2025 09:35:02 UTC

Severity: normal

Full log


Message #20 received at 77546 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Rahul Martim Juliato <rahuljuliato <at> gmail.com>
Cc: 77546 <at> debbugs.gnu.org
Subject: Re: bug#77546: Acknowledgement (Regression in defaults: Re: Enhance
 'icomplete-vertical-mode' customization options.)
Date: Sun, 06 Apr 2025 14:20:56 +0100
João Távora <joaotavora <at> gmail.com> writes:

> That's ok. Thanks for confirming and testing. I'll push the patch later and close this.

I've pushed the patch with the fix and followed up with a simpler one
that simply renames internal functions to be shorter and in-line with
our convention for internal function names (it's icomplete--, not
icomplete-vertical-- since icomplete-vertical.el doesn't exist).

I've also noticed that you didn't update the hand-holding comments of
icomplete--render-vertical, and that there's a suspicious double call to
a new icomplete--ensure-visible-lines-inside-buffer function.  I'm
fairly sure this is only relevant for `icomplete--in-region-buffer' but
I think the code should look like this.  Can you try this patch after my
sig?

João

diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 35842b53e6b..481e7164889 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -914,16 +914,15 @@ icomplete--adjust-lines-for-column
                 lines))
     lines))
 
-(defun icomplete--ensure-visible-lines-inside-buffer ()
-  "Ensure the completion list is visible in regular buffers only.
-Scrolls the screen to be at least `icomplete-prospects-height' real lines
+(defun icomplete--ensure-vertical-completion-list-visible ()
+  "Ensure vertical completion list is visible.
+Scroll the screen to be at least `icomplete-prospects-height' real lines
 away from the bottom.  Counts wrapped lines as real lines."
-  (unless (minibufferp)
-    (let* ((window-height (window-body-height))
-           (current-line (count-screen-lines (window-start) (point)))
-           (lines-to-bottom (- window-height current-line)))
-      (when (< lines-to-bottom icomplete-prospects-height)
-        (scroll-up (- icomplete-prospects-height lines-to-bottom))))))
+  (let* ((window-height (window-body-height))
+         (current-line (count-screen-lines (window-start) (point)))
+         (lines-to-bottom (- window-height current-line)))
+    (when (< lines-to-bottom icomplete-prospects-height)
+      (scroll-up (- icomplete-prospects-height lines-to-bottom)))))
 
 (defun icomplete--add-indicator-to-selected (comp)
   "Add indicator to completion COMP according to its selection state."
@@ -943,7 +942,11 @@ icomplete--render-vertical
                  (truncate (max-mini-window-lines) 1)))))
   ;; Welcome to loopapalooza!
   ;;
-  ;; First, be mindful of `icomplete-scroll' and manual scrolls.  If
+  ;; First, take care of a special case for icomplete--in-region-buffer
+  (when icomplete--in-region-buffer
+    (icomplete--ensure-vertical-completion-list-visible))
+
+  ;; Then, be mindful of `icomplete-scroll' and manual scrolls.  If
   ;; `icomplete--scrolled-completions' and `icomplete--scrolled-past'
   ;; are:
   ;;
@@ -953,14 +956,9 @@ icomplete--render-vertical
   ;;   example);
   ;; - non-nil and nil, respectively, a refiltering took place and we
   ;;   may need to readjust them to the new filtered `comps'.
-  (when (and icomplete-scroll
-             (not icomplete--scrolled-completions)
-             (not icomplete--scrolled-past))
-    (icomplete--ensure-visible-lines-inside-buffer))
   (when (and icomplete-scroll
              icomplete--scrolled-completions
              (null icomplete--scrolled-past))
-    (icomplete--ensure-visible-lines-inside-buffer)
     (cl-loop with preds
              for (comp . rest) on comps
              when (equal comp (car icomplete--scrolled-completions))




This bug report was last modified 111 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.