mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
* autoload.el (generate-file-autoloads): Add another
save-excursion so that point is before the generated autoloads after we scan the file.
This commit is contained in:
parent
eaa974e13b
commit
6798a38571
1 changed files with 68 additions and 66 deletions
|
|
@ -122,72 +122,74 @@ are used."
|
||||||
(setq file (substring file (length default-directory)))))
|
(setq file (substring file (length default-directory)))))
|
||||||
|
|
||||||
(message "Generating autoloads for %s..." file)
|
(message "Generating autoloads for %s..." file)
|
||||||
(unwind-protect
|
(save-excursion
|
||||||
(progn
|
(unwind-protect
|
||||||
(set-buffer (find-file-noselect file))
|
(progn
|
||||||
(save-excursion
|
(set-buffer (find-file-noselect file))
|
||||||
(save-restriction
|
(save-excursion
|
||||||
(widen)
|
(save-restriction
|
||||||
(goto-char (point-min))
|
(widen)
|
||||||
(while (not (eobp))
|
(goto-char (point-min))
|
||||||
(skip-chars-forward " \t\n\f")
|
(while (not (eobp))
|
||||||
(cond ((looking-at (regexp-quote generate-autoload-cookie))
|
(skip-chars-forward " \t\n\f")
|
||||||
(search-forward generate-autoload-cookie)
|
(cond
|
||||||
(skip-chars-forward " \t")
|
((looking-at (regexp-quote generate-autoload-cookie))
|
||||||
(setq done-any t)
|
(search-forward generate-autoload-cookie)
|
||||||
(if (eolp)
|
(skip-chars-forward " \t")
|
||||||
;; Read the next form and make an autoload.
|
(setq done-any t)
|
||||||
(let* ((form (prog1 (read (current-buffer))
|
(if (eolp)
|
||||||
(forward-line 1)))
|
;; Read the next form and make an autoload.
|
||||||
(autoload (make-autoload form load-name))
|
(let* ((form (prog1 (read (current-buffer))
|
||||||
(doc-string-elt (get (car-safe form)
|
(forward-line 1)))
|
||||||
'doc-string-elt)))
|
(autoload (make-autoload form load-name))
|
||||||
(if autoload
|
(doc-string-elt (get (car-safe form)
|
||||||
(setq autoloads-done (cons (nth 1 form)
|
'doc-string-elt)))
|
||||||
autoloads-done))
|
(if autoload
|
||||||
(setq autoload form))
|
(setq autoloads-done (cons (nth 1 form)
|
||||||
(if (and doc-string-elt
|
autoloads-done))
|
||||||
(stringp (nth doc-string-elt autoload)))
|
(setq autoload form))
|
||||||
;; We need to hack the printing because the
|
(if (and doc-string-elt
|
||||||
;; doc-string must be printed specially for
|
(stringp (nth doc-string-elt autoload)))
|
||||||
;; make-docfile (sigh).
|
;; We need to hack the printing because the
|
||||||
(let* ((p (nthcdr (1- doc-string-elt)
|
;; doc-string must be printed specially for
|
||||||
autoload))
|
;; make-docfile (sigh).
|
||||||
(elt (cdr p)))
|
(let* ((p (nthcdr (1- doc-string-elt)
|
||||||
(setcdr p nil)
|
autoload))
|
||||||
(princ "\n(" outbuf)
|
(elt (cdr p)))
|
||||||
(mapcar (function (lambda (elt)
|
(setcdr p nil)
|
||||||
(prin1 elt outbuf)
|
(princ "\n(" outbuf)
|
||||||
(princ " " outbuf)))
|
(mapcar (function (lambda (elt)
|
||||||
autoload)
|
(prin1 elt outbuf)
|
||||||
(princ "\"\\\n" outbuf)
|
(princ " " outbuf)))
|
||||||
(princ (substring
|
autoload)
|
||||||
(prin1-to-string (car elt)) 1)
|
(princ "\"\\\n" outbuf)
|
||||||
outbuf)
|
(princ (substring
|
||||||
(if (null (cdr elt))
|
(prin1-to-string (car elt)) 1)
|
||||||
(princ ")" outbuf)
|
outbuf)
|
||||||
(princ " " outbuf)
|
(if (null (cdr elt))
|
||||||
(princ (substring
|
(princ ")" outbuf)
|
||||||
(prin1-to-string (cdr elt))
|
(princ " " outbuf)
|
||||||
1)
|
(princ (substring
|
||||||
outbuf))
|
(prin1-to-string (cdr elt))
|
||||||
(terpri outbuf))
|
1)
|
||||||
(print autoload outbuf)))
|
outbuf))
|
||||||
;; Copy the rest of the line to the output.
|
(terpri outbuf))
|
||||||
(let ((begin (point)))
|
(print autoload outbuf)))
|
||||||
(forward-line 1)
|
;; Copy the rest of the line to the output.
|
||||||
(princ (buffer-substring begin (point)) outbuf))))
|
(let ((begin (point)))
|
||||||
((looking-at ";")
|
(forward-line 1)
|
||||||
;; Don't read the comment.
|
(princ (buffer-substring begin (point)) outbuf))))
|
||||||
(forward-line 1))
|
((looking-at ";")
|
||||||
(t
|
;; Don't read the comment.
|
||||||
(forward-sexp 1)
|
(forward-line 1))
|
||||||
(forward-line 1)))))))
|
(t
|
||||||
(or visited
|
(forward-sexp 1)
|
||||||
;; We created this buffer, so we should kill it.
|
(forward-line 1)))))))
|
||||||
(kill-buffer (current-buffer)))
|
(or visited
|
||||||
(set-buffer outbuf)
|
;; We created this buffer, so we should kill it.
|
||||||
(setq output-end (point-marker)))
|
(kill-buffer (current-buffer)))
|
||||||
|
(set-buffer outbuf)
|
||||||
|
(setq output-end (point-marker))))
|
||||||
(if done-any
|
(if done-any
|
||||||
(progn
|
(progn
|
||||||
(insert generate-autoload-section-header)
|
(insert generate-autoload-section-header)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue