diff options
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/emacs-lisp/find-func.el | 20 |
2 files changed, 20 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a8e111cb2ed..cdd1822303d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2007-10-31 Sean O'Rourke <sorourke@cs.ucsd.edu> | ||
| 2 | |||
| 3 | * emacs-lisp/find-func.el (find-library): use library at | ||
| 4 | point as default interactive argument. | ||
| 5 | |||
| 1 | 2007-10-31 Juanma Barranquero <lekktu@gmail.com> | 6 | 2007-10-31 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 7 | ||
| 3 | * shadowfile.el (shadow-join): Remove. | 8 | * shadowfile.el (shadow-join): Remove. |
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 20b91b10547..b3c7c339030 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el | |||
| @@ -192,11 +192,21 @@ TYPE should be nil to find a function, or `defvar' to find a variable." | |||
| 192 | (defun find-library (library) | 192 | (defun find-library (library) |
| 193 | "Find the elisp source of LIBRARY." | 193 | "Find the elisp source of LIBRARY." |
| 194 | (interactive | 194 | (interactive |
| 195 | (list | 195 | (let* ((path (cons (or find-function-source-path load-path) |
| 196 | (completing-read "Library name: " | 196 | (find-library-suffixes))) |
| 197 | 'locate-file-completion | 197 | (def (if (eq (function-called-at-point) 'require) |
| 198 | (cons (or find-function-source-path load-path) | 198 | (save-excursion |
| 199 | (find-library-suffixes))))) | 199 | (backward-up-list) |
| 200 | (forward-char) | ||
| 201 | (backward-sexp -2) | ||
| 202 | (thing-at-point 'symbol)) | ||
| 203 | (thing-at-point 'symbol)))) | ||
| 204 | (when def | ||
| 205 | (setq def (and (locate-file-completion def path 'test) def))) | ||
| 206 | (list | ||
| 207 | (completing-read (if def (format "Library name (default %s): " def) | ||
| 208 | "Library name: ") | ||
| 209 | 'locate-file-completion path nil nil nil def)))) | ||
| 200 | (let ((buf (find-file-noselect (find-library-name library)))) | 210 | (let ((buf (find-file-noselect (find-library-name library)))) |
| 201 | (condition-case nil (switch-to-buffer buf) (error (pop-to-buffer buf))))) | 211 | (condition-case nil (switch-to-buffer buf) (error (pop-to-buffer buf))))) |
| 202 | 212 | ||