mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
(imenu-update-menubar-modified-tick): New variable.
(imenu-update-menubar): Don't call imenu--make-index-alist if buffer has not changed since last time.
This commit is contained in:
parent
0a8c82250e
commit
a3841d3be9
1 changed files with 9 additions and 0 deletions
|
|
@ -980,9 +980,16 @@ A trivial interface to `imenu-add-to-menubar' suitable for use in a hook."
|
|||
|
||||
(defvar imenu-buffer-menubar nil)
|
||||
|
||||
(defvar imenu-update-menubar-modified-tick 0
|
||||
"The value of (buffer-modified-tick) as of last call to `imenu-update-menubar'.
|
||||
This value becomes local in every buffer when it is set.")
|
||||
(make-variable-buffer-local 'imenu-update-menubar-modified-tick)
|
||||
|
||||
(defun imenu-update-menubar ()
|
||||
(and (current-local-map)
|
||||
(keymapp (lookup-key (current-local-map) [menu-bar index]))
|
||||
(not (eq (buffer-modified-tick)
|
||||
imenu-update-menubar-modified-tick))
|
||||
(let ((index-alist (imenu--make-index-alist t)))
|
||||
;; Don't bother updating if the index-alist has not changed
|
||||
;; since the last time we did it.
|
||||
|
|
@ -996,6 +1003,8 @@ A trivial interface to `imenu-add-to-menubar' suitable for use in a hook."
|
|||
(if (< 1 (length (cdr menu)))
|
||||
(cdr menu)
|
||||
(cdr (car (cdr menu))))))
|
||||
(setq imenu-update-menubar-modified-tick
|
||||
(buffer-modified-tick))
|
||||
(setq old (lookup-key (current-local-map) [menu-bar index]))
|
||||
(setcdr old (cdr menu1)))))))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue