Mercurial > emacs
changeset 43832:5d834c3f5d18
(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.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 11 Mar 2002 09:16:37 +0000 |
parents | 7837693f5bac |
children | 37bc1e73d4b3 |
files | lisp/imenu.el |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/imenu.el Mon Mar 11 09:15:27 2002 +0000 +++ b/lisp/imenu.el Mon Mar 11 09:16:37 2002 +0000 @@ -980,9 +980,16 @@ (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 @@ (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)))))))