changeset 87969:08990d4db481

(find-library): Wrap search for library name in condition-case to avoid reporting a scan-error.
author Martin Rudalics <rudalics@gmx.at>
date Fri, 25 Jan 2008 17:46:26 +0000
parents 55f91384380f
children f35ac4b5d4ee
files lisp/emacs-lisp/find-func.el
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/find-func.el	Fri Jan 25 15:52:08 2008 +0000
+++ b/lisp/emacs-lisp/find-func.el	Fri Jan 25 17:46:26 2008 +0000
@@ -200,11 +200,17 @@
    (let* ((path (cons (or find-function-source-path load-path)
 		      (find-library-suffixes)))
 	  (def (if (eq (function-called-at-point) 'require)
-		   (save-excursion
-		     (backward-up-list)
-		     (forward-char)
-		     (backward-sexp -2)
-		     (thing-at-point 'symbol))
+		   ;; `function-called-at-point' may return 'require
+		   ;; with `point' anywhere on this line.  So wrap the
+		   ;; `save-excursion' below in a `condition-case' to
+		   ;; avoid reporting a scan-error here.
+		   (condition-case nil
+		       (save-excursion
+			 (backward-up-list)
+			 (forward-char)
+			 (forward-sexp 2)
+			 (thing-at-point 'symbol))
+		     (error nil))
 		 (thing-at-point 'symbol))))
      (when def
        (setq def (and (locate-file-completion def path 'test) def)))