Mercurial > emacs
comparison lisp/emacs-lisp/find-func.el @ 80721:569276db9359
(sync from trunk 2008-01-25)
Martin Rudalics <rudalics at gmx.at>
(find-library): Wrap search for library name in condition-case to
avoid reporting a scan-error. (Bug#563)
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Wed, 13 Aug 2008 03:07:25 +0000 |
parents | 7f06131fe112 |
children |
comparison
equal
deleted
inserted
replaced
80720:9cdccb5e49a8 | 80721:569276db9359 |
---|---|
196 "Find the elisp source of LIBRARY." | 196 "Find the elisp source of LIBRARY." |
197 (interactive | 197 (interactive |
198 (let* ((path (cons (or find-function-source-path load-path) | 198 (let* ((path (cons (or find-function-source-path load-path) |
199 (find-library-suffixes))) | 199 (find-library-suffixes))) |
200 (def (if (eq (function-called-at-point) 'require) | 200 (def (if (eq (function-called-at-point) 'require) |
201 (save-excursion | 201 ;; `function-called-at-point' may return 'require |
202 (backward-up-list) | 202 ;; with `point' anywhere on this line. So wrap the |
203 (forward-char) | 203 ;; `save-excursion' below in a `condition-case' to |
204 (backward-sexp -2) | 204 ;; avoid reporting a scan-error here. |
205 (thing-at-point 'symbol)) | 205 (condition-case nil |
206 (save-excursion | |
207 (backward-up-list) | |
208 (forward-char) | |
209 (forward-sexp 2) | |
210 (thing-at-point 'symbol)) | |
211 (error nil)) | |
206 (thing-at-point 'symbol)))) | 212 (thing-at-point 'symbol)))) |
207 (when def | 213 (when def |
208 (setq def (and (locate-file-completion def path 'test) def))) | 214 (setq def (and (locate-file-completion def path 'test) def))) |
209 (list | 215 (list |
210 (completing-read (if def (format "Library name (default %s): " def) | 216 (completing-read (if def (format "Library name (default %s): " def) |