mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-29 11:02:01 +00:00
(imenu-menubar-modified-tick): Renamed from
imenu-update-menubar-modified-tick. (imenu-update-menubar): Update imenu-menubar-modified-tick whenever outer condition succeeds.
This commit is contained in:
parent
43711c229f
commit
9fb980fc3d
@ -980,20 +980,21 @@ 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
|
||||
(defvar imenu-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)
|
||||
(make-variable-buffer-local 'imenu-menubar-modified-tick)
|
||||
|
||||
(defun imenu-update-menubar ()
|
||||
(and (current-local-map)
|
||||
(when (and (current-local-map)
|
||||
(keymapp (lookup-key (current-local-map) [menu-bar index]))
|
||||
(not (eq (buffer-modified-tick)
|
||||
imenu-update-menubar-modified-tick))
|
||||
imenu-menubar-modified-tick)))
|
||||
(setq imenu-menubar-modified-tick (buffer-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.
|
||||
(or (equal index-alist imenu--last-menubar-index-alist)
|
||||
(unless (equal index-alist imenu--last-menubar-index-alist)
|
||||
(let (menu menu1 old)
|
||||
(setq imenu--last-menubar-index-alist index-alist)
|
||||
(setq index-alist (imenu--split-submenus index-alist))
|
||||
@ -1003,8 +1004,6 @@ This value becomes local in every buffer when it is set.")
|
||||
(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…
Reference in New Issue
Block a user