]> git.eshelyaron.com Git - emacs.git/commitdiff
(sync from trunk 2008-01-25)
authorGlenn Morris <rgm@gnu.org>
Wed, 13 Aug 2008 03:07:55 +0000 (03:07 +0000)
committerGlenn Morris <rgm@gnu.org>
Wed, 13 Aug 2008 03:07:55 +0000 (03:07 +0000)
Martin Rudalics  <rudalics at gmx.at>

(find-library): Wrap search for library name in condition-case to
avoid reporting a scan-error.  (Bug#563)

lisp/ChangeLog
lisp/emacs-lisp/find-func.el

index 8e4f7bb0f2137483ff1af046752d44f5edfcc909..fa439380097816a809315caeaf466b4eaf4e93de 100644 (file)
@@ -1,3 +1,9 @@
+2008-08-13  Martin Rudalics  <rudalics@gmx.at>
+
+       * emacs-lisp/find-func.el (find-library): Wrap search for
+       library name in condition-case to avoid reporting a scan-error.
+       (Bug#563)  (sync from trunk 2008-01-25)
+
 2008-08-12  Juanma Barranquero  <lekktu@gmail.com>
 
        * desktop.el (desktop-minor-mode-table): Add `savehist-mode'.
index 2022d3ab7d41941dc9cc12a3ab2a242f4dfd2207..fc7ea2415e088691a5589ecdf595e4ac8034e744 100644 (file)
@@ -198,11 +198,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)))