From: Martin Rudalics Date: Fri, 25 Jan 2008 17:48:59 +0000 (+0000) Subject: (find-library): Wrap search for library name in condition-case X-Git-Tag: emacs-pretest-23.0.90~8412 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d454552ce373195c83a6a97081342053394585c0;p=emacs.git (find-library): Wrap search for library name in condition-case to avoid reporting a scan-error. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2058d25ecef..b3b48c704cc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2008-01-25 Martin Rudalics + + * emacs-lisp/find-func.el (find-library): Wrap search for + library name in condition-case to avoid reporting a scan-error. + 2008-01-25 Juanma Barranquero * server.el (server-process-filter): Don't force 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)))