aidan  committed 8b2e718

Differentiate between symbol variables and functions, find-func.

  • Participants
  • Parent commits ca4c674
  • Branches default

Comments (0)

Files changed (2)

+2008-12-22  Aidan Kehoe  <>
+	* find-func.el (find-function-noselect): 
+	(find-variable-noselect): 
+	(find-definition-noselect): 
+	Call #'symbol-file with two arguments if that is allowing,
+	allowing us to differentiate between variables and functions with
+	the same symbol name. 
 2008-02-27  Norbert Koch  <>
 	* Makefile (VERSION): XEmacs package 1.78 released.

File find-func.el

     (let ((library
 	   (cond ((eq (car-safe def) 'autoload)
 		  (nth 1 def))
-		 ((symbol-file function))
+		 ((if (function-allows-args 'symbol-file 2)
+		      (symbol-file function 'defun)
+		    (symbol-file function)))
 		 ;; XEmacs addition: function annotations
 		 ((fboundp 'compiled-function-annotation)
 		  (cond ((compiled-function-p def)
 `find-function-source-path', if non nil, otherwise in `load-path'."
   (if (not variable)
       (error "You didn't specify a variable"))
-  (let ((library (or file (symbol-file variable))))
+  (let ((library (or file (if (function-allows-args 'symbol-file 2)
+			      (symbol-file variable 'defvar)
+			    (symbol-file variable)))))
     (unless (and (null library) (built-in-variable-type variable))
       (error "%s is a primitive variable" variable))
     (find-function-search-for-symbol variable 'variable library)))
 (defun find-definition-noselect (symbol type &optional file)
   "Return a pair `(BUFFER . POINT)' pointing to the definition of SYMBOL.
 TYPE says what type of definition: nil for a function,
-`defvar' or `defface' for a variable or face.  This functoin
+`defvar' or `defface' for a variable or face.  This function
 does not switch to the buffer or display it.
 The library where SYMBOL is defined is searched for in FILE or
       (error "You didn't specify a symbol"))
   (if (null type)
       (find-function-noselect symbol)
-    (let ((library (or file (symbol-file symbol))))
+    (let ((library (or file 
+		       (if (function-allows-args 'symbol-file 2)
+			   (symbol-file symbol type)
+			 (symbol-file symbol)))))
       (find-function-search-for-symbol symbol type library))))
 ;; RMS says: