On Sun, Sep 8, 2024 at 12:42 PM Juri Linkov <j...@linkov.net> wrote: > > > Maybe using `(setopt completion-auto-help t)` > > and hitting TAB is a better method. > > Or just using `(setopt imenu-eager-completion-buffer nil)` > because otherwise with its default value you need to hit > '?' (minibuffer-completion-help) instead of TAB > to show the completions buffer with two identical > completions in different groups. >
Ah, thanks! Yes, I'm used to using Vertico so I'm not very familiar with the default settings/bindings. In fact that's how I first ran into this issue using Vertico and Imenu with `imenu-flatten` set to "group". > I'm so sorry, I forgot to check with `emacs -Q`, and there is > an additional important setting that affects the groups: > > ``` > (setopt completions-group t) > (setopt completions-format 'vertical) > ``` > > The default value of 'completions-format' is 'horizontal' > that doesn't support groups, and I don't know why. > > Maybe Daniel (Cc:ed) could help us understand > why 'completion--insert-horizontal' doesn't display groups. No worries, at least I know I'm not going crazy, lol. Indeed, when I set `completions-format` to "vertical" it does show all entries. I then expanded this example to see what happens with 3 entries with both "horizontal" and "vertical" values for `completions-format`. With a three section menu (see example below), and format set to "horizontal", it does show multiple groups vertically. However, even under this condition, the groups which had identical entries only show up once (which seems like a bug). The following example configures `imenu-flatten" to "group" and then shows the menu, first with `completions-format` set to "horizontal" and then "vertical". ```elisp (progn (setopt completions-group t) (setopt imenu-eager-completion-buffer nil) (setopt minibuffer-visible-completions t) (setopt imenu-flatten 'group) (require 'imenu) (dolist (format '(horizontal vertical)) (setopt completions-format format) (imenu-choose-buffer-index (format "(%s) Index item: " format) `(("XYZ" . (("123" . ,(point-min-marker)))) ("Bar" . (("Foo" . ,(point-min-marker)))) ("Baz" . (("Foo" . ,(point-max-marker)))))))) ``` --8<---------------cut here---------------start------------->8--- Click or type RET on a completion to select it. Type <right>, <left>, <down>, <up> to move point between completions. 3 possible completions: XYZ 123 Bar Foo --8<---------------cut here---------------end--------------->8--- --8<---------------cut here---------------start------------->8--- Click or type RET on a completion to select it. Type <right>, <left>, <down>, <up> to move point between completions. 3 possible completions: XYZ 123 Bar Foo Baz Foo --8<---------------cut here---------------end--------------->8---