Subject: Re: bug#77546: Acknowledgement (Regression in defaults: Re: Enhance 'icomplete-vertical-mode' customization options.)

From: João Távora <[email-masked]>
Date: Sat, 5 Apr 2025 13:18:25 +0100

This seems to be just a bug in the implementation.  This patch
fixes it (and fixes some odd cl-loop usage as well):

diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index d0cc5674ba7..1ccfcc3edf4 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -927,8 +927,7 @@ icomplete-vertical--ensure-visible-lines-inside-buffer

 (defun icomplete-vertical--add-indicator-to-selected (comp)
   "Add indicators to the selected/unselected COMP completions."
-  (if (and icomplete-vertical-render-prefix-indicator
-           (get-text-property 0 'icomplete-selected comp))
+  (if (get-text-property 0 'icomplete-selected comp)
       (concat (propertize icomplete-vertical-selected-prefix-indicator
                           'face
'icomplete-vertical-selected-prefix-indicator-face)
               comp)
@@ -1012,8 +1011,11 @@ icomplete--render-vertical
     ;; Serialize completions and section titles into a list
     ;; of lines to render
     (cl-loop
-     for (comp prefix suffix section) in tuples
-     do (setq comp (icomplete-vertical--add-indicator-to-selected comp))
+     for (comp-no-indicator prefix suffix section) in tuples
+     for comp =
+     (if icomplete-vertical-render-prefix-indicator
+         (icomplete-vertical--add-indicator-to-selected comp-no-indicator)
+       comp-no-indicator)
      when section
      collect (propertize section 'face 'icomplete-section) into lines-aux
      and count 1 into nsections-aux