aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-10-30 18:01:22 +0000
committerRichard M. Stallman1995-10-30 18:01:22 +0000
commit9742dbc0eaf8d533c82850945e8b440b8ab752a0 (patch)
tree1376bfd82cb4f0816b9221919bfa36b116553b31
parentbe010748989d2be1af4eaa5e602f4cf49d37bf26 (diff)
downloademacs-9742dbc0eaf8d533c82850945e8b440b8ab752a0.tar.gz
emacs-9742dbc0eaf8d533c82850945e8b440b8ab752a0.zip
(byte-recompile-directory): New arg FORCE.
(byte-force-recompile): New function.
-rw-r--r--lisp/emacs-lisp/bytecomp.el19
1 files changed, 16 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 3a52413ecc6..f323d8262dc 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1122,7 +1122,13 @@ otherwise pop it")
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.
1127Files 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.
1127This is if a `.elc' file exists but is older than the `.el' file. 1133This is if a `.elc' file exists but is older than the `.el' file.
1128Files in subdirectories of DIRECTORY are processed also. 1134Files in subdirectories of DIRECTORY are processed also.
@@ -1132,7 +1138,10 @@ But a prefix argument (optional second arg) means ask user,
1132for each such `.el' file, whether to compile it. Prefix argument 0 means 1138for each such `.el' file, whether to compile it. Prefix argument 0 means
1133don't ask and compile the file anyway. 1139don't ask and compile the file anyway.
1134 1140
1135A nonzero prefix argument also means ask about each subdirectory." 1141A nonzero prefix argument also means ask about each subdirectory.
1142
1143If the third argument FORCE is non-nil,
1144recompile 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)))
@@ -1155,16 +1164,20 @@ A nonzero prefix argument also means ask about each subdirectory."
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 "? "))))))