GNU bug report logs - #61685
28.2; imenu in org-mode is wrong for the first org file opened in a given session

Previous Next

Package: emacs;

Reported by: Kuba Orlik <kontakt <at> kuba-orlik.name>

Date: Tue, 21 Feb 2023 18:38:01 UTC

Severity: normal

Found in version 28.2

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61685 in the body.
You can then email your comments to 61685 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#61685; Package emacs. (Tue, 21 Feb 2023 18:38:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kuba Orlik <kontakt <at> kuba-orlik.name>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 21 Feb 2023 18:38:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kuba Orlik <kontakt <at> kuba-orlik.name>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.2; imenu in org-mode is wrong for the first org file opened in a
 given session
Date: Tue, 21 Feb 2023 19:37:50 +0100
When opening an org file and running imenu, the structure is not parsed
properly. I need to kill the buffer visiting the org file and find it
again. This only affects the first org file opened in a given Emacs
session.

To reproduce:

1. Create an org file with the following contents:

```
* Some Heading
** subheading
** subheading 2
* Another heading
** another subheading
** another subheading 2
```

save it as repro.org

2. Run `emacs -Q repro.org`

3. Eval `(imenu-add-menubar-index)` in the org buffer

4. Check the results in the `index` menu in the menu-bar: they are
   wrong. they should be nested to reflect the structure of the
   headings, but they are just flat.

5. Kill the org buffer (C-x k)

6. Open the org file again, without closing emacs

7. Eval `(imenu-add-menubar-index)` in the org buffer

8. Check the `index` menu in the menu-bar: the headings are now properly
parsed and nested.


In GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.36, cairo version 1.17.6)
 of 2023-01-03 built on 2
Windowing system distributor 'The X.Org Foundation', version 11.0.12201008
System Description: Arch Linux

Configured using:
 'configure --sysconfdir=/etc --prefix=/usr --libexecdir=/usr/lib
 --localstatedir=/var --with-cairo --with-harfbuzz --with-libsystemd
 --with-modules --with-x-toolkit=gtk3 'CFLAGS=-march=x86-64
 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2
 -Wformat -Werror=format-security -fstack-clash-protection
 -fcf-protection -g
 -ffile-prefix-map=/build/emacs/src=/usr/src/debug/emacs -flto=auto'
 'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto=auto''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY
PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE
XIM XPM GTK3 ZLIB

Important settings:
  value of $LC_MONETARY: pl_PL.UTF-8
  value of $LC_NUMERIC: pl_PL.UTF-8
  value of $LC_TIME: pl_PL.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Org

Minor modes in effect:
  mu4e-column-faces-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  global-prettier-mode: t
  shell-dirtrack-mode: t
  apheleia-global-mode: t
  apheleia-mode: t
  counsel-projectile-mode: t
  projectile-mode: t
  counsel-mode: t
  ivy-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  delete-selection-mode: t
  global-tree-sitter-mode: t
  straight-use-package-mode: t
  straight-package-neutering-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/kuba/.emacs.d/straight/build/transient/transient hides /usr/share/emacs/28.2/lisp/transient

Features:
(shadow emacsbug re-builder descr-text misearch multi-isearch ffap
cl-print help-fns radix-tree apropos cus-edit cus-start cus-load
cal-move apheleia org-archive org-colview sort gnus-cite smiley
shr-color mm-archive mail-extr qp diary-lib diary-loaddefs cal-iso
org-duration vc-git vc-dispatcher org-element avl-tree ol-eww eww
url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect
gnus-search eieio-opt speedbar ezimage dframe ol-docview doc-view
jka-compr image-mode exif ol-bibtex ol-bbdb ol-w3m ol-doi org-link-doi
face-remap org-agenda org-refile solarized-selenized-light-theme
solarized-palettes solarized solarized-faces mu4e-column-faces inline
memoize memoize-autoloads mu4e mu4e-org org ob ob-tangle ob-ref ob-lob
ob-table ob-exp org-macro org-footnote org-src ob-comint org-pcomplete
org-list org-faces org-entities noutline outline org-version
ob-emacs-lisp ob-core ob-eval org-table oc-basic bibtex ol org-keys oc
org-compat advice org-macs org-loaddefs find-func mu4e-main mu4e-view
gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum gnus-group
gnus-undo gnus-start gnus-dbus dbus gnus-cloud nnimap nnmail mail-source
utf7 netrc nnoo gnus-spec gnus-int gnus-range gnus-win gnus nnheader
wid-edit cal-menu calendar cal-loaddefs mu4e-headers mu4e-compose
mu4e-draft mu4e-actions smtpmail sendmail mu4e-search mu4e-lists
mu4e-bookmarks mu4e-mark mu4e-message shr kinsoku svg xml dom flow-fill
mule-util hl-line mu4e-contacts mu4e-update mu4e-folders mu4e-server
mu4e-context mu4e-vars mu4e-helpers mu4e-config magit-bookmark bookmark
ido mu4e-column-faces-autoloads pcase dockerfile-mode-autoloads
web-mode-autoloads magit-submodule magit-obsolete magit-blame
magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch
magit-clone magit-remote magit-commit magit-sequence magit-notes
magit-worktree magit-tag magit-merge magit-branch magit-reset
magit-files magit-refs magit-status magit magit-repos magit-apply
magit-wip magit-log which-func imenu magit-diff smerge-mode diff-mode
git-commit rx log-edit message rmc puny rfc822 mml mml-sec epa derived
epg rfc6068 epg-config gnus-util rmail rmail-loaddefs mm-decode
mm-bodies mm-encode mailabbrev mail-utils gmm-utils mailheader pcvs-util
add-log magit-core magit-autorevert autorevert filenotify magit-margin
magit-transient magit-process with-editor magit-mode transient magit-git
magit-base magit-section crm compat-27 compat-26 compat compat-macs
magit-autoloads magit-section-autoloads git-commit-autoloads
with-editor-autoloads transient-autoloads compat-autoloads prettier
editorconfig editorconfig-core editorconfig-core-handle
editorconfig-fnmatch package browse-url url-handlers tramp
tramp-loaddefs trampver tramp-integration files-x tramp-compat shell
pcomplete parse-time iso8601 time-date ls-lisp format-spec nvm f
f-shortdoc shortdoc dash s iter2 generator prettier-autoloads
editorconfig-autoloads nvm-autoloads f-autoloads s-autoloads
iter2-autoloads apheleia-autoloads easy-mmode edmacro kmacro
counsel-projectile ivy-prescient prescient char-fold projectile lisp-mnt
mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr grep
ibuf-ext ibuffer ibuffer-loaddefs thingatpt counsel xdg xref project
swiper ivy ivy-faces ivy-overlay colir color ivy-prescient-autoloads
prescient-autoloads counsel-projectile-autoloads counsel-autoloads
swiper-autoloads ivy-autoloads projectile-autoloads undo-tree diff queue
undo-tree-autoloads queue-autoloads finder-inf undo-fu-autoloads delsel
server tree-sitter-langs tree-sitter-langs-build tar-mode arc-mode
archive-mode url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util url-parse auth-source eieio
eieio-core eieio-loaddefs password-cache json url-vars mailcap pp
tree-sitter-hl tree-sitter tree-sitter-load tree-sitter-cli map tsc
tsc-dyn tsc-dyn-get compile text-property-search comint ansi-color ring
dired-aux dired dired-loaddefs tsc-obsolete tree-sitter-langs-autoloads
tree-sitter-autoloads tsc-autoloads solarized-theme-autoloads
dash-autoloads info straight-autoloads cl-seq cl-extra help-mode seq
byte-opt straight subr-x cl-macs gv cl-loaddefs cl-lib bytecomp
byte-compile cconv iso-transl tooltip eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 3070189 182089)
 (symbols 48 52783 17)
 (strings 32 444754 5459)
 (string-bytes 1 9903280)
 (vectors 16 93443)
 (vector-slots 8 2228997 183968)
 (floats 8 598 463)
 (intervals 56 421229 21137)
 (buffers 992 64))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61685; Package emacs. (Wed, 22 Feb 2023 11:14:02 GMT) Full text and rfc822 format available.

Message #8 received at 61685 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Kuba Orlik <kontakt <at> kuba-orlik.name>
Cc: 61685 <at> debbugs.gnu.org
Subject: Re: bug#61685: 28.2; imenu in org-mode is wrong for the first org
 file opened in a given session
Date: Wed, 22 Feb 2023 11:14:20 +0000
[Message part 1 (text/plain, inline)]
Kuba Orlik via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs <at> gnu.org> writes:

> When opening an org file and running imenu, the structure is not parsed
> properly. I need to kill the buffer visiting the org file and find it
> again. This only affects the first org file opened in a given Emacs
> session.
>
> To reproduce:
> ...

Org activates Imenu support only after Imenu is loaded. Effective only
in Org buffers opened after Imenu is enabled.

I tried to clarify this in the manual.

See the attached.

[0001-org-manual.org-Clarify-that-Imenu-support-is-activat.patch (text/x-patch, inline)]
From cbab9ebf5521d327937e9e30e2de43b39c5dcdc5 Mon Sep 17 00:00:00 2001
Message-Id: <cbab9ebf5521d327937e9e30e2de43b39c5dcdc5.1677064383.git.yantar92 <at> posteo.net>
From: Ihor Radchenko <yantar92 <at> posteo.net>
Date: Wed, 22 Feb 2023 14:11:11 +0300
Subject: [PATCH] org-manual.org: Clarify that Imenu support is activated in
 future Org buffers

* doc/org-manual.org (Packages that Org cooperates with): Clarify that
imenu should be loaded before Org mode is loaded in current buffer.

Reported-by: Kuba Orlik <kontakt <at> kuba-orlik.name>
Link: Emacs bug#61685
---
 doc/org-manual.org | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 5b6633417..6a625b42a 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -20327,6 +20327,10 @@ *** Packages that Org cooperates with
   By default the index is two levels deep---you can modify the
   depth using the option ~org-imenu-depth~.
 
+  Org activates Imenu support only in the buffers opened after loading
+  Imenu library.  To enable Imenu support in an already opened Org
+  buffer, reload Org.
+
 - =speedbar.el= by Eric\nbsp{}M.\nbsp{}Ludlam ::
   #+cindex: @file{speedbar.el}
 
-- 
2.39.1

[Message part 3 (text/plain, inline)]
-- 
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>

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61685; Package emacs. (Sun, 02 Apr 2023 14:23:01 GMT) Full text and rfc822 format available.

Message #11 received at 61685 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Kuba Orlik <kontakt <at> kuba-orlik.name>
Cc: 61685 <at> debbugs.gnu.org
Subject: Re: bug#61685: 28.2; imenu in org-mode is wrong for the first org
 file opened in a given session
Date: Sun, 02 Apr 2023 14:25:02 +0000
Ihor Radchenko <yantar92 <at> posteo.net> writes:

> Org activates Imenu support only after Imenu is loaded. Effective only
> in Org buffers opened after Imenu is enabled.
>
> I tried to clarify this in the manual.

Applied, onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=cbab9ebf5

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




Reply sent to Stefan Kangas <stefankangas <at> gmail.com>:
You have taken responsibility. (Sun, 17 Sep 2023 11:56:01 GMT) Full text and rfc822 format available.

Notification sent to Kuba Orlik <kontakt <at> kuba-orlik.name>:
bug acknowledged by developer. (Sun, 17 Sep 2023 11:56:01 GMT) Full text and rfc822 format available.

Message #16 received at 61685-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Ihor Radchenko <yantar92 <at> posteo.net>, Kuba Orlik <kontakt <at> kuba-orlik.name>
Cc: 61685-done <at> debbugs.gnu.org
Subject: Re: bug#61685: 28.2; imenu in org-mode is wrong for the first org
 file opened in a given session
Date: Sun, 17 Sep 2023 04:55:06 -0700
Ihor Radchenko <yantar92 <at> posteo.net> writes:

> Ihor Radchenko <yantar92 <at> posteo.net> writes:
>
>> Org activates Imenu support only after Imenu is loaded. Effective only
>> in Org buffers opened after Imenu is enabled.
>>
>> I tried to clarify this in the manual.
>
> Applied, onto main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=cbab9ebf5

It seems like this issue was resolved, but was left open in the bug
tracker.  I'm therefore closing it now.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 16 Oct 2023 11:24:13 GMT) Full text and rfc822 format available.

This bug report was last modified 193 days ago.

Previous Next


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