aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-12-29 01:46:34 +0000
committerRichard M. Stallman1994-12-29 01:46:34 +0000
commita33b76c3eb717aff77676288debffa30f700a92b (patch)
tree6fd219738a787bd62063755420fb87ad1c20da48
parent68469f746c3b283d9bb1d02bd9c2b35c65c9c029 (diff)
downloademacs-a33b76c3eb717aff77676288debffa30f700a92b.tar.gz
emacs-a33b76c3eb717aff77676288debffa30f700a92b.zip
(super-apropos, super-apropos-check-doc-file)
(super-apropos-accumulate): Vars item, fn-doc and var-doc renamed to apropos-item, apropos-fn-doc and apropos-var-doc. (apropos-item, apropos-var-doc, apropos-fn-doc) (apropos-accumulate, apropos-regexp): New defvars. (super-apropos): Bind apropos-regexp to regexp. (super-apropos-accumulate): Use apropos-regexp.
-rw-r--r--lisp/apropos.el55
1 files changed, 32 insertions, 23 deletions
diff --git a/lisp/apropos.el b/lisp/apropos.el
index bf5c5bcc453..d72c595ca60 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -93,6 +93,15 @@ Returns list of symbols and documentation found."
93 (setq p (cdr p))) 93 (setq p (cdr p)))
94 list)) 94 list))
95 95
96;; Variables bound by super-apropos and used by its subroutines.
97;; It would be good to say what each one is for, but I don't know -- rms.
98(defvar apropos-item)
99(defvar apropos-var-doc)
100(defvar apropos-fn-doc)
101(defvar apropos-accumulate)
102(defvar apropos-regexp
103 "Within `super-apropos', this holds the REGEXP argument.")
104
96;;;###autoload 105;;;###autoload
97(defun super-apropos (regexp &optional do-all) 106(defun super-apropos (regexp &optional do-all)
98 "Show symbols whose names/documentation contain matches for REGEXP. 107 "Show symbols whose names/documentation contain matches for REGEXP.
@@ -104,10 +113,11 @@ file.
104Returns list of symbols and documentation found." 113Returns list of symbols and documentation found."
105 (interactive "sSuper Apropos: \nP") 114 (interactive "sSuper Apropos: \nP")
106 (setq do-all (or apropos-do-all do-all)) 115 (setq do-all (or apropos-do-all do-all))
107 (let (apropos-accumulate fn-doc var-doc item) 116 (let ((apropos-regexp regexp)
108 (setq apropos-accumulate (super-apropos-check-doc-file regexp)) 117 apropos-accumulate apropos-fn-doc apropos-var-doc apropos-item)
118 (setq apropos-accumulate (super-apropos-check-doc-file apropos-regexp))
109 (if (null apropos-accumulate) 119 (if (null apropos-accumulate)
110 (message "No apropos matches for `%s'" regexp) 120 (message "No apropos matches for `%s'" apropos-regexp)
111 (if do-all (mapatoms 'super-apropos-accumulate)) 121 (if do-all (mapatoms 'super-apropos-accumulate))
112 (with-output-to-temp-buffer "*Help*" 122 (with-output-to-temp-buffer "*Help*"
113 (apropos-print-matches apropos-accumulate nil t do-all))) 123 (apropos-print-matches apropos-accumulate nil t do-all)))
@@ -143,36 +153,35 @@ Returns list of symbols and documentation found."
143 (if (search-forward "\C-_" nil 'move) 153 (if (search-forward "\C-_" nil 'move)
144 (1- (point)) 154 (1- (point))
145 (point)))) 155 (point))))
146 item (assq symbol sym-list)) 156 apropos-item (assq symbol sym-list))
147 (and (if (= type 1) 157 (and (if (= type 1)
148 (and (fboundp symbol) (documentation symbol)) 158 (and (fboundp symbol) (documentation symbol))
149 (documentation-property symbol 'variable-documentation)) 159 (documentation-property symbol 'variable-documentation))
150 (or item 160 (or apropos-item
151 (setq item (list symbol nil nil) 161 (setq apropos-item (list symbol nil nil)
152 sym-list (cons item sym-list))) 162 sym-list (cons apropos-item sym-list)))
153 (setcar (nthcdr type item) doc)))) 163 (setcar (nthcdr type apropos-item) doc))))
154 sym-list)) 164 sym-list))
155 165
156;; This is passed as the argument to map-atoms, so it is called once for every 166;; This is passed as the argument to map-atoms, so it is called once for every
157;; symbol in obarray. Takes one argument SYMBOL, and finds any memory-resident 167;; symbol in obarray. Takes one argument SYMBOL, and finds any memory-resident
158;; documentation on that symbol if it matches a variable regexp. WARNING: this 168;; documentation on that symbol if it matches a variable regexp.
159;; function depends on the symbols fn-doc var-doc regexp and item being bound
160;; correctly when it is called!"
161 169
162(defun super-apropos-accumulate (symbol) 170(defun super-apropos-accumulate (symbol)
163 (cond ((string-match regexp (symbol-name symbol)) 171 (cond ((string-match apropos-regexp (symbol-name symbol))
164 (setq item (apropos-get-accum-item symbol)) 172 (setq apropos-item (apropos-get-accum-item symbol))
165 (setcar (cdr item) (or (safe-documentation symbol) 173 (setcar (cdr apropos-item) (or (safe-documentation symbol)
166 (nth 1 item))) 174 (nth 1 apropos-item)))
167 (setcar (nthcdr 2 item) (or (safe-documentation-property symbol) 175 (setcar (nthcdr 2 apropos-item) (or (safe-documentation-property symbol)
168 (nth 2 item)))) 176 (nth 2 apropos-item))))
169 (t 177 (t
170 (and (setq fn-doc (safe-documentation symbol)) 178 (and (setq apropos-fn-doc (safe-documentation symbol))
171 (string-match regexp fn-doc) 179 (string-match apropos-regexp apropos-fn-doc)
172 (setcar (cdr (apropos-get-accum-item symbol)) fn-doc)) 180 (setcar (cdr (apropos-get-accum-item symbol)) apropos-fn-doc))
173 (and (setq var-doc (safe-documentation-property symbol)) 181 (and (setq apropos-var-doc (safe-documentation-property symbol))
174 (string-match regexp var-doc) 182 (string-match apropos-regexp apropos-var-doc)
175 (setcar (nthcdr 2 (apropos-get-accum-item symbol)) var-doc)))) 183 (setcar (nthcdr 2 (apropos-get-accum-item symbol))
184 apropos-var-doc))))
176 nil) 185 nil)
177 186
178;; Prints the symbols and documentation in alist MATCHES of form ((symbol 187;; Prints the symbols and documentation in alist MATCHES of form ((symbol