175 |
;;;###autoload |
;;;###autoload |
176 |
(defalias 'which-func-mode 'which-function-mode) |
(defalias 'which-func-mode 'which-function-mode) |
177 |
|
|
178 |
|
(defvar which-func-update-timer nil) |
179 |
|
|
180 |
;; This is the name people would normally expect. |
;; This is the name people would normally expect. |
181 |
;;;###autoload |
;;;###autoload |
182 |
(define-minor-mode which-function-mode |
(define-minor-mode which-function-mode |
190 |
(if which-function-mode |
(if which-function-mode |
191 |
;;Turn it on |
;;Turn it on |
192 |
(progn |
(progn |
193 |
(add-hook 'post-command-idle-hook 'which-func-update) |
(setq which-func-update-timer |
194 |
|
(run-with-idle-timer idle-update-delay t 'which-func-update)) |
195 |
(dolist (buf (buffer-list)) |
(dolist (buf (buffer-list)) |
196 |
(with-current-buffer buf |
(with-current-buffer buf |
197 |
(setq which-func-mode |
(setq which-func-mode |
198 |
(or (eq which-func-modes t) |
(or (eq which-func-modes t) |
199 |
(member major-mode which-func-modes)))))) |
(member major-mode which-func-modes)))))) |
200 |
;; Turn it off |
;; Turn it off |
201 |
(remove-hook 'post-command-idle-hook 'which-func-update) |
(cancel-timer which-func-update-timer) |
202 |
|
(setq which-func-update-timer nil) |
203 |
(dolist (buf (buffer-list)) |
(dolist (buf (buffer-list)) |
204 |
(with-current-buffer buf (setq which-func-mode nil))))) |
(with-current-buffer buf (setq which-func-mode nil))))) |
205 |
|
|
226 |
(while alist |
(while alist |
227 |
(setq elem (car-safe alist) |
(setq elem (car-safe alist) |
228 |
alist (cdr-safe alist)) |
alist (cdr-safe alist)) |
229 |
;; Elements of alist are either ("name" . marker), or |
;; Elements of alist are either ("name" . marker), or |
230 |
;; ("submenu" ("name" . marker) ... ). |
;; ("submenu" ("name" . marker) ... ). |
231 |
(unless (listp (cdr elem)) |
(unless (listp (cdr elem)) |
232 |
(setq elem (list elem))) |
(setq elem (list elem))) |