changeset 40480:5ebd79883369

(find-function-search-for-symbol): If the regexp doesn't match, use a looser one. (find-variable-noselect): Add `file' argument.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 30 Oct 2001 04:51:55 +0000
parents 2930fd135efa
children 7b44c3509111
files lisp/emacs-lisp/find-func.el
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/find-func.el	Tue Oct 30 04:41:28 2001 +0000
+++ b/lisp/emacs-lisp/find-func.el	Tue Oct 30 04:51:55 2001 +0000
@@ -144,7 +144,12 @@
 	      (progn
 		(set-syntax-table emacs-lisp-mode-syntax-table)
 		(goto-char (point-min))
-		(if (re-search-forward regexp nil t)
+		(if (or (re-search-forward regexp nil t)
+			(re-search-forward
+			 (concat "^([^ ]+ +"
+				 (regexp-quote (symbol-name symbol))
+				 "\\>")
+			 nil t))
 		    (progn
 		      (beginning-of-line)
 		      (cons (current-buffer) (point)))
@@ -278,18 +283,18 @@
   (find-function-do-it function nil 'switch-to-buffer-other-frame))
 
 ;;;###autoload
-(defun find-variable-noselect (variable)
-  "Return a pair `(buffer . point)' pointing to the definition of SYMBOL.
+(defun find-variable-noselect (variable &optional file)
+  "Return a pair `(BUFFER . POINT)' pointing to the definition of SYMBOL.
 
 Finds the Emacs Lisp library containing the definition of SYMBOL
 in a buffer and the point of the definition.  The buffer is
 not selected.
 
-The library where VARIABLE is defined is searched for in
+The library where VARIABLE is defined is searched for in FILE or
 `find-function-source-path', if non nil, otherwise in `load-path'."
   (if (not variable)
       (error "You didn't specify a variable"))
-  (let ((library (symbol-file variable)))
+  (let ((library (or file (symbol-file variable))))
     (find-function-search-for-symbol variable 'variable library)))
 
 ;;;###autoload