Function: apropos--map-preloaded-atoms

apropos--map-preloaded-atoms is a byte-compiled function defined in apropos.el.gz.

Signature

(apropos--map-preloaded-atoms F)

Documentation

Like mapatoms but only enumerates functions&vars that are predefined.

Source Code

;; Defined in /usr/src/emacs/lisp/apropos.el.gz
(defun apropos--map-preloaded-atoms (f)
  "Like `mapatoms' but only enumerates functions&vars that are predefined."
  (let ((preloaded-regexp
         (concat "\\`"
                 (regexp-quote lisp-directory)
                 (regexp-opt preloaded-file-list)
                 "\\.elc?\\'")))
    ;; FIXME: I find this regexp approach brittle.  Maybe a better
    ;; option would be find/record the nthcdr of `load-history' which
    ;; corresponds to the `load-history' state when we dumped.
    ;; (Then again, maybe an even better approach would be to record the
    ;; state of the `obarray' when we dumped, which we may also be able to
    ;; use in `bytecomp' to provide a clean initial environment?)
    (dolist (x load-history)
      (when (let ((elt (car x)))
              (and (stringp elt) (string-match preloaded-regexp elt)))
        (dolist (def (cdr x))
          (cond
           ((symbolp def) (funcall f def))
           ((eq 'defun (car-safe def)) (funcall f (cdr def)))))))))