diff options
| author | Richard M. Stallman | 2002-02-01 04:14:14 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-02-01 04:14:14 +0000 |
| commit | 7e7d0f8bc28f596a344d70d159f0b46a214f2dca (patch) | |
| tree | 8db21ec73829845c9bd3873ed6e55ad3f95de99a | |
| parent | 61b92c330e136eee127449d1fc5e68680ca38b87 (diff) | |
| download | emacs-7e7d0f8bc28f596a344d70d159f0b46a214f2dca.tar.gz emacs-7e7d0f8bc28f596a344d70d159f0b46a214f2dca.zip | |
(batch-byte-compile): New arg noforce.
(batch-byte-compile-if-not-done): New function.
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 5504f5448e3..6f8322d5ea5 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | ;;; This version incorporates changes up to version 2.10 of the | 11 | ;;; This version incorporates changes up to version 2.10 of the |
| 12 | ;;; Zawinski-Furuseth compiler. | 12 | ;;; Zawinski-Furuseth compiler. |
| 13 | (defconst byte-compile-version "$Revision: 2.92 $") | 13 | (defconst byte-compile-version "$Revision: 2.93 $") |
| 14 | 14 | ||
| 15 | ;; This file is part of GNU Emacs. | 15 | ;; This file is part of GNU Emacs. |
| 16 | 16 | ||
| @@ -3554,15 +3554,23 @@ invoked interactively." | |||
| 3554 | )) | 3554 | )) |
| 3555 | 3555 | ||
| 3556 | 3556 | ||
| 3557 | (defun batch-byte-compile-if-not-done () | ||
| 3558 | "Like `byte-compile-file' but doesn't recompile if already up to date. | ||
| 3559 | Use this from the command line, with `-batch'; | ||
| 3560 | it won't work in an interactive Emacs." | ||
| 3561 | (batch-byte-compile t)) | ||
| 3562 | |||
| 3557 | ;;; by crl@newton.purdue.edu | 3563 | ;;; by crl@newton.purdue.edu |
| 3558 | ;;; Only works noninteractively. | 3564 | ;;; Only works noninteractively. |
| 3559 | ;;;###autoload | 3565 | ;;;###autoload |
| 3560 | (defun batch-byte-compile () | 3566 | (defun batch-byte-compile (&optional noforce) |
| 3561 | "Run `byte-compile-file' on the files remaining on the command line. | 3567 | "Run `byte-compile-file' on the files remaining on the command line. |
| 3562 | Use this from the command line, with `-batch'; | 3568 | Use this from the command line, with `-batch'; |
| 3563 | it won't work in an interactive Emacs. | 3569 | it won't work in an interactive Emacs. |
| 3564 | Each file is processed even if an error occurred previously. | 3570 | Each file is processed even if an error occurred previously. |
| 3565 | For example, invoke \"emacs -batch -f batch-byte-compile $emacs/ ~/*.el\"" | 3571 | For example, invoke \"emacs -batch -f batch-byte-compile $emacs/ ~/*.el\". |
| 3572 | If NOFORCE is non-nil, don't recompile a file that seems to be | ||
| 3573 | already up-to-date." | ||
| 3566 | ;; command-line-args-left is what is left of the command line (from startup.el) | 3574 | ;; command-line-args-left is what is left of the command line (from startup.el) |
| 3567 | (defvar command-line-args-left) ;Avoid 'free variable' warning | 3575 | (defvar command-line-args-left) ;Avoid 'free variable' warning |
| 3568 | (if (not noninteractive) | 3576 | (if (not noninteractive) |
| @@ -3570,6 +3578,7 @@ For example, invoke \"emacs -batch -f batch-byte-compile $emacs/ ~/*.el\"" | |||
| 3570 | (let ((error nil)) | 3578 | (let ((error nil)) |
| 3571 | (while command-line-args-left | 3579 | (while command-line-args-left |
| 3572 | (if (file-directory-p (expand-file-name (car command-line-args-left))) | 3580 | (if (file-directory-p (expand-file-name (car command-line-args-left))) |
| 3581 | ;; Directory as argument. | ||
| 3573 | (let ((files (directory-files (car command-line-args-left))) | 3582 | (let ((files (directory-files (car command-line-args-left))) |
| 3574 | source dest) | 3583 | source dest) |
| 3575 | (dolist (file files) | 3584 | (dolist (file files) |
| @@ -3582,8 +3591,14 @@ For example, invoke \"emacs -batch -f batch-byte-compile $emacs/ ~/*.el\"" | |||
| 3582 | (file-newer-than-file-p source dest)) | 3591 | (file-newer-than-file-p source dest)) |
| 3583 | (if (null (batch-byte-compile-file source)) | 3592 | (if (null (batch-byte-compile-file source)) |
| 3584 | (setq error t))))) | 3593 | (setq error t))))) |
| 3585 | (if (null (batch-byte-compile-file (car command-line-args-left))) | 3594 | ;; Specific file argument |
| 3586 | (setq error t))) | 3595 | (if (or (not noforce) |
| 3596 | (let* ((source (car command-line-args-left)) | ||
| 3597 | (dest (byte-compile-dest-file source))) | ||
| 3598 | (or (not (file-exists-p dest)) | ||
| 3599 | (file-newer-than-file-p source dest)))) | ||
| 3600 | (if (null (batch-byte-compile-file (car command-line-args-left))) | ||
| 3601 | (setq error t)))) | ||
| 3587 | (setq command-line-args-left (cdr command-line-args-left))) | 3602 | (setq command-line-args-left (cdr command-line-args-left))) |
| 3588 | (kill-emacs (if error 1 0)))) | 3603 | (kill-emacs (if error 1 0)))) |
| 3589 | 3604 | ||