emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A bug fix for `which-func.el'


From: Paul Pogonyshev
Subject: Re: A bug fix for `which-func.el'
Date: Sun, 5 Dec 2004 17:37:18 +0200
User-agent: KMail/1.4.3

I wrote:
> This one is a certain improvement.

Maybe I didn't make it clear.

Turn on Which Function mode and evaluate

        (add-hook 'which-func-functions 'ignore)

Fine, the mode keeps working.  Now add this dummy hook as local in
some buffer:

        (add-hook 'which-func-functions 'ignore nil t)

The mode dies out, because the loop cannot handle local hooks.  My
patch replaces the custom loop with a call to standard function,
which is bug-free and is generally better to use.


2004-12-05  Paul Pogonyshev  <address@hidden>

        * progmodes/which-func.el (which-function): Use
        `run-hook-with-args-until-success' instead of a custom loop.
        Fixes bug with local hooks.


--- which-func.el       17 Aug 2004 01:46:26 +0300      1.6
+++ which-func.el       03 Dec 2004 21:31:04 +0200      
@@ -243,15 +243,9 @@ It calls them sequentially, and if any r
 Uses `which-function-functions', `imenu--index-alist'
 or `add-log-current-defun-function'.
 If no function name is found, return nil."
-  (let (name)
-    ;; Try the which-function-functions functions first.
-    (let ((hooks which-func-functions))
-      (while hooks
-       (let ((value (funcall (car hooks))))
-         (when value
-           (setq name value
-                 hooks nil)))
-       (setq hooks (cdr hooks))))
+  (let ((name
+        ;; Try the `which-function-functions' functions first.
+        (run-hook-with-args-until-success 'which-func-functions)))
 
     ;; If Imenu is loaded, try to make an index alist with it.
     (when (and (null name)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]