Allow a prefix argument to find-library to pop to a different window
* lisp/emacs-lisp/find-func.el (find-library): Allow a prefix argument to pop to a different window (bug#2270).
This commit is contained in:
parent
162f185392
commit
e1f2d14ae1
2 changed files with 19 additions and 10 deletions
4
etc/NEWS
4
etc/NEWS
|
@ -56,6 +56,10 @@ affected by this, as SGI stopped supporting IRIX in December 2013.
|
||||||
|
|
||||||
* Changes in Emacs 25.2
|
* Changes in Emacs 25.2
|
||||||
|
|
||||||
|
---
|
||||||
|
** `find-library' now takes a prefix argument to pop to a different
|
||||||
|
window.
|
||||||
|
|
||||||
** `find-library', `help-function-def' and `help-variable-def' now run
|
** `find-library', `help-function-def' and `help-variable-def' now run
|
||||||
`find-function-after-hook'.
|
`find-function-after-hook'.
|
||||||
|
|
||||||
|
|
|
@ -255,9 +255,12 @@ TYPE should be nil to find a function, or `defvar' to find a variable."
|
||||||
(cons (current-buffer) (match-beginning 0))))
|
(cons (current-buffer) (match-beginning 0))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun find-library (library)
|
(defun find-library (library &optional other-window)
|
||||||
"Find the Emacs Lisp source of LIBRARY.
|
"Find the Emacs Lisp source of LIBRARY.
|
||||||
LIBRARY should be a string (the name of the library)."
|
LIBRARY should be a string (the name of the library). If the
|
||||||
|
optional OTHER-WINDOW argument (i.e., the command argument) is
|
||||||
|
specified, pop to a different window before displaying the
|
||||||
|
buffer."
|
||||||
(interactive
|
(interactive
|
||||||
(let* ((dirs (or find-function-source-path load-path))
|
(let* ((dirs (or find-function-source-path load-path))
|
||||||
(suffixes (find-library-suffixes))
|
(suffixes (find-library-suffixes))
|
||||||
|
@ -279,15 +282,17 @@ LIBRARY should be a string (the name of the library)."
|
||||||
(when (and def (not (test-completion def table)))
|
(when (and def (not (test-completion def table)))
|
||||||
(setq def nil))
|
(setq def nil))
|
||||||
(list
|
(list
|
||||||
(completing-read (if def (format "Library name (default %s): " def)
|
(completing-read (if def
|
||||||
|
(format "Library name (default %s): " def)
|
||||||
"Library name: ")
|
"Library name: ")
|
||||||
table nil nil nil nil def))))
|
table nil nil nil nil def)
|
||||||
(let ((buf (find-file-noselect (find-library-name library))))
|
current-prefix-arg)))
|
||||||
(condition-case nil
|
(prog1
|
||||||
(prog1
|
(funcall (if other-window
|
||||||
(switch-to-buffer buf)
|
'pop-to-buffer
|
||||||
(run-hooks 'find-function-after-hook))
|
'pop-to-buffer-same-window)
|
||||||
(error (pop-to-buffer buf)))))
|
(find-file-noselect (find-library-name library)))
|
||||||
|
(run-hooks 'find-function-after-hook)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun find-function-search-for-symbol (symbol type library)
|
(defun find-function-search-for-symbol (symbol type library)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue