changeset 40451:9c7e47dd60be

(byte-recompile-directory): Report numbers of files skipped and failed too.
author Sam Steingold <sds@gnu.org>
date Mon, 29 Oct 2001 17:26:26 +0000
parents d29fac587062
children b656648ba424
files lisp/ChangeLog lisp/emacs-lisp/bytecomp.el
diffstat 2 files changed, 30 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Oct 29 15:46:46 2001 +0000
+++ b/lisp/ChangeLog	Mon Oct 29 17:26:26 2001 +0000
@@ -1,3 +1,9 @@
+2001-10-29  Sam Steingold  <sds@gnu.org>
+
+	* emacs-lisp/bytecomp.el (byte-recompile-directory): Report
+	numbers of files skipped and failed too.
+	(byte-compile-file): Return 'no-byte-compile for skipped files.
+
 2001-10-29  Kai Gro,A_(Bjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
 
 	* log-view.el (log-view-mode-map): Bind `M-n' and `M-p', not `M n'
--- a/lisp/emacs-lisp/bytecomp.el	Mon Oct 29 15:46:46 2001 +0000
+++ b/lisp/emacs-lisp/bytecomp.el	Mon Oct 29 17:26:26 2001 +0000
@@ -10,7 +10,7 @@
 
 ;;; This version incorporates changes up to version 2.10 of the
 ;;; Zawinski-Furuseth compiler.
-(defconst byte-compile-version "$Revision: 2.90 $")
+(defconst byte-compile-version "$Revision: 2.91 $")
 
 ;; This file is part of GNU Emacs.
 
@@ -1266,6 +1266,8 @@
     (save-some-buffers)
     (force-mode-line-update))
   (let ((directories (list (expand-file-name directory)))
+        (skip-count 0)
+        (fail-count 0)
 	(file-count 0)
 	(dir-count 0)
 	last-dir)
@@ -1275,9 +1277,9 @@
        (message "Checking %s..." directory)
        (let ((files (directory-files directory))
 	     source dest)
-	 (while files
-	   (setq source (expand-file-name (car files) directory))
-	   (if (and (not (member (car files) '("." ".." "RCS" "CVS")))
+	 (dolist (file files)
+	   (setq source (expand-file-name file directory))
+	   (if (and (not (member file '("." ".." "RCS" "CVS")))
 		    (file-directory-p source)
 		    (not (file-symlink-p source)))
 	       ;; This file is a subdirectory.  Handle them differently.
@@ -1300,18 +1302,24 @@
 				 (y-or-n-p (concat "Compile " source "? "))))))
 		 (progn (if (and noninteractive (not byte-compile-verbose))
 			    (message "Compiling %s..." source))
-			(byte-compile-file source)
+                        (let ((res (byte-compile-file source)))
+                          (cond ((eq res 'no-byte-compile)
+                                 (setq skip-count (1+ skip-count)))
+                                ((eq res t)
+                                 (setq file-count (1+ file-count)))
+                                ((eq res nil)
+                                 (setq fail-count (1+ fail-count)))))
 			(or noninteractive
 			    (message "Checking %s..." directory))
-			(setq file-count (1+ file-count))
 			(if (not (eq last-dir directory))
 			    (setq last-dir directory
 				  dir-count (1+ dir-count)))
-			)))
-	   (setq files (cdr files))))
+			)))))
        (setq directories (cdr directories))))
-    (message "Done (Total of %d file%s compiled%s)"
+    (message "Done (Total of %d file%s compiled%s%s%s)"
 	     file-count (if (= file-count 1) "" "s")
+             (if (> fail-count 0) (format ", %d failed" fail-count) "")
+             (if (> skip-count 0) (format ", %d skipped" skip-count) "")
 	     (if (> dir-count 1) (format " in %d directories" dir-count) ""))))
 
 ;;;###autoload
@@ -1319,7 +1327,7 @@
   "Compile a file of Lisp code named FILENAME into a file of byte code.
 The output file's name is made by appending `c' to the end of FILENAME.
 With prefix arg (noninteractively: 2nd arg), LOAD the file after compiling.
-The value is t if there were no errors, nil if errors."
+The value is non-nil if there were no errors, nil if errors."
 ;;  (interactive "fByte compile file: \nP")
   (interactive
    (let ((file buffer-file-name)
@@ -1389,7 +1397,7 @@
 	  (if (file-exists-p target-file)
 	      (condition-case nil (delete-file target-file) (error nil)))
 	  ;; We successfully didn't compile this file.
-	  t)
+	  'no-byte-compile)
       (if byte-compile-verbose
 	  (message "Compiling %s..." filename))
       (setq byte-compiler-error-flag nil)
@@ -3557,17 +3565,16 @@
       (if (file-directory-p (expand-file-name (car command-line-args-left)))
 	  (let ((files (directory-files (car command-line-args-left)))
 		source dest)
-	    (while files
-	      (if (and (string-match emacs-lisp-file-regexp (car files))
-		       (not (auto-save-file-name-p (car files)))
-		       (setq source (expand-file-name (car files)
+	    (dolist (file files)
+	      (if (and (string-match emacs-lisp-file-regexp file)
+		       (not (auto-save-file-name-p file))
+		       (setq source (expand-file-name file
 						      (car command-line-args-left)))
 		       (setq dest (byte-compile-dest-file source))
 		       (file-exists-p dest)
 		       (file-newer-than-file-p source dest))
 		  (if (null (batch-byte-compile-file source))
-		      (setq error t)))
-	      (setq files (cdr files))))
+		      (setq error t)))))
 	(if (null (batch-byte-compile-file (car command-line-args-left)))
 	    (setq error t)))
       (setq command-line-args-left (cdr command-line-args-left)))