Morgan Smith <morgan.j.sm...@outlook.com> writes: > With a file like this: > > * headline 1 > ** headline 2 > > We currently produce an imenu tree that looks like this: > > '(("headline 1" ("headline 2" . marker-2))) > > imenu has no clue where "headline 1" is located and thus the user > can't navigate to it. With this patch installed imenu knows where > non-leaf headlines are as the tree will now look like this: > > '(("headline 1" . marker-1) > ("headline 1" ("headline 2" . marker-2)))
Thanks! This makes sense. > Quirks: > > With the default `imenu-flatten' value of nil, it is still impossible > to visit non-leaf headlines and no change is perceived. But no regressions, right? Especially in older Emacs versions with `imenu-flatten' not yet available. > Setting `imenu-flatten' to 'group works as expected with the quirk > that top level headlines don't end up in the group. We may add a top-level group, can't we? > Ex: > * Headline 1 > Group is "*" > Setting the group to "Headline 1" somehow might be nice but would > require upstream changes in imenu. > ** Headline 2 > Group is "Headline 1" > *** Headline 3 > Group is "Headline 1:Headline 2" > > Everything seems to work as expected when `imenu-flatten' is set to > 'prefix or 'annotation. We may also consider changing the default value of `imenu-flatten' in Org buffers to non-nil. But what would be the best default? -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>