Subject: which-function fails to find current function name

From: Ralph Schleicher <[email-masked]>
Date: Tue, 15 Mar 2011 21:11:21 +0100

Hi,

which-function fails to find the current function name if a major
mode adjusts add-log-current-defun-header-regexp but does not bind
add-log-current-defun-function.  Thus, which-function shall call
add-log-current-defun to query the current function name.  Below
is a patch together with a change log entry.

2011-03-11  Ralph Schleicher  <[email-masked]>

	* progmodes/which-func.el (which-function): Call add-log-current-defun
	instead of evaluating add-log-current-defun-function directly.

--- emacs-23.3/lisp/progmodes/which-func.el.orig	2011-01-08 12:45:14 +0100
+++ emacs-23.3/lisp/progmodes/which-func.el	2011-03-11 11:41:04 +0100
@@ -270,7 +270,7 @@
 (defun which-function ()
   "Return current function name based on point.
 Uses `which-func-functions', `imenu--index-alist'
-or `add-log-current-defun-function'.
+or `add-log-current-defun'.
 If no function name is found, return nil."
   (let ((name
 	 ;; Try the `which-func-functions' functions first.
@@ -319,9 +319,8 @@
                   imstack   (cdr imstack))))))
 
     ;; Try using add-log support.
-    (when (and (null name) (boundp 'add-log-current-defun-function)
-	       add-log-current-defun-function)
-      (setq name (funcall add-log-current-defun-function)))
+    (when (null name)
+      (setq name (add-log-current-defun)))
     ;; Filter the name if requested.
     (when name
       (if which-func-cleanup-function

-- 
Ralph