> This issue appears to be similar to the issue reported in 70846, but
> this is specifically regarding when Imenu is configured to flatten
> into "groups" (as opposed to "annotation" as was reported there).
> When "imenu-flatten" is set to "group", I see an issue where nested
> entries, with the same name but belonging to different parents, aren't
> all displayed.
>
> I've included an example below (based on the example menu
> configuration described in 70846).  This example cycles through
> flattening based on "index", "group" and "annotation" with the example
> menu configuration.
>
> For "prefix" and "annotation" configurations, it appears to work
> correctly, as pressing "M-<down>" when the menu prompt is displayed, I
> can see both entries identified in the "*Completions*" buffer.
>
> However, when I do this with "imenu-flatten" set to "group" and press
> "M-<down>" to display the completions window, the window indicates "2
> possible completions" but only one is actually displayed and
> selectable (i.e., the one under "Bar").  The menu entry "Foo" under
> "Baz" is not displayed at all and it appears there is no way to select
> it.
>
> ```
> ;; begin
> (progn
>   (require 'imenu)
>   (dolist (flatten '(prefix group annotation))
>     (setq imenu-flatten flatten)
>
>     (imenu-choose-buffer-index (format "(%s) Index item: " flatten)
>                                `(("Bar" . (("Foo" . ,(point-min-marker))))
>                                  ("Baz" . (("Foo" . ,(point-max-marker))))))))
> ;; end
> ```

Sorry for leaving out of documentation an unapparent mention
of `completions-group`.  We are discussing this currently at
https://mail.gnu.org/archive/html/emacs-devel/2024-08/msg00241.html
So a prerequisite would be to use `(setopt completions-group t)`.
But currently this should be mentioned in the docstring.

Also in the same discussion we came to conclusion that
`M-<down>` can't be used to select imenu items for
`annotation` and `group`.  So this limitation was
documented recently in the docstring of `imenu-flatten`:

  @@ -158,6 +158,9 @@ imenu-flatten
   with a suffix that is the section name to which it belongs.
   If the value is `group', split completion candidates into groups
   according to the sections.
  +Since the values `annotation' and `group' rely on text properties,
  +you can use them only by selecting candidates from the completions
  +buffer, not by typing in the minibuffer.

Otherwise, `group` should work nicely when using `<down>`
with `minibuffer-visible-completions`.



  • bug#73117:... Troy Brown
    • bug#7... Juri Linkov
      • b... Troy Brown
        • ... Juri Linkov
          • ... Troy Brown
          • ... Bug reports for GNU Emacs, the Swiss army knife of text editors
            • ... Troy Brown

Reply via email to