Mercurial > emacs
comparison lisp/emacs-lisp/autoload.el @ 105605:97edf9210d35
(autoload-make-program): New variable.
(batch-update-autoloads): Handle autoload-excludes on windows-nt.
See discussion:
http://lists.gnu.org/archive/html/emacs-devel/2009-10/msg00243.html
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Thu, 15 Oct 2009 06:09:52 +0000 |
parents | 4adf54462047 |
children | 83dde921cc1b |
comparison
equal
deleted
inserted
replaced
105604:95ba84479a01 | 105605:97edf9210d35 |
---|---|
677 (autoload-save-buffers)))) | 677 (autoload-save-buffers)))) |
678 | 678 |
679 (define-obsolete-function-alias 'update-autoloads-from-directories | 679 (define-obsolete-function-alias 'update-autoloads-from-directories |
680 'update-directory-autoloads "22.1") | 680 'update-directory-autoloads "22.1") |
681 | 681 |
682 (defvar autoload-make-program (or (getenv "MAKE") "make") | |
683 "Name of the make program in use during the Emacs build process.") | |
684 | |
682 ;;;###autoload | 685 ;;;###autoload |
683 (defun batch-update-autoloads () | 686 (defun batch-update-autoloads () |
684 "Update loaddefs.el autoloads in batch mode. | 687 "Update loaddefs.el autoloads in batch mode. |
685 Calls `update-directory-autoloads' on the command line arguments." | 688 Calls `update-directory-autoloads' on the command line arguments." |
686 ;; For use during the Emacs build process only. | 689 ;; For use during the Emacs build process only. |
687 (unless autoload-excludes | 690 (unless autoload-excludes |
688 (let* ((ldir (file-name-directory generated-autoload-file)) | 691 (let* ((ldir (file-name-directory generated-autoload-file)) |
689 (mfile (expand-file-name "../src/Makefile" ldir)) | 692 (default-directory |
693 (file-name-as-directory | |
694 (expand-file-name (if (eq system-type 'windows-nt) | |
695 "../lib-src" | |
696 "../src") ldir))) | |
697 (mfile "Makefile") | |
698 (tmpfile "echolisp.tmp") | |
690 lim) | 699 lim) |
700 ;; Windows uses the 'echolisp' approach because: | |
701 ;; i) It does not have $lisp as a single simple definition, so | |
702 ;; it would be harder to parse the Makefile. | |
703 ;; ii) It can, since it already has $lisp broken up into pieces | |
704 ;; that the command-line can handle. | |
705 ;; Non-Windows builds do not use the 'echolisp' approach because | |
706 ;; no-one knows (?) the maximum safe command-line length on all | |
707 ;; supported systems. $lisp is much longer there since it uses | |
708 ;; absolute paths, and it would seem a shame to split it just for this. | |
691 (when (file-readable-p mfile) | 709 (when (file-readable-p mfile) |
692 (with-temp-buffer | 710 (if (eq system-type 'windows-nt) |
693 (insert-file-contents mfile) | 711 (when (ignore-errors |
694 (when (re-search-forward "^lisp= " nil t) | 712 (if (file-exists-p tmpfile) (delete-file tmpfile)) |
695 (setq lim (line-end-position)) | 713 ;; FIXME call-process is better, if it works. |
696 (while (re-search-forward "\\${lispsource}\\([^ ]+\\.el\\)c?\\>" | 714 (shell-command (format "%s echolisp > %s" |
697 lim t) | 715 autoload-make-program tmpfile)) |
698 (push (expand-file-name (match-string 1) ldir) | 716 (file-readable-p tmpfile)) |
699 autoload-excludes))))))) | 717 (with-temp-buffer |
718 (insert-file-contents tmpfile) | |
719 ;; FIXME could be a single while loop. | |
720 (while (not (eobp)) | |
721 (setq lim (line-end-position)) | |
722 (while (re-search-forward "\\([^ ]+\\.el\\)c?\\>" lim t) | |
723 (push (expand-file-name (match-string 1)) | |
724 autoload-excludes)) | |
725 (forward-line 1)))) | |
726 (with-temp-buffer | |
727 (insert-file-contents mfile) | |
728 (when (re-search-forward "^lisp= " nil t) | |
729 (setq lim (line-end-position)) | |
730 (while (re-search-forward "\\${lispsource}\\([^ ]+\\.el\\)c?\\>" | |
731 lim t) | |
732 (push (expand-file-name (match-string 1) ldir) | |
733 autoload-excludes)))))))) | |
700 (let ((args command-line-args-left)) | 734 (let ((args command-line-args-left)) |
701 (setq command-line-args-left nil) | 735 (setq command-line-args-left nil) |
702 (apply 'update-directory-autoloads args))) | 736 (apply 'update-directory-autoloads args))) |
703 | 737 |
704 (provide 'autoload) | 738 (provide 'autoload) |