aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-05-24 23:19:37 +0000
committerRichard M. Stallman1998-05-24 23:19:37 +0000
commit9a909b3c4258dca64eb91065a6c07925232babf6 (patch)
tree6e4a33778a598c5497e1bf0f9b4858226088097b
parent05942d060ed2ef46e3358ad5ec22ed7fb90f0578 (diff)
downloademacs-9a909b3c4258dca64eb91065a6c07925232babf6.tar.gz
emacs-9a909b3c4258dca64eb91065a6c07925232babf6.zip
(apropos-command): If DO-ALL is set, search functions, not variables.
-rw-r--r--lisp/apropos.el22
1 files changed, 9 insertions, 13 deletions
diff --git a/lisp/apropos.el b/lisp/apropos.el
index 94701b8f27a..34dabdf0b2c 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -165,15 +165,15 @@ normal variables."
165(defun apropos-command (apropos-regexp &optional do-all var-predicate) 165(defun apropos-command (apropos-regexp &optional do-all var-predicate)
166 "Show commands (interactively callable functions) that match REGEXP. 166 "Show commands (interactively callable functions) that match REGEXP.
167With optional prefix ARG, or if `apropos-do-all' is non-nil, also show 167With optional prefix ARG, or if `apropos-do-all' is non-nil, also show
168user option variables. 168noninteractive functions.
169 169
170If VAR-PREDICATE is non-nil, show only variables that 170If VAR-PREDICATE is non-nil, show only variables, and only those that
171satisfy the predicate VAR-PREDICATE." 171satisfy the predicate VAR-PREDICATE."
172 (interactive (list (read-string (concat 172 (interactive (list (read-string (concat
173 "Apropos command " 173 "Apropos command "
174 (if (or current-prefix-arg 174 (if (or current-prefix-arg
175 apropos-do-all) 175 apropos-do-all)
176 "or variable ") 176 "or function ")
177 "(regexp): ")) 177 "(regexp): "))
178 current-prefix-arg)) 178 current-prefix-arg))
179 (let ((message 179 (let ((message
@@ -182,12 +182,8 @@ satisfy the predicate VAR-PREDICATE."
182 (or do-all (setq do-all apropos-do-all)) 182 (or do-all (setq do-all apropos-do-all))
183 (setq apropos-accumulator 183 (setq apropos-accumulator
184 (apropos-internal apropos-regexp 184 (apropos-internal apropos-regexp
185 (if do-all 185 (if do-all 'functionp
186 (lambda (symbol) (or (commandp symbol)
187 (user-variable-p symbol)))
188 (or var-predicate 'commandp)))) 186 (or var-predicate 'commandp))))
189 (if do-all
190 (setq var-predicate 'user-variable-p))
191 (let ((tem apropos-accumulator)) 187 (let ((tem apropos-accumulator))
192 (while tem 188 (while tem
193 (if (get (car tem) 'apropos-inhibit) 189 (if (get (car tem) 'apropos-inhibit)
@@ -200,11 +196,11 @@ satisfy the predicate VAR-PREDICATE."
200 (while p 196 (while p
201 (setcar p (list 197 (setcar p (list
202 (setq symbol (car p)) 198 (setq symbol (car p))
203 (if (or do-all (not var-predicate)) 199 (unless var-predicate
204 (if (commandp symbol) 200 (if (functionp symbol)
205 (if (setq doc (documentation symbol t)) 201 (if (setq doc (documentation symbol t))
206 (substring doc 0 (string-match "\n" doc)) 202 (substring doc 0 (string-match "\n" doc))
207 "(not documented)"))) 203 "(not documented)")))
208 (and var-predicate 204 (and var-predicate
209 (funcall var-predicate symbol) 205 (funcall var-predicate symbol)
210 (if (setq doc (documentation-property 206 (if (setq doc (documentation-property