diff options
| author | Richard M. Stallman | 2002-09-09 19:35:57 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-09-09 19:35:57 +0000 |
| commit | 4eb4926c585b0074fb25f014c6d78239ee5b0421 (patch) | |
| tree | e07a3b479213386eb6976aba686fd5f29d28a53a | |
| parent | 9d5cf87c08343635aeff43fd93c65c7e11426312 (diff) | |
| download | emacs-4eb4926c585b0074fb25f014c6d78239ee5b0421.tar.gz emacs-4eb4926c585b0074fb25f014c6d78239ee5b0421.zip | |
(byte-recompile-directory): Set and then bind default-directory.
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 118 |
1 files changed, 61 insertions, 57 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index e83f07a4d3c..f5fec5b1262 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.111 $") | 13 | (defconst byte-compile-version "$Revision: 2.112 $") |
| 14 | 14 | ||
| 15 | ;; This file is part of GNU Emacs. | 15 | ;; This file is part of GNU Emacs. |
| 16 | 16 | ||
| @@ -1405,62 +1405,66 @@ recompile every `.el' file that already has a `.elc' file." | |||
| 1405 | nil | 1405 | nil |
| 1406 | (save-some-buffers) | 1406 | (save-some-buffers) |
| 1407 | (force-mode-line-update)) | 1407 | (force-mode-line-update)) |
| 1408 | (let ((directories (list (expand-file-name directory))) | 1408 | (save-current-buffer |
| 1409 | (skip-count 0) | 1409 | (byte-goto-log-buffer) |
| 1410 | (fail-count 0) | 1410 | (setq default-directory directory) |
| 1411 | (file-count 0) | 1411 | (let ((directories (list (expand-file-name directory))) |
| 1412 | (dir-count 0) | 1412 | (default-directory default-directory) |
| 1413 | last-dir) | 1413 | (skip-count 0) |
| 1414 | (displaying-byte-compile-warnings | 1414 | (fail-count 0) |
| 1415 | (while directories | 1415 | (file-count 0) |
| 1416 | (setq directory (car directories)) | 1416 | (dir-count 0) |
| 1417 | (message "Checking %s..." directory) | 1417 | last-dir) |
| 1418 | (let ((files (directory-files directory)) | 1418 | (displaying-byte-compile-warnings |
| 1419 | source dest) | 1419 | (while directories |
| 1420 | (dolist (file files) | 1420 | (setq directory (car directories)) |
| 1421 | (setq source (expand-file-name file directory)) | 1421 | (message "Checking %s..." directory) |
| 1422 | (if (and (not (member file '("." ".." "RCS" "CVS"))) | 1422 | (let ((files (directory-files directory)) |
| 1423 | (file-directory-p source) | 1423 | source dest) |
| 1424 | (not (file-symlink-p source))) | 1424 | (dolist (file files) |
| 1425 | ;; This file is a subdirectory. Handle them differently. | 1425 | (setq source (expand-file-name file directory)) |
| 1426 | (when (or (null arg) | 1426 | (if (and (not (member file '("." ".." "RCS" "CVS"))) |
| 1427 | (eq 0 arg) | 1427 | (file-directory-p source) |
| 1428 | (y-or-n-p (concat "Check " source "? "))) | 1428 | (not (file-symlink-p source))) |
| 1429 | (setq directories | 1429 | ;; This file is a subdirectory. Handle them differently. |
| 1430 | (nconc directories (list source)))) | 1430 | (when (or (null arg) |
| 1431 | ;; It is an ordinary file. Decide whether to compile it. | 1431 | (eq 0 arg) |
| 1432 | (if (and (string-match emacs-lisp-file-regexp source) | 1432 | (y-or-n-p (concat "Check " source "? "))) |
| 1433 | (file-readable-p source) | 1433 | (setq directories |
| 1434 | (not (auto-save-file-name-p source)) | 1434 | (nconc directories (list source)))) |
| 1435 | (setq dest (byte-compile-dest-file source)) | 1435 | ;; It is an ordinary file. Decide whether to compile it. |
| 1436 | (if (file-exists-p dest) | 1436 | (if (and (string-match emacs-lisp-file-regexp source) |
| 1437 | ;; File was already compiled. | 1437 | (file-readable-p source) |
| 1438 | (or force (file-newer-than-file-p source dest)) | 1438 | (not (auto-save-file-name-p source)) |
| 1439 | ;; No compiled file exists yet. | 1439 | (setq dest (byte-compile-dest-file source)) |
| 1440 | (and arg | 1440 | (if (file-exists-p dest) |
| 1441 | (or (eq 0 arg) | 1441 | ;; File was already compiled. |
| 1442 | (y-or-n-p (concat "Compile " source "? ")))))) | 1442 | (or force (file-newer-than-file-p source dest)) |
| 1443 | (progn (if (and noninteractive (not byte-compile-verbose)) | 1443 | ;; No compiled file exists yet. |
| 1444 | (message "Compiling %s..." source)) | 1444 | (and arg |
| 1445 | (let ((res (byte-compile-file source))) | 1445 | (or (eq 0 arg) |
| 1446 | (cond ((eq res 'no-byte-compile) | 1446 | (y-or-n-p (concat "Compile " source "? ")))))) |
| 1447 | (setq skip-count (1+ skip-count))) | 1447 | (progn (if (and noninteractive (not byte-compile-verbose)) |
| 1448 | ((eq res t) | 1448 | (message "Compiling %s..." source)) |
| 1449 | (setq file-count (1+ file-count))) | 1449 | (let ((res (byte-compile-file source))) |
| 1450 | ((eq res nil) | 1450 | (cond ((eq res 'no-byte-compile) |
| 1451 | (setq fail-count (1+ fail-count))))) | 1451 | (setq skip-count (1+ skip-count))) |
| 1452 | (or noninteractive | 1452 | ((eq res t) |
| 1453 | (message "Checking %s..." directory)) | 1453 | (setq file-count (1+ file-count))) |
| 1454 | (if (not (eq last-dir directory)) | 1454 | ((eq res nil) |
| 1455 | (setq last-dir directory | 1455 | (setq fail-count (1+ fail-count))))) |
| 1456 | dir-count (1+ dir-count))) | 1456 | (or noninteractive |
| 1457 | ))))) | 1457 | (message "Checking %s..." directory)) |
| 1458 | (setq directories (cdr directories)))) | 1458 | (if (not (eq last-dir directory)) |
| 1459 | (message "Done (Total of %d file%s compiled%s%s%s)" | 1459 | (setq last-dir directory |
| 1460 | file-count (if (= file-count 1) "" "s") | 1460 | dir-count (1+ dir-count))) |
| 1461 | (if (> fail-count 0) (format ", %d failed" fail-count) "") | 1461 | ))))) |
| 1462 | (if (> skip-count 0) (format ", %d skipped" skip-count) "") | 1462 | (setq directories (cdr directories)))) |
| 1463 | (if (> dir-count 1) (format " in %d directories" dir-count) "")))) | 1463 | (message "Done (Total of %d file%s compiled%s%s%s)" |
| 1464 | file-count (if (= file-count 1) "" "s") | ||
| 1465 | (if (> fail-count 0) (format ", %d failed" fail-count) "") | ||
| 1466 | (if (> skip-count 0) (format ", %d skipped" skip-count) "") | ||
| 1467 | (if (> dir-count 1) (format " in %d directories" dir-count) ""))))) | ||
| 1464 | 1468 | ||
| 1465 | (defvar no-byte-compile nil | 1469 | (defvar no-byte-compile nil |
| 1466 | "Non-nil to prevent byte-compiling of emacs-lisp code. | 1470 | "Non-nil to prevent byte-compiling of emacs-lisp code. |