aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2013-07-22 19:21:14 -0400
committerStefan Monnier2013-07-22 19:21:14 -0400
commit7d22ce18d44b3639e5644ed72c2bfc54ca8b91d2 (patch)
treed753517d107466b951e39df49fe9a4d4d65b2974
parent9b2607e821843c26fab866b2ebec7befef696c6b (diff)
downloademacs-7d22ce18d44b3639e5644ed72c2bfc54ca8b91d2.tar.gz
emacs-7d22ce18d44b3639e5644ed72c2bfc54ca8b91d2.zip
* lisp/emacs-lisp/autoload.el (autoload--setup-output): New function,
extracted from autoload--insert-text. (autoload--insert-text): Remove. (autoload--print-cookie-text): New function, extracted from autoload--insert-cookie-text. (autoload--insert-cookie-text): Remove. (autoload-generate-file-autoloads): Adjust calls accordingly.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/emacs-lisp/autoload.el65
2 files changed, 38 insertions, 35 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7e104ad69b9..660ea562910 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,13 @@
12013-07-22 Stefan Monnier <monnier@iro.umontreal.ca> 12013-07-22 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * emacs-lisp/autoload.el (autoload--setup-output): New function,
4 extracted from autoload--insert-text.
5 (autoload--insert-text): Remove.
6 (autoload--print-cookie-text): New function, extracted from
7 autoload--insert-cookie-text.
8 (autoload--insert-cookie-text): Remove.
9 (autoload-generate-file-autoloads): Adjust calls accordingly.
10
3 * winner.el (winner-hook-installed-p): Remove. 11 * winner.el (winner-hook-installed-p): Remove.
4 (winner-mode): Simplify accordingly. 12 (winner-mode): Simplify accordingly.
5 13
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index 22713c6589c..e531bc0bdae 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -436,33 +436,26 @@ Return non-nil in the case where no autoloads were added at point."
436 436
437(defvar print-readably) 437(defvar print-readably)
438 438
439(defun autoload--insert-text (output-start otherbuf outbuf absfile
440 load-name printfun)
441 ;; If not done yet, figure out where to insert this text.
442 (unless (marker-buffer output-start)
443 (let ((outbuf
444 (or (if otherbuf
445 ;; A file-local setting of
446 ;; autoload-generated-file says we
447 ;; should ignore OUTBUF.
448 nil
449 outbuf)
450 (autoload-find-destination absfile load-name)
451 ;; The file has autoload cookies, but they're
452 ;; already up-to-date. If OUTFILE is nil, the
453 ;; entries are in the expected OUTBUF,
454 ;; otherwise they're elsewhere.
455 (throw 'done otherbuf))))
456 (with-current-buffer outbuf
457 (move-marker output-start (point) outbuf))))
458 (let ((standard-output (marker-buffer output-start)))
459 (funcall printfun)))
460 439
461(defun autoload--insert-cookie-text (output-start otherbuf outbuf absfile 440(defun autoload--setup-output (otherbuf outbuf absfile load-name)
462 load-name file) 441 (let ((outbuf
463 (autoload--insert-text 442 (or (if otherbuf
464 output-start otherbuf outbuf absfile load-name 443 ;; A file-local setting of
465 (lambda () 444 ;; autoload-generated-file says we
445 ;; should ignore OUTBUF.
446 nil
447 outbuf)
448 (autoload-find-destination absfile load-name)
449 ;; The file has autoload cookies, but they're
450 ;; already up-to-date. If OUTFILE is nil, the
451 ;; entries are in the expected OUTBUF,
452 ;; otherwise they're elsewhere.
453 (throw 'done otherbuf))))
454 (with-current-buffer outbuf
455 (point-marker))))
456
457(defun autoload--print-cookie-text (output-start load-name file)
458 (let ((standard-output (marker-buffer output-start)))
466 (search-forward generate-autoload-cookie) 459 (search-forward generate-autoload-cookie)
467 (skip-chars-forward " \t") 460 (skip-chars-forward " \t")
468 (if (eolp) 461 (if (eolp)
@@ -490,7 +483,7 @@ Return non-nil in the case where no autoloads were added at point."
490 ;; Eat one space. 483 ;; Eat one space.
491 (forward-char 1)) 484 (forward-char 1))
492 (point)) 485 (point))
493 (progn (forward-line 1) (point)))))))) 486 (progn (forward-line 1) (point)))))))
494 487
495(defvar autoload-builtin-package-versions nil) 488(defvar autoload-builtin-package-versions nil)
496 489
@@ -553,23 +546,25 @@ Return non-nil if and only if FILE adds no autoloads to OUTFILE
553 (setq package (or (lm-header "package") 546 (setq package (or (lm-header "package")
554 (file-name-sans-extension 547 (file-name-sans-extension
555 (file-name-nondirectory file)))) 548 (file-name-nondirectory file))))
556 (setq output-start (make-marker)) 549 (setq output-start (autoload--setup-output
557 (autoload--insert-text 550 otherbuf outbuf absfile load-name))
558 output-start otherbuf outbuf absfile load-name 551 (let ((standard-output (marker-buffer output-start))
559 (lambda () 552 (print-quoted t))
560 (princ `(push (purecopy 553 (princ `(push (purecopy
561 ',(cons (intern package) version)) 554 ',(cons (intern package) version))
562 package--builtin-versions)) 555 package--builtin-versions))
563 (newline)))))) 556 (newline)))))
564 557
565 (goto-char (point-min)) 558 (goto-char (point-min))
566 (while (not (eobp)) 559 (while (not (eobp))
567 (skip-chars-forward " \t\n\f") 560 (skip-chars-forward " \t\n\f")
568 (cond 561 (cond
569 ((looking-at (regexp-quote generate-autoload-cookie)) 562 ((looking-at (regexp-quote generate-autoload-cookie))
570 (unless output-start (setq output-start (make-marker))) 563 ;; If not done yet, figure out where to insert this text.
571 (autoload--insert-cookie-text 564 (unless output-start
572 output-start otherbuf outbuf absfile load-name file)) 565 (setq output-start (autoload--setup-output
566 otherbuf outbuf absfile load-name)))
567 (autoload--print-cookie-text output-start load-name file))
573 ((looking-at ";") 568 ((looking-at ";")
574 ;; Don't read the comment. 569 ;; Don't read the comment.
575 (forward-line 1)) 570 (forward-line 1))