diff 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
line wrap: on
line diff
--- a/lisp/emacs-lisp/autoload.el	Thu Jun 17 05:08:23 1993 +0000
+++ b/lisp/emacs-lisp/autoload.el	Thu Jun 17 06:59:49 1993 +0000
@@ -146,83 +146,52 @@
 		    (setq done-any t)
 		    (if (eolp)
 			;; Read the next form and make an autoload.
-			(let* ((before (point))
-			       (form (prog1 (read (current-buffer))
+			(let* ((form (prog1 (read (current-buffer))
 				       (forward-line 1)))
 			       (autoload (make-autoload form load-name))
 			       (doc-string-elt (get (car-safe form)
 						    'doc-string-elt)))
-			  (if (null autoload)
-			      ;; We are copying a defvar or defconst form.
-			      ;; Copy the text instead of printing the form,
-			      ;; so as to preserve the original formatting.
-			      (let ((inbuf (current-buffer))
-				    (after (point)))
-				(save-excursion
-				  (set-buffer outbuf)
-				  ;; Insert the form.
-				  (insert-buffer-substring inbuf before after)
-				  (and doc-string-elt
-				       (stringp (nth doc-string-elt form))
-				       ;; The form has a docstring.
-				       ;; Hack it for make-docfile.
-				       (save-excursion
-					 ;; Move point back to FORM's start.
-					 (backward-char (- after before))
-					 (skip-chars-forward " \t\n")
-					 (or (looking-at "(")
-					     (error "expected ("))
-					 (forward-char 1) ; Skip the paren.
-					 ;; Skip sexps before the docstring.
-					 (forward-sexp doc-string-elt)
-					 (skip-chars-forward " \t")
-					 (if (eolp) (delete-char 1))
-					 (skip-chars-forward " \t")
-					 (or (looking-at "\"")
-					     (error "expected \""))
-					 (forward-char 1) ; Skip the ".
-					 (insert "\\\n"))) ;make-docfile happy.
-				  (goto-char after)))
-			    ;; Write the autoload for this defun or defmacro.
-			    (setq autoloads-done (cons (nth 1 form)
-						       autoloads-done))
-			    (if (and doc-string-elt
-				     (stringp (nth doc-string-elt autoload)))
-				;; We need to hack the printing because the
-				;; doc-string must be printed specially for
-				;; make-docfile (sigh).
-				(let* ((p (nthcdr (1- doc-string-elt)
-						  autoload))
-				       (elt (cdr p)))
-				  (setcdr p nil)
-				  (princ "\n(" outbuf)
-				  (mapcar (function (lambda (elt)
-						      (prin1 elt outbuf)
-						      (princ " " outbuf)))
-					  autoload)
-				  (princ "\"\\\n" outbuf)
+			  (if autoload
+			      (setq autoloads-done (cons (nth 1 form)
+							 autoloads-done))
+			    (setq autoload form))
+			  (if (and doc-string-elt
+				   (stringp (nth doc-string-elt autoload)))
+			      ;; We need to hack the printing because the
+			      ;; doc-string must be printed specially for
+			      ;; make-docfile (sigh).
+			      (let* ((p (nthcdr (1- doc-string-elt)
+						autoload))
+				     (elt (cdr p)))
+				(setcdr p nil)
+				(princ "\n(" outbuf)
+				(mapcar (function (lambda (elt)
+						    (prin1 elt outbuf)
+						    (princ " " outbuf)))
+					autoload)
+				(princ "\"\\\n" outbuf)
+				(princ (substring
+					(prin1-to-string (car elt)) 1)
+				       outbuf)
+				(if (null (cdr elt))
+				    (princ ")" outbuf)
+				  (princ " " outbuf)
 				  (princ (substring
-					  (prin1-to-string (car elt)) 1)
-					 outbuf)
-				  (if (null (cdr elt))
-				      (princ ")" outbuf)
-				    (princ " " outbuf)
-				    (princ (substring
-					    (prin1-to-string (cdr elt))
-					    1)
-					   outbuf))
-				  (terpri outbuf))
-			      (print autoload outbuf))))
+					  (prin1-to-string (cdr elt))
+					  1)
+					 outbuf))
+				(terpri outbuf))
+			    (print autoload outbuf)))
 		      ;; Copy the rest of the line to the output.
 		      (let ((begin (point)))
 			(forward-line 1)
 			(princ (buffer-substring begin (point)) outbuf))))
-		   ((looking-at ";")
-		    ;; Don't read the comment.
-		    (forward-line 1))
-		   (t
-		    (forward-sexp 1)
-		    (forward-line 1)))))))
+			((looking-at ";")
+			 ;; Don't read the comment.
+			 (forward-line 1))
+			(t
+			 (forward-sexp 1)
+			 (forward-line 1)))))))
 	(or visited
 	    ;; We created this buffer, so we should kill it.
 	    (kill-buffer (current-buffer)))