diff options
| author | Karl Heuer | 1998-06-20 22:27:06 +0000 |
|---|---|---|
| committer | Karl Heuer | 1998-06-20 22:27:06 +0000 |
| commit | a9155e8732d3ce369769311946ac932b589a3749 (patch) | |
| tree | 856d4559c97b39c5482d59abef7e9e38f9b0b7de | |
| parent | 5ddf4bdac08268def3cb46c6bc1f0178e60c4882 (diff) | |
| download | emacs-a9155e8732d3ce369769311946ac932b589a3749.tar.gz emacs-a9155e8732d3ce369769311946ac932b589a3749.zip | |
(apropos-print): Delete arg DOC-FN.
Callers changed to do that work before calling apropos-print.
Make *Apropos* buffer read only.
| -rw-r--r-- | lisp/apropos.el | 145 |
1 files changed, 72 insertions, 73 deletions
diff --git a/lisp/apropos.el b/lisp/apropos.el index 1702cc3097a..98a15923e86 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el | |||
| @@ -189,27 +189,26 @@ satisfy the predicate VAR-PREDICATE." | |||
| 189 | (if (get (car tem) 'apropos-inhibit) | 189 | (if (get (car tem) 'apropos-inhibit) |
| 190 | (setq apropos-accumulator (delq (car tem) apropos-accumulator))) | 190 | (setq apropos-accumulator (delq (car tem) apropos-accumulator))) |
| 191 | (setq tem (cdr tem)))) | 191 | (setq tem (cdr tem)))) |
| 192 | (if (apropos-print | 192 | (let ((p apropos-accumulator) |
| 193 | t | 193 | doc symbol) |
| 194 | (lambda (p) | 194 | (while p |
| 195 | (let (doc symbol) | 195 | (setcar p (list |
| 196 | (while p | 196 | (setq symbol (car p)) |
| 197 | (setcar p (list | 197 | (unless var-predicate |
| 198 | (setq symbol (car p)) | 198 | (if (functionp symbol) |
| 199 | (unless var-predicate | 199 | (if (setq doc (documentation symbol t)) |
| 200 | (if (functionp symbol) | 200 | (substring doc 0 (string-match "\n" doc)) |
| 201 | (if (setq doc (documentation symbol t)) | 201 | "(not documented)"))) |
| 202 | (substring doc 0 (string-match "\n" doc)) | 202 | (and var-predicate |
| 203 | "(not documented)"))) | 203 | (funcall var-predicate symbol) |
| 204 | (and var-predicate | 204 | (if (setq doc (documentation-property |
| 205 | (funcall var-predicate symbol) | 205 | symbol 'variable-documentation t)) |
| 206 | (if (setq doc (documentation-property | 206 | (substring doc 0 |
| 207 | symbol 'variable-documentation t)) | 207 | (string-match "\n" doc)))))) |
| 208 | (substring doc 0 | 208 | (setq p (cdr p)))) |
| 209 | (string-match "\n" doc)))))) | 209 | (and (apropos-print t nil) |
| 210 | (setq p (cdr p))))) | 210 | message |
| 211 | nil) | 211 | (message message)))) |
| 212 | (and message (message message))))) | ||
| 213 | 212 | ||
| 214 | 213 | ||
| 215 | ;;;###autoload | 214 | ;;;###autoload |
| @@ -233,49 +232,49 @@ Returns list of symbols and documentation found." | |||
| 233 | (if (get (car tem) 'apropos-inhibit) | 232 | (if (get (car tem) 'apropos-inhibit) |
| 234 | (setq apropos-accumulator (delq (car tem) apropos-accumulator))) | 233 | (setq apropos-accumulator (delq (car tem) apropos-accumulator))) |
| 235 | (setq tem (cdr tem)))) | 234 | (setq tem (cdr tem)))) |
| 235 | (let ((p apropos-accumulator) | ||
| 236 | symbol doc properties) | ||
| 237 | (while p | ||
| 238 | (setcar p (list | ||
| 239 | (setq symbol (car p)) | ||
| 240 | (when (fboundp symbol) | ||
| 241 | (if (setq doc (condition-case nil | ||
| 242 | (documentation symbol t) | ||
| 243 | (void-function | ||
| 244 | "(alias for undefined function)"))) | ||
| 245 | (substring doc 0 (string-match "\n" doc)) | ||
| 246 | "(not documented)")) | ||
| 247 | (when (boundp symbol) | ||
| 248 | (if (setq doc (documentation-property | ||
| 249 | symbol 'variable-documentation t)) | ||
| 250 | (substring doc 0 (string-match "\n" doc)) | ||
| 251 | "(not documented)")) | ||
| 252 | (when (setq properties (symbol-plist symbol)) | ||
| 253 | (setq doc (list (car properties))) | ||
| 254 | (while (setq properties (cdr (cdr properties))) | ||
| 255 | (setq doc (cons (car properties) doc))) | ||
| 256 | (mapconcat #'symbol-name (nreverse doc) " ")) | ||
| 257 | (when (get symbol 'widget-type) | ||
| 258 | (if (setq doc (documentation-property | ||
| 259 | symbol 'widget-documentation t)) | ||
| 260 | (substring doc 0 | ||
| 261 | (string-match "\n" doc)) | ||
| 262 | "(not documented)")) | ||
| 263 | (when (facep symbol) | ||
| 264 | (if (setq doc (documentation-property | ||
| 265 | symbol 'face-documentation t)) | ||
| 266 | (substring doc 0 | ||
| 267 | (string-match "\n" doc)) | ||
| 268 | "(not documented)")) | ||
| 269 | (when (get symbol 'custom-group) | ||
| 270 | (if (setq doc (documentation-property | ||
| 271 | symbol 'group-documentation t)) | ||
| 272 | (substring doc 0 | ||
| 273 | (string-match "\n" doc)) | ||
| 274 | "(not documented)")))) | ||
| 275 | (setq p (cdr p)))) | ||
| 236 | (apropos-print | 276 | (apropos-print |
| 237 | (or do-all apropos-do-all) | 277 | (or do-all apropos-do-all) |
| 238 | (lambda (p) | ||
| 239 | (let (symbol doc properties) | ||
| 240 | (while p | ||
| 241 | (setcar p (list | ||
| 242 | (setq symbol (car p)) | ||
| 243 | (when (fboundp symbol) | ||
| 244 | (if (setq doc (condition-case nil | ||
| 245 | (documentation symbol t) | ||
| 246 | (void-function | ||
| 247 | "(alias for undefined function)"))) | ||
| 248 | (substring doc 0 (string-match "\n" doc)) | ||
| 249 | "(not documented)")) | ||
| 250 | (when (boundp symbol) | ||
| 251 | (if (setq doc (documentation-property | ||
| 252 | symbol 'variable-documentation t)) | ||
| 253 | (substring doc 0 (string-match "\n" doc)) | ||
| 254 | "(not documented)")) | ||
| 255 | (when (setq properties (symbol-plist symbol)) | ||
| 256 | (setq doc (list (car properties))) | ||
| 257 | (while (setq properties (cdr (cdr properties))) | ||
| 258 | (setq doc (cons (car properties) doc))) | ||
| 259 | (mapconcat #'symbol-name (nreverse doc) " ")) | ||
| 260 | (when (get symbol 'widget-type) | ||
| 261 | (if (setq doc (documentation-property | ||
| 262 | symbol 'widget-documentation t)) | ||
| 263 | (substring doc 0 | ||
| 264 | (string-match "\n" doc)) | ||
| 265 | "(not documented)")) | ||
| 266 | (when (facep symbol) | ||
| 267 | (if (setq doc (documentation-property | ||
| 268 | symbol 'face-documentation t)) | ||
| 269 | (substring doc 0 | ||
| 270 | (string-match "\n" doc)) | ||
| 271 | "(not documented)")) | ||
| 272 | (when (get symbol 'custom-group) | ||
| 273 | (if (setq doc (documentation-property | ||
| 274 | symbol 'group-documentation t)) | ||
| 275 | (substring doc 0 | ||
| 276 | (string-match "\n" doc)) | ||
| 277 | "(not documented)")))) | ||
| 278 | (setq p (cdr p))))) | ||
| 279 | nil)) | 278 | nil)) |
| 280 | 279 | ||
| 281 | 280 | ||
| @@ -301,7 +300,7 @@ Returns list of symbols and values found." | |||
| 301 | (if (or f v p) | 300 | (if (or f v p) |
| 302 | (setq apropos-accumulator (cons (list symbol f v p) | 301 | (setq apropos-accumulator (cons (list symbol f v p) |
| 303 | apropos-accumulator)))))) | 302 | apropos-accumulator)))))) |
| 304 | (apropos-print nil nil t)) | 303 | (apropos-print nil t)) |
| 305 | 304 | ||
| 306 | 305 | ||
| 307 | ;;;###autoload | 306 | ;;;###autoload |
| @@ -339,7 +338,7 @@ Returns list of symbols and documentation found." | |||
| 339 | (setq apropos-accumulator | 338 | (setq apropos-accumulator |
| 340 | (cons (list symbol f v) | 339 | (cons (list symbol f v) |
| 341 | apropos-accumulator))))))) | 340 | apropos-accumulator))))))) |
| 342 | (apropos-print nil nil t)) | 341 | (apropos-print nil t)) |
| 343 | (kill-buffer standard-input)))) | 342 | (kill-buffer standard-input)))) |
| 344 | 343 | ||
| 345 | 344 | ||
| @@ -495,16 +494,15 @@ Will return nil instead." | |||
| 495 | 494 | ||
| 496 | 495 | ||
| 497 | 496 | ||
| 498 | (defun apropos-print (do-keys doc-fn spacing) | 497 | (defun apropos-print (do-keys spacing) |
| 499 | "Output result of various apropos commands with `apropos-regexp'. | 498 | "Output result of apropos searching into buffer `*Apropos*'. |
| 500 | APROPOS-ACCUMULATOR is a list. Optional DOC-FN is called for each element | 499 | The value of `apropos-accumulator' is the list of items to output. |
| 501 | of apropos-accumulator and may modify it resulting in (SYMBOL FN-DOC | 500 | Each element should have the format (SYMBOL FN-DOC VAR-DOC [PLIST-DOC]). |
| 502 | VAR-DOC [PLIST-DOC]). Returns sorted list of symbols and documentation | 501 | The return value is the list that was in `apropos-accumulator', sorted |
| 503 | found." | 502 | alphabetically by symbol name; but this function also sets |
| 503 | `apropos-accumulator' to nil before returning." | ||
| 504 | (if (null apropos-accumulator) | 504 | (if (null apropos-accumulator) |
| 505 | (message "No apropos matches for `%s'" apropos-regexp) | 505 | (message "No apropos matches for `%s'" apropos-regexp) |
| 506 | (if doc-fn | ||
| 507 | (funcall doc-fn apropos-accumulator)) | ||
| 508 | (setq apropos-accumulator | 506 | (setq apropos-accumulator |
| 509 | (sort apropos-accumulator (lambda (a b) | 507 | (sort apropos-accumulator (lambda (a b) |
| 510 | (string-lessp (car a) (car b))))) | 508 | (string-lessp (car a) (car b))))) |
| @@ -599,7 +597,8 @@ found." | |||
| 599 | (apropos-print-doc 'customize-face-other-window 5 "Face" t) | 597 | (apropos-print-doc 'customize-face-other-window 5 "Face" t) |
| 600 | (apropos-print-doc 'widget-browse-other-window 4 "Widget" t) | 598 | (apropos-print-doc 'widget-browse-other-window 4 "Widget" t) |
| 601 | (apropos-print-doc 'apropos-describe-plist 3 | 599 | (apropos-print-doc 'apropos-describe-plist 3 |
| 602 | "Plist" nil))))) | 600 | "Plist" nil)) |
| 601 | (setq buffer-read-only t)))) | ||
| 603 | (prog1 apropos-accumulator | 602 | (prog1 apropos-accumulator |
| 604 | (setq apropos-accumulator ()))) ; permit gc | 603 | (setq apropos-accumulator ()))) ; permit gc |
| 605 | 604 | ||