GNU bug report logs - #73117
30.0.90; Imenu missing entries when flattening by group

Previous Next

Package: emacs;

Reported by: Troy Brown <brownts <at> troybrown.dev>

Date: Sun, 8 Sep 2024 01:43:01 UTC

Severity: normal

Found in version 30.0.90

Full log


View this message in rfc822 format

From: Troy Brown <brownts <at> troybrown.dev>
To: Juri Linkov <juri <at> linkov.net>
Cc: 73117 <at> debbugs.gnu.org, Daniel Mendler <mail <at> daniel-mendler.de>
Subject: bug#73117: 30.0.90; Imenu missing entries when flattening by group
Date: Sun, 8 Sep 2024 13:31:36 -0400
On Sun, Sep 8, 2024 at 12:42 PM Juri Linkov <juri <at> 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---




This bug report was last modified 257 days ago.

Previous Next


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