unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Troy Brown <brownts@troybrown.dev>
To: Juri Linkov <juri@linkov.net>
Cc: 73117@debbugs.gnu.org
Subject: bug#73117: 30.0.90; Imenu missing entries when flattening by group
Date: Sun, 8 Sep 2024 10:19:26 -0400	[thread overview]
Message-ID: <CABvCZ42rd1sf7hpdXLwLXuXfN1bLneVuA71KB2mRHaQBNBTjiw@mail.gmail.com> (raw)
In-Reply-To: <86v7z6skkj.fsf@mail.linkov.net>

On Sun, Sep 8, 2024 at 2:57 AM Juri Linkov <juri@linkov.net> wrote:
>
> > ```
> > ;; 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`.

Hi Juri,

I did see the text in the diff above.  I assumed that was indicating
that you need to use the completions buffer to distinguish between the
identically named items (although after re-reading it, maybe it
affects the selection too).  I was using M-<down> to pop-up the
completions buffer so that I could see those distinctions.  Maybe
using `(setopt completion-auto-help t)` and hitting TAB is a better
method.  Either way, I'm just trying to display the completions
buffer.  This does work for the "annotations" setting as I see both
entries with the suffix annotation in the completions buffer.  Maybe
there is a different issue using M-<down> for the selection, but my
issue is that I can't get the completions buffer to even display all
of the items.

Just to be clear I'm running "emacs -Q" on the latest in the emacs-30
branch as of yesterday.  I ran the code snippet I posted in the
original email by running `eval-last-sexp` in the scratch buffer.

I did try adding your suggested settings to the above code snippet,
but they did not seem to improve anything with regards to what shows
up in the completions buffer:
```
(setopt completions-group t)
(setopt minibuffer-visible-completions t)
```

The following is what I see in the "*Completions*" buffer for all
three settings of `imenu-flatten` (i.e., "prefix", "group" and
"annotation").  Notice that the second output (which is the "group"
setting) only shows a single entry, the one for Bar/Foo.  The "Bar"
group is displayed and the "Foo" entry under it is also displayed, but
the "Baz" group is completely missing (even though it says "2 possible
completions").  This is the issue I'm having.

--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.

2 possible completions:
Bar:Foo
Baz: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.

2 possible completions:
     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.

2 possible completions:
Foo (Bar)
Foo (Baz)
--8<---------------cut here---------------end--------------->8---





  reply	other threads:[~2024-09-08 14:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-08  1:41 bug#73117: 30.0.90; Imenu missing entries when flattening by group Troy Brown
2024-09-08  6:53 ` Juri Linkov
2024-09-08 14:19   ` Troy Brown [this message]
2024-09-08 16:35     ` Juri Linkov
2024-09-08 17:31       ` Troy Brown
2024-09-20  6:58         ` Juri Linkov
2024-09-08 18:28       ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 19:25         ` Troy Brown
2024-09-15 15:58           ` Troy Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABvCZ42rd1sf7hpdXLwLXuXfN1bLneVuA71KB2mRHaQBNBTjiw@mail.gmail.com \
    --to=brownts@troybrown.dev \
    --cc=73117@debbugs.gnu.org \
    --cc=juri@linkov.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).