summaryrefslogtreecommitdiff
path: root/lisp/imenu.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/imenu.el')
-rw-r--r--lisp/imenu.el15
1 files changed, 11 insertions, 4 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el
index a87860f0065..dcd816cb7a8 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -87,7 +87,7 @@ This might not yet be honored by all index-building functions."
(defcustom imenu-auto-rescan-maxout 600000
"Imenu auto-rescan is disabled in buffers larger than this size (in bytes).
Also see `imenu-max-index-time'."
- :type 'integer
+ :type 'natnum
:version "26.2")
(defcustom imenu-use-popup-menu 'on-mouse
@@ -132,7 +132,7 @@ element should come before the second. The arguments are cons cells;
(defcustom imenu-max-items 25
"Maximum number of elements in a mouse menu for Imenu."
- :type 'integer)
+ :type 'natnum)
(defcustom imenu-space-replacement "."
"The replacement string for spaces in index names.
@@ -464,14 +464,14 @@ Non-nil arguments are in recursive calls."
`(keymap ,title
,@(mapcar
(lambda (item)
- `(,(car item) ,(car item)
+ `(,(intern (car item)) ,(car item)
,@(cond
((imenu--subalist-p item)
(imenu--create-keymap (car item) (cdr item) cmd))
(t
(lambda () (interactive)
(if cmd (funcall cmd item) item))))))
- alist)))
+ (seq-filter #'identity alist))))
(defun imenu--in-alist (str alist)
"Check whether the string STR is contained in multi-level ALIST."
@@ -899,6 +899,13 @@ for more information."
(`(,name . ,pos) (imenu (list name pos imenu-default-goto-function)))
(_ (error "Unknown imenu item: %S" index-item)))))
+(defun imenu-flush-cache ()
+ "Flush the current imenu cache.
+This forces a full rescan of the buffer to recreate the index alist
+next time `imenu' is invoked."
+ (imenu--cleanup)
+ (setq imenu--index-alist nil))
+
(provide 'imenu)
;;; imenu.el ends here