Mercurial > emacs
comparison lisp/apropos.el @ 11190:509f78000a59
(apropos): Use apropos-worthy-symbol-p as default predicate.
(apropos-worthy-symbol-p): New function.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 03 Apr 1995 21:38:06 +0000 |
parents | 1d1c5ea9eb86 |
children | 9fb6a9b6658b |
comparison
equal
deleted
inserted
replaced
11189:a2a85a29cdd6 | 11190:509f78000a59 |
---|---|
48 (defvar apropos-do-all nil | 48 (defvar apropos-do-all nil |
49 "*Whether `apropos' and `super-apropos' should do everything that they can. | 49 "*Whether `apropos' and `super-apropos' should do everything that they can. |
50 Makes them run 2 or 3 times slower. Set this non-nil if you have a fast | 50 Makes them run 2 or 3 times slower. Set this non-nil if you have a fast |
51 machine.") | 51 machine.") |
52 | 52 |
53 (defun apropos-worthy-symbol-p (symbol) | |
54 "Return non-nil if SYMBOL is not worthless." | |
55 (or (fboundp symbol) | |
56 (boundp symbol) | |
57 (symbol-plist symbol))) | |
58 | |
53 ;;;###autoload | 59 ;;;###autoload |
54 (defun apropos (regexp &optional do-all pred no-header) | 60 (defun apropos (regexp &optional do-all pred no-header) |
55 "Show all symbols whose names contain matches for REGEXP. | 61 "Show all symbols whose names contain matches for REGEXP. |
56 If optional argument DO-ALL is non-nil (prefix argument if interactive), | 62 If optional argument DO-ALL is non-nil (prefix argument if interactive), |
57 or if `apropos-do-all' is non-nil, does more (time-consuming) work such as | 63 or if `apropos-do-all' is non-nil, does more (time-consuming) work such as |
58 showing key bindings. Optional argument PRED is called with each symbol, and | 64 showing key bindings. Optional argument PRED is called with each symbol, and |
59 if it returns nil, the symbol is not shown. | 65 if it returns nil, the symbol is not shown. If PRED is nil, the |
66 default predicate is that the symbol has a value, function definition | |
67 or property list. | |
60 | 68 |
61 Optional argument NO-HEADER means don't print `Function:' or `Variable:' | 69 Optional argument NO-HEADER means don't print `Function:' or `Variable:' |
62 in the output. | 70 in the output. |
63 | 71 |
64 Returns list of symbols and documentation found." | 72 Returns list of symbols and documentation found." |
65 (interactive "sApropos (regexp): \nP") | 73 (interactive "sApropos (regexp): \nP") |
66 (setq do-all (or apropos-do-all do-all)) | 74 (setq do-all (or apropos-do-all do-all)) |
75 (setq pred (or pred 'apropos-worthy-symbol-p)) | |
67 (let ((apropos-accumulate (apropos-internal regexp pred))) | 76 (let ((apropos-accumulate (apropos-internal regexp pred))) |
68 (if (null apropos-accumulate) | 77 (if (null apropos-accumulate) |
69 (message "No apropos matches for `%s'" regexp) | 78 (message "No apropos matches for `%s'" regexp) |
70 (apropos-get-doc apropos-accumulate) | 79 (apropos-get-doc apropos-accumulate) |
71 (with-output-to-temp-buffer "*Help*" | 80 (with-output-to-temp-buffer "*Help*" |