changeset 71851:fcc45339ef47

(find-function-search-for-symbol): If can't find definition, return nil for position. (find-function-do-it): Handle new return value of find-definition-noselect. (find-definition-noselect, find-variable-noselect): Doc fix. (find-function-noselect): Doc fix.
author Richard M. Stallman <rms@gnu.org>
date Wed, 12 Jul 2006 16:03:47 +0000
parents 5da49f1eb585
children 81b8b2bb63de
files lisp/emacs-lisp/find-func.el
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/find-func.el	Wed Jul 12 16:00:45 2006 +0000
+++ b/lisp/emacs-lisp/find-func.el	Wed Jul 12 16:03:47 2006 +0000
@@ -205,6 +205,9 @@
 ;;;###autoload
 (defun find-function-search-for-symbol (symbol type library)
   "Search for SYMBOL's definition of type TYPE in LIBRARY.
+Visit the library in a buffer, and return a cons cell (BUFFER . POSITION),
+or just (BUFFER . nil) if the definition can't be found in the file.
+
 If TYPE is nil, look for a function definition.
 Otherwise, TYPE specifies the kind of definition,
 and it is interpreted via `find-function-regexp-alist'.
@@ -244,8 +247,7 @@
 		(progn
 		  (beginning-of-line)
 		  (cons (current-buffer) (point)))
-	      (error "Cannot find definition of `%s' in library `%s'"
-		     symbol library))))))))
+	      (cons (current-buffer) nil))))))))
 
 ;;;###autoload
 (defun find-function-noselect (function)
@@ -253,7 +255,8 @@
 
 Finds the source file containing the definition of FUNCTION
 in a buffer and the point of the definition.  The buffer is
-not selected.
+not selected.  If the function definition can't be found in
+the buffer, returns (BUFFER).
 
 If the file where FUNCTION is defined is not known, then it is
 searched for in `find-function-source-path' if non nil, otherwise
@@ -335,7 +338,7 @@
       (when (memq new-buf orig-buffers)
 	(push-mark orig-point))
       (funcall switch-fn new-buf)
-      (goto-char new-point)
+      (when new-point (goto-char new-point))
       (recenter find-function-recenter-line)
       (run-hooks 'find-function-after-hook))))
 
@@ -376,6 +379,7 @@
 
 Finds the library containing the definition of VARIABLE in a buffer and
 the point of the definition.  The buffer is not selected.
+If the variable's definition can't be found in the buffer, return (BUFFER).
 
 The library where VARIABLE is defined is searched for in FILE or
 `find-function-source-path', if non nil, otherwise in `load-path'."
@@ -421,6 +425,7 @@
 ;;;###autoload
 (defun find-definition-noselect (symbol type &optional file)
   "Return a pair `(BUFFER . POINT)' pointing to the definition of SYMBOL.
+If the definition can't be found in the buffer, return (BUFFER).
 TYPE says what type of definition: nil for a function, `defvar' for a
 variable, `defface' for a face.  This function does not switch to the
 buffer nor display it.