comparison lisp/progmodes/which-func.el @ 58774:212ad195d26f

(which-function): Use `run-hook-with-args-until-success' instead of a custom loop. Fixes bug with local hooks.
author Thien-Thi Nguyen <ttn@gnuvola.org>
date Sun, 05 Dec 2004 16:56:29 +0000
parents f54e121491eb
children dc55bf752d7c f2ebccfa87d4
comparison
equal deleted inserted replaced
58773:12756b0ec526 58774:212ad195d26f
241 (defun which-function () 241 (defun which-function ()
242 "Return current function name based on point. 242 "Return current function name based on point.
243 Uses `which-function-functions', `imenu--index-alist' 243 Uses `which-function-functions', `imenu--index-alist'
244 or `add-log-current-defun-function'. 244 or `add-log-current-defun-function'.
245 If no function name is found, return nil." 245 If no function name is found, return nil."
246 (let (name) 246 (let ((name
247 ;; Try the which-function-functions functions first. 247 ;; Try the `which-function-functions' functions first.
248 (let ((hooks which-func-functions)) 248 (run-hook-with-args-until-success 'which-func-functions)))
249 (while hooks
250 (let ((value (funcall (car hooks))))
251 (when value
252 (setq name value
253 hooks nil)))
254 (setq hooks (cdr hooks))))
255 249
256 ;; If Imenu is loaded, try to make an index alist with it. 250 ;; If Imenu is loaded, try to make an index alist with it.
257 (when (and (null name) 251 (when (and (null name)
258 (boundp 'imenu--index-alist) (null imenu--index-alist) 252 (boundp 'imenu--index-alist) (null imenu--index-alist)
259 (null which-function-imenu-failed)) 253 (null which-function-imenu-failed))