aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-06-25 16:19:05 +0000
committerStefan Monnier2007-06-25 16:19:05 +0000
commit986c5ad54880307e4e220ffe2b462719fc36c794 (patch)
treeea167c72411625306ca6a403fd421f3102fe918b
parentad1597ceb85a84c783220e6cdf26b02672799074 (diff)
downloademacs-986c5ad54880307e4e220ffe2b462719fc36c794.tar.gz
emacs-986c5ad54880307e4e220ffe2b462719fc36c794.zip
(autoload-generate-file-autoloads): Make `outbuf' optional.
(update-file-autoloads): Use it.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/emacs-lisp/autoload.el33
2 files changed, 22 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ff7d8335156..4b1468a2d9c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
12007-06-25 Stefan Monnier <monnier@iro.umontreal.ca> 12007-06-25 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * emacs-lisp/autoload.el (autoload-generate-file-autoloads):
4 Make `outbuf' optional.
5 (update-file-autoloads): Use it.
6
72007-06-25 Stefan Monnier <monnier@iro.umontreal.ca>
8
3 * emacs-lisp/autoload.el (autoload-modified-buffers): New var. 9 * emacs-lisp/autoload.el (autoload-modified-buffers): New var.
4 (autoload-find-destination): Keep it uptodate. 10 (autoload-find-destination): Keep it uptodate.
5 (autoload-save-buffers): New fun. 11 (autoload-save-buffers): New fun.
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index 970df447548..2861aedef3e 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -311,13 +311,17 @@ Return non-nil in the case where no autoloads were added at point."
311 (interactive "fGenerate autoloads for file: ") 311 (interactive "fGenerate autoloads for file: ")
312 (autoload-generate-file-autoloads file (current-buffer))) 312 (autoload-generate-file-autoloads file (current-buffer)))
313 313
314(defun autoload-generate-file-autoloads (file outbuf) 314(defun autoload-generate-file-autoloads (file &optional outbuf)
315 "Insert an autoload section for FILE in the appropriate buffer. 315 "Insert an autoload section for FILE in the appropriate buffer.
316Autoloads are generated for defuns and defmacros in FILE 316Autoloads are generated for defuns and defmacros in FILE
317marked by `generate-autoload-cookie' (which see). 317marked by `generate-autoload-cookie' (which see).
318If FILE is being visited in a buffer, the contents of the buffer are used. 318If FILE is being visited in a buffer, the contents of the buffer are used.
319OUTBUF is the buffer in which the autoload statements will be inserted. 319OUTBUF is the buffer in which the autoload statements will be inserted.
320Return non-nil in the case where no autoloads were added in the buffer." 320If OUTBUF is nil, it will be determined by `autoload-generated-file'.
321Return non-nil in the case where no autoloads were added to OUTBUF.
322
323Can throw `up-to-date' to mean that the entries were found already and are
324up-to-date. Of course, this can only be the case if OUTBUF is not used."
321 (let ((autoloads-done '()) 325 (let ((autoloads-done '())
322 (load-name (autoload-file-load-name file)) 326 (load-name (autoload-file-load-name file))
323 (print-length nil) 327 (print-length nil)
@@ -345,6 +349,8 @@ Return non-nil in the case where no autoloads were added in the buffer."
345 ((looking-at (regexp-quote generate-autoload-cookie)) 349 ((looking-at (regexp-quote generate-autoload-cookie))
346 ;; If not done yet, figure out where to insert this text. 350 ;; If not done yet, figure out where to insert this text.
347 (unless output-start 351 (unless output-start
352 (unless outbuf
353 (setq outbuf (autoload-find-destination absfile)))
348 (with-current-buffer outbuf 354 (with-current-buffer outbuf
349 (setq relfile (file-relative-name absfile)) 355 (setq relfile (file-relative-name absfile))
350 (setq output-start (point))) 356 (setq output-start (point)))
@@ -418,21 +424,14 @@ save the buffer too.
418 424
419Return FILE if there was no autoload cookie in it, else nil." 425Return FILE if there was no autoload cookie in it, else nil."
420 (interactive "fUpdate autoloads for file: \np") 426 (interactive "fUpdate autoloads for file: \np")
421 (let ((existing-buffer (get-file-buffer file)) 427 (let ((no-autoloads nil))
422 (no-autoloads nil)) 428 (if (catch 'up-to-date
423 (with-temp-buffer 429 (progn
424 ;; Let's presume the file is not visited, so we call 430 (setq no-autoloads (autoload-generate-file-autoloads file))
425 ;; autoload-find-destination from a dummy buffer, except if the file 431 t))
426 ;; is visited, in which case we use that buffer instead. 432 (if save-after (autoload-save-buffers))
427 (if existing-buffer (set-buffer existing-buffer)) 433 (if (interactive-p)
428 434 (message "Autoload section for %s is up to date." file)))
429 (if (catch 'up-to-date
430 (with-current-buffer (autoload-find-destination file)
431 (setq no-autoloads (generate-file-autoloads file))
432 t))
433 (if save-after (autoload-save-buffers))
434 (if (interactive-p)
435 (message "Autoload section for %s is up to date." file))))
436 ;; If we caught `up-to-date', it means there are autoload entries, since 435 ;; If we caught `up-to-date', it means there are autoload entries, since
437 ;; otherwise we wouldn't have detected their up-to-dateness. 436 ;; otherwise we wouldn't have detected their up-to-dateness.
438 (if no-autoloads file))) 437 (if no-autoloads file)))