Function: apropos-command
apropos-command is an autoloaded, interactive and byte-compiled
function defined in apropos.el.gz.
Signature
(apropos-command PATTERN &optional DO-ALL VAR-PREDICATE)
Documentation
Show commands (interactively callable functions) that match PATTERN.
PATTERN can be a word, a list of words (separated by spaces), or a regexp (using some regexp special characters). If it is a word, search for matches for that word as a substring. If it is a list of words, search for matches for any two (or more) of those words.
With C-u (universal-argument) prefix, or if apropos-do-all is non-nil, also show
noninteractive functions.
If VAR-PREDICATE is non-nil, show only variables, and only those that satisfy the predicate VAR-PREDICATE.
When called from a Lisp program, a string PATTERN is used as a regexp, while a list of strings is used as a word list.
Probably introduced at or before Emacs version 20.3.
Key Bindings
Aliases
Source Code
;; Defined in /usr/src/emacs/lisp/apropos.el.gz
;;;###autoload
(defun apropos-command (pattern &optional do-all var-predicate)
"Show commands (interactively callable functions) that match PATTERN.
PATTERN can be a word, a list of words (separated by spaces),
or a regexp (using some regexp special characters). If it is a word,
search for matches for that word as a substring. If it is a list of words,
search for matches for any two (or more) of those words.
With \\[universal-argument] prefix, or if `apropos-do-all' is non-nil, also show
noninteractive functions.
If VAR-PREDICATE is non-nil, show only variables, and only those that
satisfy the predicate VAR-PREDICATE.
When called from a Lisp program, a string PATTERN is used as a regexp,
while a list of strings is used as a word list."
(interactive (list (apropos-read-pattern
(if (or current-prefix-arg apropos-do-all)
"command or function" "command"))
current-prefix-arg))
(setq apropos--current (list #'apropos-command pattern do-all var-predicate))
(apropos-parse-pattern pattern)
(let ((message
(let ((standard-output (get-buffer-create "*Apropos*")))
(help-print-return-message 'identity))))
(or do-all (setq do-all apropos-do-all))
(setq apropos-accumulator
(apropos-internal apropos-regexp
(or var-predicate
;; We used to use `functionp' here, but this
;; rules out macros. `fboundp' rules in
;; keymaps, but it seems harmless.
(if do-all 'fboundp 'commandp))))
(let ((tem apropos-accumulator))
(while tem
(if (or (get (car tem) 'apropos-inhibit)
(apropos-false-hit-symbol (car tem)))
(setq apropos-accumulator (delq (car tem) apropos-accumulator)))
(setq tem (cdr tem))))
(let ((p apropos-accumulator)
doc symbol score)
(while p
(setcar p (list
(setq symbol (car p))
(setq score (apropos-score-symbol symbol))
(unless var-predicate
(if (fboundp symbol)
(if (setq doc (condition-case nil
(documentation symbol t)
(error 'error)))
;; Eg alias to undefined function.
(if (eq doc 'error)
"(documentation error)"
(setq score (+ score (apropos-score-doc doc)))
(substring doc 0 (string-search "\n" doc)))
"(not documented)")))
(and var-predicate
(funcall var-predicate symbol)
(if (setq doc (documentation-property
symbol 'variable-documentation t))
(progn
(setq score (+ score (apropos-score-doc doc)))
(substring doc 0
(string-search "\n" doc)))))))
(setcar (cdr (car p)) score)
(setq p (cdr p))))
(and (let ((apropos-multi-type do-all))
(apropos-print t nil nil t))
message
(message "%s" message))))