Mercurial > emacs
comparison lisp/emacs-lisp/autoload.el @ 3805:21c6c1e1a38b
(generate-file-autoloads): Undo previous change
because make-docfile requires defvar doc string to start on first line.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 17 Jun 1993 06:59:49 +0000 |
parents | d6f56b9586f7 |
children | b292a011b5f4 |
comparison
equal
deleted
inserted
replaced
3804:d7d674c99039 | 3805:21c6c1e1a38b |
---|---|
144 (search-forward generate-autoload-cookie) | 144 (search-forward generate-autoload-cookie) |
145 (skip-chars-forward " \t") | 145 (skip-chars-forward " \t") |
146 (setq done-any t) | 146 (setq done-any t) |
147 (if (eolp) | 147 (if (eolp) |
148 ;; Read the next form and make an autoload. | 148 ;; Read the next form and make an autoload. |
149 (let* ((before (point)) | 149 (let* ((form (prog1 (read (current-buffer)) |
150 (form (prog1 (read (current-buffer)) | |
151 (forward-line 1))) | 150 (forward-line 1))) |
152 (autoload (make-autoload form load-name)) | 151 (autoload (make-autoload form load-name)) |
153 (doc-string-elt (get (car-safe form) | 152 (doc-string-elt (get (car-safe form) |
154 'doc-string-elt))) | 153 'doc-string-elt))) |
155 (if (null autoload) | 154 (if autoload |
156 ;; We are copying a defvar or defconst form. | 155 (setq autoloads-done (cons (nth 1 form) |
157 ;; Copy the text instead of printing the form, | 156 autoloads-done)) |
158 ;; so as to preserve the original formatting. | 157 (setq autoload form)) |
159 (let ((inbuf (current-buffer)) | 158 (if (and doc-string-elt |
160 (after (point))) | 159 (stringp (nth doc-string-elt autoload))) |
161 (save-excursion | 160 ;; We need to hack the printing because the |
162 (set-buffer outbuf) | 161 ;; doc-string must be printed specially for |
163 ;; Insert the form. | 162 ;; make-docfile (sigh). |
164 (insert-buffer-substring inbuf before after) | 163 (let* ((p (nthcdr (1- doc-string-elt) |
165 (and doc-string-elt | 164 autoload)) |
166 (stringp (nth doc-string-elt form)) | 165 (elt (cdr p))) |
167 ;; The form has a docstring. | 166 (setcdr p nil) |
168 ;; Hack it for make-docfile. | 167 (princ "\n(" outbuf) |
169 (save-excursion | 168 (mapcar (function (lambda (elt) |
170 ;; Move point back to FORM's start. | 169 (prin1 elt outbuf) |
171 (backward-char (- after before)) | 170 (princ " " outbuf))) |
172 (skip-chars-forward " \t\n") | 171 autoload) |
173 (or (looking-at "(") | 172 (princ "\"\\\n" outbuf) |
174 (error "expected (")) | 173 (princ (substring |
175 (forward-char 1) ; Skip the paren. | 174 (prin1-to-string (car elt)) 1) |
176 ;; Skip sexps before the docstring. | 175 outbuf) |
177 (forward-sexp doc-string-elt) | 176 (if (null (cdr elt)) |
178 (skip-chars-forward " \t") | 177 (princ ")" outbuf) |
179 (if (eolp) (delete-char 1)) | 178 (princ " " outbuf) |
180 (skip-chars-forward " \t") | |
181 (or (looking-at "\"") | |
182 (error "expected \"")) | |
183 (forward-char 1) ; Skip the ". | |
184 (insert "\\\n"))) ;make-docfile happy. | |
185 (goto-char after))) | |
186 ;; Write the autoload for this defun or defmacro. | |
187 (setq autoloads-done (cons (nth 1 form) | |
188 autoloads-done)) | |
189 (if (and doc-string-elt | |
190 (stringp (nth doc-string-elt autoload))) | |
191 ;; We need to hack the printing because the | |
192 ;; doc-string must be printed specially for | |
193 ;; make-docfile (sigh). | |
194 (let* ((p (nthcdr (1- doc-string-elt) | |
195 autoload)) | |
196 (elt (cdr p))) | |
197 (setcdr p nil) | |
198 (princ "\n(" outbuf) | |
199 (mapcar (function (lambda (elt) | |
200 (prin1 elt outbuf) | |
201 (princ " " outbuf))) | |
202 autoload) | |
203 (princ "\"\\\n" outbuf) | |
204 (princ (substring | 179 (princ (substring |
205 (prin1-to-string (car elt)) 1) | 180 (prin1-to-string (cdr elt)) |
206 outbuf) | 181 1) |
207 (if (null (cdr elt)) | 182 outbuf)) |
208 (princ ")" outbuf) | 183 (terpri outbuf)) |
209 (princ " " outbuf) | 184 (print autoload outbuf))) |
210 (princ (substring | |
211 (prin1-to-string (cdr elt)) | |
212 1) | |
213 outbuf)) | |
214 (terpri outbuf)) | |
215 (print autoload outbuf)))) | |
216 ;; Copy the rest of the line to the output. | 185 ;; Copy the rest of the line to the output. |
217 (let ((begin (point))) | 186 (let ((begin (point))) |
218 (forward-line 1) | 187 (forward-line 1) |
219 (princ (buffer-substring begin (point)) outbuf)))) | 188 (princ (buffer-substring begin (point)) outbuf)))) |
220 ((looking-at ";") | 189 ((looking-at ";") |
221 ;; Don't read the comment. | 190 ;; Don't read the comment. |
222 (forward-line 1)) | 191 (forward-line 1)) |
223 (t | 192 (t |
224 (forward-sexp 1) | 193 (forward-sexp 1) |
225 (forward-line 1))))))) | 194 (forward-line 1))))))) |
226 (or visited | 195 (or visited |
227 ;; We created this buffer, so we should kill it. | 196 ;; We created this buffer, so we should kill it. |
228 (kill-buffer (current-buffer))) | 197 (kill-buffer (current-buffer))) |
229 (set-buffer outbuf) | 198 (set-buffer outbuf) |
230 (setq output-end (point-marker)))) | 199 (setq output-end (point-marker)))) |