diff options
author | Richard M. Stallman <rms@gnu.org> | 2002-03-11 09:16:37 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2002-03-11 09:16:37 +0000 |
commit | a3841d3be9d822834a12404c10073d49664a2837 (patch) | |
tree | 26249c11b5b143c37f8a153c19f888353084b212 /lisp/imenu.el | |
parent | 0a8c82250e3c9674cc574393c1727b9b8fd58461 (diff) | |
download | emacs-a3841d3be9d822834a12404c10073d49664a2837.tar.gz |
(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.
Diffstat (limited to 'lisp/imenu.el')
-rw-r--r-- | lisp/imenu.el | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el index 0dce3a98a6e..eb30f94182f 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -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))))))) |