diff options
| author | Vinicius Jose Latorre | 2007-10-31 12:46:29 +0000 |
|---|---|---|
| committer | Vinicius Jose Latorre | 2007-10-31 12:46:29 +0000 |
| commit | 59e1bd2913bfeb01d12f0ba419aa63d6cd00a604 (patch) | |
| tree | 760122e2f4044aebb956d0c253f815dca4305710 /lisp | |
| parent | e87d7cb441781106511411d68982286f9add486b (diff) | |
| download | emacs-59e1bd2913bfeb01d12f0ba419aa63d6cd00a604.tar.gz emacs-59e1bd2913bfeb01d12f0ba419aa63d6cd00a604.zip | |
Default argument for find-library
Diffstat (limited to 'lisp')
| -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 ebd92a40033..7aa77756e45 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 | * emacs-lisp/elp.el (elp-report-limit, elp-restore-all) | 8 | * emacs-lisp/elp.el (elp-report-limit, elp-restore-all) |
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 6a259ffd4f7..ede196721ae 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el | |||
| @@ -194,11 +194,21 @@ TYPE should be nil to find a function, or `defvar' to find a variable." | |||
| 194 | (defun find-library (library) | 194 | (defun find-library (library) |
| 195 | "Find the elisp source of LIBRARY." | 195 | "Find the elisp source of LIBRARY." |
| 196 | (interactive | 196 | (interactive |
| 197 | (list | 197 | (let* ((path (cons (or find-function-source-path load-path) |
| 198 | (completing-read "Library name: " | 198 | (find-library-suffixes))) |
| 199 | 'locate-file-completion | 199 | (def (if (eq (function-called-at-point) 'require) |
| 200 | (cons (or find-function-source-path load-path) | 200 | (save-excursion |
| 201 | (find-library-suffixes))))) | 201 | (backward-up-list) |
| 202 | (forward-char) | ||
| 203 | (backward-sexp -2) | ||
| 204 | (thing-at-point 'symbol)) | ||
| 205 | (thing-at-point 'symbol)))) | ||
| 206 | (when def | ||
| 207 | (setq def (and (locate-file-completion def path 'test) def))) | ||
| 208 | (list | ||
| 209 | (completing-read (if def (format "Library name (default %s): " def) | ||
| 210 | "Library name: ") | ||
| 211 | 'locate-file-completion path nil nil nil def)))) | ||
| 202 | (let ((buf (find-file-noselect (find-library-name library)))) | 212 | (let ((buf (find-file-noselect (find-library-name library)))) |
| 203 | (condition-case nil (switch-to-buffer buf) (error (pop-to-buffer buf))))) | 213 | (condition-case nil (switch-to-buffer buf) (error (pop-to-buffer buf))))) |
| 204 | 214 | ||