[COMMIT] Differentiate between symbol variables and functions, find-func

Aidan Kehoe kehoea at parhasard.net
Mon Dec 22 09:04:40 EST 2008


APPROVE COMMIT

NOTE: This patch has been committed.

xemacs-packages/xemacs-devel/ChangeLog addition:

2008-12-22  Aidan Kehoe  <kehoea at parhasard.net>

	* 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. 


XEmacs Packages source patch:
Diff command:   cvs -q diff -Nu
Files affected: xemacs-packages/xemacs-devel/find-func.el
===================================================================
RCS

Index: xemacs-packages/xemacs-devel/find-func.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/xemacs-devel/find-func.el,v
retrieving revision 1.12
diff -u -u -r1.12 find-func.el
--- xemacs-packages/xemacs-devel/find-func.el	2007/12/30 14:24:59	1.12
+++ xemacs-packages/xemacs-devel/find-func.el	2008/12/22 14:03:33
@@ -289,7 +289,9 @@
     (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)
@@ -408,7 +410,9 @@
 `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)))
@@ -449,7 +453,7 @@
 (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
@@ -458,7 +462,10 @@
       (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: 

-- 
¿Dónde estará ahora mi sobrino Yoghurtu Nghé, que tuvo que huir
precipitadamente de la aldea por culpa de la escasez de rinocerontes?




More information about the XEmacs-Patches mailing list