Subject: bug#37460: Patch for bug#37460: Imenu bug when imenu-auto-rescan is enabled

From: Alex Peitsinis <[email-masked]>
Date: Thu, 19 Sep 2019 18:18:53 +0100

I've attached a patch to fix the bug. The fix is that, if
`imenu-auto-rescan` is enabled, the current `imenu--index-alist` is
returned, otherwise it's returned with the `*Rescan*` option.
From 23d48d0dfa062f1e0c58ea8ff03ea126a1f14220 Mon Sep 17 00:00:00 2001
From: Alex Peitsinis <[email-masked]>
Date: Thu, 19 Sep 2019 18:06:44 +0100
Subject: [PATCH] Fix imenu bug when imenu-auto-rescan is enabled

---
 lisp/imenu.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/imenu.el b/lisp/imenu.el
index 9df597b..f8bfc40 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -510,7 +510,8 @@ imenu--make-index-alist
        "No items suitable for an index found in this buffer"))
   (or imenu--index-alist
       (setq imenu--index-alist (list nil)))
-  (unless imenu-auto-rescan
+  (if imenu-auto-rescan
+      imenu--index-alist
     ;; Add a rescan option to the index.
     (cons imenu--rescan-item imenu--index-alist)))
 
-- 
2.7.4