aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-11-24 04:55:48 +0000
committerRichard M. Stallman1997-11-24 04:55:48 +0000
commitf38fd6108da2c6a6a10b72d40e1ef34d5115e126 (patch)
tree07d690c059e40104cf7373b616200fee6320985a
parent761aea38d951ec976f2502c9cf2fc5c943ea0ab0 (diff)
downloademacs-f38fd6108da2c6a6a10b72d40e1ef34d5115e126.tar.gz
emacs-f38fd6108da2c6a6a10b72d40e1ef34d5115e126.zip
(apropos-variable): New command.
(apropos-command): New arg JUST-VARS.
-rw-r--r--lisp/apropos.el31
1 files changed, 19 insertions, 12 deletions
diff --git a/lisp/apropos.el b/lisp/apropos.el
index 314e68ba898..3c5bdb52e1a 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -138,20 +138,25 @@ This looks good, but slows down the commands several times."
138 (setq major-mode 'apropos-mode 138 (setq major-mode 'apropos-mode
139 mode-name "Apropos")) 139 mode-name "Apropos"))
140 140
141;;;###autoload
142(defun apropos-variable (regexp)
143 (interactive (list (read-string "Apropos variable (regexp): ")))
144 (apropos-command regexp nil t))
141 145
142;; For auld lang syne: 146;; For auld lang syne:
143;;;###autoload 147;;;###autoload
144(fset 'command-apropos 'apropos-command) 148(fset 'command-apropos 'apropos-command)
145;;;###autoload 149;;;###autoload
146(defun apropos-command (apropos-regexp &optional do-all) 150(defun apropos-command (apropos-regexp &optional do-all just-vars)
147 "Show commands (interactively callable functions) that match REGEXP. 151 "Show commands (interactively callable functions) that match REGEXP.
148With optional prefix ARG, or if `apropos-do-all' is non-nil, also show 152With optional prefix ARG, or if `apropos-do-all' is non-nil, also show
149variables." 153variables. If JUST-VARS is non-nil, show only variables."
150 (interactive (list (read-string (concat "Apropos command " 154 (interactive (list (read-string (concat
151 (if (or current-prefix-arg 155 "Apropos command "
152 apropos-do-all) 156 (if (or current-prefix-arg
153 "or variable ") 157 apropos-do-all)
154 "(regexp): ")) 158 "or variable ")
159 "(regexp): "))
155 current-prefix-arg)) 160 current-prefix-arg))
156 (let ((message 161 (let ((message
157 (let ((standard-output (get-buffer-create "*Apropos*"))) 162 (let ((standard-output (get-buffer-create "*Apropos*")))
@@ -162,7 +167,8 @@ variables."
162 (if do-all 167 (if do-all
163 (lambda (symbol) (or (commandp symbol) 168 (lambda (symbol) (or (commandp symbol)
164 (user-variable-p symbol))) 169 (user-variable-p symbol)))
165 'commandp))) 170 (if just-vars 'user-variable-p
171 'commandp))))
166 (if (apropos-print 172 (if (apropos-print
167 t 173 t
168 (lambda (p) 174 (lambda (p)
@@ -170,10 +176,11 @@ variables."
170 (while p 176 (while p
171 (setcar p (list 177 (setcar p (list
172 (setq symbol (car p)) 178 (setq symbol (car p))
173 (if (commandp symbol) 179 (if (or do-all (not just-vars))
174 (if (setq doc (documentation symbol t)) 180 (if (commandp symbol)
175 (substring doc 0 (string-match "\n" doc)) 181 (if (setq doc (documentation symbol t))
176 "(not documented)")) 182 (substring doc 0 (string-match "\n" doc))
183 "(not documented)")))
177 (and do-all 184 (and do-all
178 (user-variable-p symbol) 185 (user-variable-p symbol)
179 (if (setq doc (documentation-property 186 (if (setq doc (documentation-property