(error "Can't find source for %s" fun-or-var))
(cons (current-buffer) (match-beginning 0))))
+(defun display-library (library)
+ "Display the Emacs Lisp source of LIBRARY.
+
+Interactively, prompt for LIBRARY using the one at or near point.
+
+This function searches `find-library-source-path' if non-nil, and
+`load-path' otherwise.
+
+See the `find-library-include-other-files' user option for
+customizing the candidate completions."
+ (interactive (list (read-library-name)))
+ (display-buffer (find-file-noselect (find-library-name library))))
+
;;;###autoload
(defun find-library (library)
"Find the Emacs Lisp source of LIBRARY.
(switch-to-buffer (find-file-noselect (find-library-name library)))
(run-hooks 'find-function-after-hook)))
+(put 'find-library 'minibuffer-action '(display-library . "find"))
+
;;;###autoload
(defun read-library-name ()
"Read and return a library name, defaulting to the one near point.
(find-library-name library)))
(run-hooks 'find-function-after-hook)))
+(put 'find-library-other-window 'minibuffer-action 'find-library)
+
;;;###autoload
(defun find-library-other-frame (library)
"Find the Emacs Lisp source of LIBRARY in another frame.
(find-library-name library)))
(run-hooks 'find-function-after-hook)))
+(put 'find-library-other-frame 'minibuffer-action 'find-library)
+
;;;###autoload
(defun find-function-search-for-symbol (symbol type library)
"Search for SYMBOL's definition of type TYPE in LIBRARY.
(prompt-type (cdr (assq type '((nil . "function")
(defvar . "variable")
(defface . "face")))))
+ (action this-command)
(enable-recursive-minibuffers t))
- (list (intern (completing-read
- (format-prompt "Find %s" symb prompt-type)
- obarray predicate
- 'lambda nil nil (and symb (symbol-name symb)))))))
+ (list (intern
+ (minibuffer-with-setup-hook
+ (lambda () (setq minibuffer-completion-action
+ (cons (lambda (s)
+ (save-selected-window
+ (funcall action (intern s))))
+ "find")))
+ (completing-read
+ (format-prompt "Find %s" symb prompt-type)
+ obarray predicate
+ 'lambda nil nil (and symb (symbol-name symb))))))))
(defun find-function-do-it (symbol type switch-fn)
"Find Emacs Lisp SYMBOL in a buffer and display it.