Function: apropos-library

apropos-library is an autoloaded, interactive and byte-compiled function defined in apropos.el.gz.

Signature

(apropos-library FILE)

Documentation

List the variables and functions defined by library FILE.

FILE should be one of the libraries currently loaded and should thus be found in load-history. If apropos-do-all is non-nil, the output includes key-bindings of commands.

Probably introduced at or before Emacs version 23.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/apropos.el.gz
;;;###autoload
(defun apropos-library (file)
  "List the variables and functions defined by library FILE.
FILE should be one of the libraries currently loaded and should
thus be found in `load-history'.  If `apropos-do-all' is non-nil,
the output includes key-bindings of commands."
  (interactive
   (let* ((libs (delq nil (mapcar #'car load-history)))
          (libs
           (nconc (delq nil
                        (mapcar
                         (lambda (l)
                           (setq l (file-name-nondirectory l))
                           (while
                               (not (equal (setq l (file-name-sans-extension l))
                                           l)))
                           l)
                         libs))
                  libs)))
     (list (completing-read "Describe library: " libs nil t))))
  (setq apropos--current (list #'apropos-library file))
  (let ((symbols nil)
	;; (autoloads nil)
	(provides nil)
	(requires nil)
        (lh-entry (assoc file load-history)))
    (unless lh-entry
      ;; `file' may be the "shortname".
      (let ((lh load-history)
            (re (concat "\\(?:\\`\\|[\\/]\\)" (regexp-quote file)
                        "\\(\\.\\|\\'\\)")))
        (while (and lh (null lh-entry))
          (if (and (stringp (caar lh)) (string-match re (caar lh)))
              (setq lh-entry (car lh))
            (setq lh (cdr lh)))))
      (unless lh-entry (error "Unknown library `%s'" file)))
    (dolist (x (cdr lh-entry))
      (pcase (car-safe x)
	;; (autoload (push (cdr x) autoloads))
	('require (push (cdr x) requires))
	('provide (push (cdr x) provides))
        ('t nil)                     ; Skip "was an autoload" entries.
        ;; FIXME: Print information about each method on generic
        ;; functions: both the docstring and specializers (bug#21422).
        ;; FIXME: Add extension point (bug#72616).
	(_ (let ((sym (or (cdr-safe x) x)))
	     (and sym (symbolp sym)
                  (push sym symbols))))))
    (let ((apropos-pattern "") ;Dummy binding for apropos-symbols-internal.
          (text
           (concat
            (format-message
             "Library `%s' provides: %s\nand requires: %s"
             file
             (mapconcat #'apropos-library-button
                        (or provides '(nil)) " and ")
             (mapconcat #'apropos-library-button
                        (or requires '(nil)) " and ")))))
      (if (null symbols)
          (with-output-to-temp-buffer "*Apropos*"
	    (with-current-buffer standard-output
	      (apropos-mode)
              (apropos--preamble text)))
        (apropos-symbols-internal symbols apropos-do-all text)))))