Mercurial > emacs
comparison lisp/emacs-lisp/bytecomp.el @ 13338:0f082123d484
(byte-recompile-directory): New arg FORCE.
(byte-force-recompile): New function.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 30 Oct 1995 18:01:22 +0000 |
parents | 2a0ef3a2ccc3 |
children | fd657bdc6982 |
comparison
equal
deleted
inserted
replaced
13337:84acc3adcd63 | 13338:0f082123d484 |
---|---|
1120 (goto-char byte-compile-warnings-point-max) | 1120 (goto-char byte-compile-warnings-point-max) |
1121 (recenter 1)))))))) | 1121 (recenter 1)))))))) |
1122 | 1122 |
1123 | 1123 |
1124 ;;;###autoload | 1124 ;;;###autoload |
1125 (defun byte-recompile-directory (directory &optional arg) | 1125 (defun byte-force-recompile (directory) |
1126 "Recompile every `.el' file in DIRECTORY that already has a `.elc' file. | |
1127 Files in subdirectories of DIRECTORY are processed also." | |
1128 (byte-recompile-directory directory nil t)) | |
1129 | |
1130 ;;;###autoload | |
1131 (defun byte-recompile-directory (directory &optional arg force) | |
1126 "Recompile every `.el' file in DIRECTORY that needs recompilation. | 1132 "Recompile every `.el' file in DIRECTORY that needs recompilation. |
1127 This is if a `.elc' file exists but is older than the `.el' file. | 1133 This is if a `.elc' file exists but is older than the `.el' file. |
1128 Files in subdirectories of DIRECTORY are processed also. | 1134 Files in subdirectories of DIRECTORY are processed also. |
1129 | 1135 |
1130 If the `.elc' file does not exist, normally the `.el' file is *not* compiled. | 1136 If the `.elc' file does not exist, normally the `.el' file is *not* compiled. |
1131 But a prefix argument (optional second arg) means ask user, | 1137 But a prefix argument (optional second arg) means ask user, |
1132 for each such `.el' file, whether to compile it. Prefix argument 0 means | 1138 for each such `.el' file, whether to compile it. Prefix argument 0 means |
1133 don't ask and compile the file anyway. | 1139 don't ask and compile the file anyway. |
1134 | 1140 |
1135 A nonzero prefix argument also means ask about each subdirectory." | 1141 A nonzero prefix argument also means ask about each subdirectory. |
1142 | |
1143 If the third argument FORCE is non-nil, | |
1144 recompile every `.el' file that already has a `.elc' file." | |
1136 (interactive "DByte recompile directory: \nP") | 1145 (interactive "DByte recompile directory: \nP") |
1137 (if arg | 1146 (if arg |
1138 (setq arg (prefix-numeric-value arg))) | 1147 (setq arg (prefix-numeric-value arg))) |
1139 (if noninteractive | 1148 (if noninteractive |
1140 nil | 1149 nil |
1153 (while files | 1162 (while files |
1154 (setq source (expand-file-name (car files) directory)) | 1163 (setq source (expand-file-name (car files) directory)) |
1155 (if (and (not (member (car files) '("." ".." "RCS" "CVS"))) | 1164 (if (and (not (member (car files) '("." ".." "RCS" "CVS"))) |
1156 (file-directory-p source) | 1165 (file-directory-p source) |
1157 (not (file-symlink-p source))) | 1166 (not (file-symlink-p source))) |
1167 ;; This file is a subdirectory. Handle them differently. | |
1158 (if (or (null arg) | 1168 (if (or (null arg) |
1159 (eq 0 arg) | 1169 (eq 0 arg) |
1160 (y-or-n-p (concat "Check " source "? "))) | 1170 (y-or-n-p (concat "Check " source "? "))) |
1161 (setq directories | 1171 (setq directories |
1162 (nconc directories (list source)))) | 1172 (nconc directories (list source)))) |
1173 ;; It is an ordinary file. Decide whether to compile it. | |
1163 (if (and (string-match emacs-lisp-file-regexp source) | 1174 (if (and (string-match emacs-lisp-file-regexp source) |
1164 (not (auto-save-file-name-p source)) | 1175 (not (auto-save-file-name-p source)) |
1165 (setq dest (byte-compile-dest-file source)) | 1176 (setq dest (byte-compile-dest-file source)) |
1166 (if (file-exists-p dest) | 1177 (if (file-exists-p dest) |
1167 (file-newer-than-file-p source dest) | 1178 ;; File was already compiled. |
1179 (or force (file-newer-than-file-p source dest)) | |
1180 ;; No compiled file exists yet. | |
1168 (and arg | 1181 (and arg |
1169 (or (eq 0 arg) | 1182 (or (eq 0 arg) |
1170 (y-or-n-p (concat "Compile " source "? ")))))) | 1183 (y-or-n-p (concat "Compile " source "? ")))))) |
1171 (progn (if (and noninteractive (not byte-compile-verbose)) | 1184 (progn (if (and noninteractive (not byte-compile-verbose)) |
1172 (message "Compiling %s..." source)) | 1185 (message "Compiling %s..." source)) |