comparison lisp/which-func.el @ 35990:7ded5b71182f

(which-func-mode): Invert which-func-mode-global. Fix from Juanma Barranquero <lektu@uol.com.br>.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 08 Feb 2001 22:14:31 +0000
parents 683f3781ab81
children a72b3da04728
comparison
equal deleted inserted replaced
35989:72da309edab7 35990:7ded5b71182f
186 186
187 With prefix ARG, turn Which Function mode on iff arg is positive, 187 With prefix ARG, turn Which Function mode on iff arg is positive,
188 and off otherwise." 188 and off otherwise."
189 (interactive "P") 189 (interactive "P")
190 (setq which-func-mode-global 190 (setq which-func-mode-global
191 (or (and (null arg) which-func-mode-global) 191 (and (or arg (not which-func-mode-global))
192 (<= (prefix-numeric-value arg) 0))) 192 (> (prefix-numeric-value arg) 0)))
193 (if which-func-mode-global 193 (if which-func-mode-global
194 ;; Turn it off 194 ;;Turn it on
195 (progn 195 (progn
196 (remove-hook 'post-command-idle-hook 'which-func-update) 196 (add-hook 'post-command-idle-hook 'which-func-update)
197 (dolist (buf (buffer-list)) 197 (dolist (buf (buffer-list))
198 (with-current-buffer buf (setq which-func-mode nil)))) 198 (with-current-buffer buf
199 ;;Turn it on 199 (setq which-func-mode
200 (add-hook 'post-command-idle-hook 'which-func-update) 200 (or (eq which-func-modes t)
201 (member major-mode which-func-modes))))))
202 ;; Turn it off
203 (remove-hook 'post-command-idle-hook 'which-func-update)
201 (dolist (buf (buffer-list)) 204 (dolist (buf (buffer-list))
202 (with-current-buffer buf 205 (with-current-buffer buf (setq which-func-mode nil)))))
203 (setq which-func-mode
204 (or (eq which-func-modes t)
205 (member major-mode which-func-modes)))))))
206 206
207 (defun which-function () 207 (defun which-function ()
208 "Return current function name based on point. 208 "Return current function name based on point.
209 If `imenu--index-alist' does not exist, or is empty or if point 209 If `imenu--index-alist' does not exist, or is empty or if point
210 is located before first function, returns nil." 210 is located before first function, returns nil."