GNU bug report logs -
#33695
27.0.50; which-function reports wrong imenu information
Previous Next
Reported by: Alex Branham <alex.branham <at> gmail.com>
Date: Mon, 10 Dec 2018 18:59:02 UTC
Severity: normal
Found in version 27.0.50
Done: Alex Branham <alex.branham <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On Tue 11 Dec 2018 at 02:35, martin rudalics <rudalics <at> gmx.at> wrote:
>> - Have `which-function' update `imenu--index-alist' before checking it
>> (also easy to implement, but updating the index could be slow in large
>> buffers)
>
> Maybe we should try to do what 'imenu-update-menubar' does here:
> Compare the values of 'imenu-menubar-modified-tick' and
> 'buffer-chars-modified-tick' and update 'imenu--index-alist' if they
> differ.
Thanks for the reply. This seems to work well, though I haven't tried it
in an enormous buffer.
Alex
From d794595fdbaff40df2f7769b22dd05a7786e56e7 Mon Sep 17 00:00:00 2001
From: Alex Branham <alex.branham <at> gmail.com>
Date: Tue, 11 Dec 2018 08:29:50 -0600
Subject: [PATCH] which-function: Do not display outdated imenu information
* lisp/progmodes/which-func.el (which-function): Update
imenu--index-alist if needed. Bug #33695
---
lisp/progmodes/which-func.el | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
index 7604be0c25..bbdfa2fff7 100644
--- a/lisp/progmodes/which-func.el
+++ b/lisp/progmodes/which-func.el
@@ -281,7 +281,10 @@ which-function
;; If Imenu is loaded, try to make an index alist with it.
(when (and (null name)
- (boundp 'imenu--index-alist) (null imenu--index-alist)
+ (boundp 'imenu--index-alist)
+ (or (null imenu--index-alist)
+ ;; Update if outdated
+ (/= (buffer-chars-modified-tick) imenu-menubar-modified-tick))
(null which-function-imenu-failed))
(ignore-errors (imenu--make-index-alist t))
(unless imenu--index-alist
--
2.19.1
This bug report was last modified 6 years and 151 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.