summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJuanma Barranquero <lekktu@gmail.com>2003-05-25 02:02:45 +0000
committerJuanma Barranquero <lekktu@gmail.com>2003-05-25 02:02:45 +0000
commit0ec0b89fe2c87d900f2c60ec0ca9065c57509686 (patch)
tree01d5daec298e8f0f7a314c943bf6e9b0cc10d230 /lisp
parentea82f0df29e71d1e135ba4e1cce9c837427c8015 (diff)
downloademacs-0ec0b89fe2c87d900f2c60ec0ca9065c57509686.tar.gz
emacs-0ec0b89fe2c87d900f2c60ec0ca9065c57509686.tar.bz2
emacs-0ec0b89fe2c87d900f2c60ec0ca9065c57509686.zip
(which-func-update-timer): New variable.
(which-function-mode): Use it.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/which-func.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/which-func.el b/lisp/which-func.el
index d6bc88c37ca..4b1dfca6f5b 100644
--- a/lisp/which-func.el
+++ b/lisp/which-func.el
@@ -175,6 +175,8 @@ It creates the Imenu index for the buffer, if necessary."
;;;###autoload
(defalias 'which-func-mode 'which-function-mode)
+(defvar which-func-update-timer nil)
+
;; This is the name people would normally expect.
;;;###autoload
(define-minor-mode which-function-mode
@@ -188,14 +190,16 @@ and off otherwise."
(if which-function-mode
;;Turn it on
(progn
- (add-hook 'post-command-idle-hook 'which-func-update)
+ (setq which-func-update-timer
+ (run-with-idle-timer idle-update-delay t 'which-func-update))
(dolist (buf (buffer-list))
(with-current-buffer buf
(setq which-func-mode
(or (eq which-func-modes t)
(member major-mode which-func-modes))))))
;; Turn it off
- (remove-hook 'post-command-idle-hook 'which-func-update)
+ (cancel-timer which-func-update-timer)
+ (setq which-func-update-timer nil)
(dolist (buf (buffer-list))
(with-current-buffer buf (setq which-func-mode nil)))))
@@ -222,7 +226,7 @@ If no function name is found, return nil."
(while alist
(setq elem (car-safe alist)
alist (cdr-safe alist))
- ;; Elements of alist are either ("name" . marker), or
+ ;; Elements of alist are either ("name" . marker), or
;; ("submenu" ("name" . marker) ... ).
(unless (listp (cdr elem))
(setq elem (list elem)))