summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorMartin Rudalics <rudalics@gmx.at>2008-01-25 17:48:59 +0000
committerMartin Rudalics <rudalics@gmx.at>2008-01-25 17:48:59 +0000
commitd454552ce373195c83a6a97081342053394585c0 (patch)
treef389b112700142713bf376b3737bdf001ed2aec3 /lisp/emacs-lisp
parent34a14ec974bca41fbc7a19d7365cfce000b79302 (diff)
downloademacs-d454552ce373195c83a6a97081342053394585c0.tar.gz
emacs-d454552ce373195c83a6a97081342053394585c0.tar.bz2
emacs-d454552ce373195c83a6a97081342053394585c0.zip
(find-library): Wrap search for library name in condition-case
to avoid reporting a scan-error.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/find-func.el16
1 files changed, 11 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index 7c4c01a6e32..58695e95347 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -200,11 +200,17 @@ TYPE should be nil to find a function, or `defvar' to find a variable."
(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)))