# HG changeset patch # User Juanma Barranquero # Date 1053828165 0 # Node ID 62a2a306bc435b47a973b8549c2c21f66af6822e # Parent c7730f2ad4849b1e16e5d1c49d5041759f149d31 (which-func-update-timer): New variable. (which-function-mode): Use it. diff -r c7730f2ad484 -r 62a2a306bc43 lisp/which-func.el --- a/lisp/which-func.el Sun May 25 01:45:14 2003 +0000 +++ b/lisp/which-func.el Sun May 25 02:02:45 2003 +0000 @@ -175,6 +175,8 @@ ;;;###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 @@ (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 @@ (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)))