diff options
| author | Glenn Morris | 2008-03-01 21:11:37 +0000 |
|---|---|---|
| committer | Glenn Morris | 2008-03-01 21:11:37 +0000 |
| commit | 1c3b663ff9ddd975a2a502299c5aa6da623cee3e (patch) | |
| tree | ff13822363d49aeb30c3a631945048927744be76 | |
| parent | 565b39a8569153267d5a837bf9744aac925ca15d (diff) | |
| download | emacs-1c3b663ff9ddd975a2a502299c5aa6da623cee3e.tar.gz emacs-1c3b663ff9ddd975a2a502299c5aa6da623cee3e.zip | |
This is Dan's patch from
http://lists.gnu.org/archive/html/bug-gnu-emacs/2008-02/msg00134.html
changed to use a common `bytecomp' prefix.
(byte-recompile-directory, byte-compile-file, batch-byte-compile)
(batch-byte-compile-file): Give a `bytecomp-' prefix to local
variables with common names.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 211 |
2 files changed, 120 insertions, 98 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e774809a71d..f77ca943161 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2008-03-01 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 2 | Glenn Morris <rgm@gnu.org> | ||
| 3 | |||
| 4 | * emacs-lisp/bytecomp.el (byte-recompile-directory) | ||
| 5 | (byte-compile-file, batch-byte-compile, batch-byte-compile-file): | ||
| 6 | Give a `bytecomp-' prefix to local variables with common names. | ||
| 7 | |||
| 1 | 2008-03-01 Glenn Morris <rgm@gnu.org> | 8 | 2008-03-01 Glenn Morris <rgm@gnu.org> |
| 2 | 9 | ||
| 3 | * emacs-lisp/bytecomp.el (byte-compile-maybe-guarded): Restore | 10 | * emacs-lisp/bytecomp.el (byte-compile-maybe-guarded): Restore |
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 064a7aeb768..797c44ead10 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -1573,35 +1573,40 @@ Files in subdirectories of DIRECTORY are processed also." | |||
| 1573 | (interactive "DByte force recompile (directory): ") | 1573 | (interactive "DByte force recompile (directory): ") |
| 1574 | (byte-recompile-directory directory nil t)) | 1574 | (byte-recompile-directory directory nil t)) |
| 1575 | 1575 | ||
| 1576 | ;; The `bytecomp-' prefix is applied to all local variables with | ||
| 1577 | ;; otherwise common names in this and similar functions for the sake | ||
| 1578 | ;; of the boundp test in byte-compile-variable-ref. | ||
| 1579 | ;; http://lists.gnu.org/archive/html/emacs-devel/2008-01/msg00237.html | ||
| 1580 | ;; http://lists.gnu.org/archive/html/bug-gnu-emacs/2008-02/msg00134.html | ||
| 1576 | ;;;###autoload | 1581 | ;;;###autoload |
| 1577 | (defun byte-recompile-directory (directory &optional arg force) | 1582 | (defun byte-recompile-directory (bytecomp-directory &optional bytecomp-arg |
| 1578 | "Recompile every `.el' file in DIRECTORY that needs recompilation. | 1583 | bytecomp-force) |
| 1584 | "Recompile every `.el' file in BYTECOMP-DIRECTORY that needs recompilation. | ||
| 1579 | This is if a `.elc' file exists but is older than the `.el' file. | 1585 | This is if a `.elc' file exists but is older than the `.el' file. |
| 1580 | Files in subdirectories of DIRECTORY are processed also. | 1586 | Files in subdirectories of BYTECOMP-DIRECTORY are processed also. |
| 1581 | 1587 | ||
| 1582 | If the `.elc' file does not exist, normally this function *does not* | 1588 | If the `.elc' file does not exist, normally this function *does not* |
| 1583 | compile the corresponding `.el' file. However, | 1589 | compile the corresponding `.el' file. However, if the prefix argument |
| 1584 | if ARG (the prefix argument) is 0, that means do compile all those files. | 1590 | BYTECOMP-ARG is 0, that means do compile all those files. A nonzero |
| 1585 | A nonzero ARG means ask the user, for each such `.el' file, | 1591 | BYTECOMP-ARG means ask the user, for each such `.el' file, whether to |
| 1586 | whether to compile it. | 1592 | compile it. A nonzero BYTECOMP-ARG also means ask about each subdirectory |
| 1587 | 1593 | before scanning it. | |
| 1588 | A nonzero ARG also means ask about each subdirectory before scanning it. | 1594 | |
| 1589 | 1595 | If the third argument BYTECOMP-FORCE is non-nil, recompile every `.el' file | |
| 1590 | If the third argument FORCE is non-nil, | 1596 | that already has a `.elc' file." |
| 1591 | recompile every `.el' file that already has a `.elc' file." | ||
| 1592 | (interactive "DByte recompile directory: \nP") | 1597 | (interactive "DByte recompile directory: \nP") |
| 1593 | (if arg | 1598 | (if bytecomp-arg |
| 1594 | (setq arg (prefix-numeric-value arg))) | 1599 | (setq bytecomp-arg (prefix-numeric-value bytecomp-arg))) |
| 1595 | (if noninteractive | 1600 | (if noninteractive |
| 1596 | nil | 1601 | nil |
| 1597 | (save-some-buffers) | 1602 | (save-some-buffers) |
| 1598 | (force-mode-line-update)) | 1603 | (force-mode-line-update)) |
| 1599 | (with-current-buffer (get-buffer-create "*Compile-Log*") | 1604 | (with-current-buffer (get-buffer-create "*Compile-Log*") |
| 1600 | (setq default-directory (expand-file-name directory)) | 1605 | (setq default-directory (expand-file-name bytecomp-directory)) |
| 1601 | ;; compilation-mode copies value of default-directory. | 1606 | ;; compilation-mode copies value of default-directory. |
| 1602 | (unless (eq major-mode 'compilation-mode) | 1607 | (unless (eq major-mode 'compilation-mode) |
| 1603 | (compilation-mode)) | 1608 | (compilation-mode)) |
| 1604 | (let ((directories (list default-directory)) | 1609 | (let ((bytecomp-directories (list default-directory)) |
| 1605 | (default-directory default-directory) | 1610 | (default-directory default-directory) |
| 1606 | (skip-count 0) | 1611 | (skip-count 0) |
| 1607 | (fail-count 0) | 1612 | (fail-count 0) |
| @@ -1609,56 +1614,63 @@ recompile every `.el' file that already has a `.elc' file." | |||
| 1609 | (dir-count 0) | 1614 | (dir-count 0) |
| 1610 | last-dir) | 1615 | last-dir) |
| 1611 | (displaying-byte-compile-warnings | 1616 | (displaying-byte-compile-warnings |
| 1612 | (while directories | 1617 | (while bytecomp-directories |
| 1613 | (setq directory (car directories)) | 1618 | (setq bytecomp-directory (car bytecomp-directories)) |
| 1614 | (message "Checking %s..." directory) | 1619 | (message "Checking %s..." bytecomp-directory) |
| 1615 | (let ((files (directory-files directory)) | 1620 | (let ((bytecomp-files (directory-files bytecomp-directory)) |
| 1616 | source dest) | 1621 | bytecomp-source bytecomp-dest) |
| 1617 | (dolist (file files) | 1622 | (dolist (bytecomp-file bytecomp-files) |
| 1618 | (setq source (expand-file-name file directory)) | 1623 | (setq bytecomp-source |
| 1619 | (if (and (not (member file '("RCS" "CVS"))) | 1624 | (expand-file-name bytecomp-file bytecomp-directory)) |
| 1620 | (not (eq ?\. (aref file 0))) | 1625 | (if (and (not (member bytecomp-file '("RCS" "CVS"))) |
| 1621 | (file-directory-p source) | 1626 | (not (eq ?\. (aref bytecomp-file 0))) |
| 1622 | (not (file-symlink-p source))) | 1627 | (file-directory-p bytecomp-source) |
| 1628 | (not (file-symlink-p bytecomp-source))) | ||
| 1623 | ;; This file is a subdirectory. Handle them differently. | 1629 | ;; This file is a subdirectory. Handle them differently. |
| 1624 | (when (or (null arg) | 1630 | (when (or (null bytecomp-arg) |
| 1625 | (eq 0 arg) | 1631 | (eq 0 bytecomp-arg) |
| 1626 | (y-or-n-p (concat "Check " source "? "))) | 1632 | (y-or-n-p (concat "Check " bytecomp-source "? "))) |
| 1627 | (setq directories | 1633 | (setq bytecomp-directories |
| 1628 | (nconc directories (list source)))) | 1634 | (nconc bytecomp-directories (list bytecomp-source)))) |
| 1629 | ;; It is an ordinary file. Decide whether to compile it. | 1635 | ;; It is an ordinary file. Decide whether to compile it. |
| 1630 | (if (and (string-match emacs-lisp-file-regexp source) | 1636 | (if (and (string-match emacs-lisp-file-regexp bytecomp-source) |
| 1631 | (file-readable-p source) | 1637 | (file-readable-p bytecomp-source) |
| 1632 | (not (auto-save-file-name-p source)) | 1638 | (not (auto-save-file-name-p bytecomp-source)) |
| 1633 | (setq dest (byte-compile-dest-file source)) | 1639 | (setq bytecomp-dest |
| 1634 | (if (file-exists-p dest) | 1640 | (byte-compile-dest-file bytecomp-source)) |
| 1641 | (if (file-exists-p bytecomp-dest) | ||
| 1635 | ;; File was already compiled. | 1642 | ;; File was already compiled. |
| 1636 | (or force (file-newer-than-file-p source dest)) | 1643 | (or bytecomp-force |
| 1644 | (file-newer-than-file-p bytecomp-source | ||
| 1645 | bytecomp-dest)) | ||
| 1637 | ;; No compiled file exists yet. | 1646 | ;; No compiled file exists yet. |
| 1638 | (and arg | 1647 | (and bytecomp-arg |
| 1639 | (or (eq 0 arg) | 1648 | (or (eq 0 bytecomp-arg) |
| 1640 | (y-or-n-p (concat "Compile " source "? ")))))) | 1649 | (y-or-n-p (concat "Compile " |
| 1650 | bytecomp-source "? ")))))) | ||
| 1641 | (progn (if (and noninteractive (not byte-compile-verbose)) | 1651 | (progn (if (and noninteractive (not byte-compile-verbose)) |
| 1642 | (message "Compiling %s..." source)) | 1652 | (message "Compiling %s..." bytecomp-source)) |
| 1643 | (let ((res (byte-compile-file source))) | 1653 | (let ((bytecomp-res (byte-compile-file |
| 1644 | (cond ((eq res 'no-byte-compile) | 1654 | bytecomp-source))) |
| 1655 | (cond ((eq bytecomp-res 'no-byte-compile) | ||
| 1645 | (setq skip-count (1+ skip-count))) | 1656 | (setq skip-count (1+ skip-count))) |
| 1646 | ((eq res t) | 1657 | ((eq bytecomp-res t) |
| 1647 | (setq file-count (1+ file-count))) | 1658 | (setq file-count (1+ file-count))) |
| 1648 | ((eq res nil) | 1659 | ((eq bytecomp-res nil) |
| 1649 | (setq fail-count (1+ fail-count))))) | 1660 | (setq fail-count (1+ fail-count))))) |
| 1650 | (or noninteractive | 1661 | (or noninteractive |
| 1651 | (message "Checking %s..." directory)) | 1662 | (message "Checking %s..." bytecomp-directory)) |
| 1652 | (if (not (eq last-dir directory)) | 1663 | (if (not (eq last-dir bytecomp-directory)) |
| 1653 | (setq last-dir directory | 1664 | (setq last-dir bytecomp-directory |
| 1654 | dir-count (1+ dir-count))) | 1665 | dir-count (1+ dir-count))) |
| 1655 | ))))) | 1666 | ))))) |
| 1656 | (setq directories (cdr directories)))) | 1667 | (setq bytecomp-directories (cdr bytecomp-directories)))) |
| 1657 | (message "Done (Total of %d file%s compiled%s%s%s)" | 1668 | (message "Done (Total of %d file%s compiled%s%s%s)" |
| 1658 | file-count (if (= file-count 1) "" "s") | 1669 | file-count (if (= file-count 1) "" "s") |
| 1659 | (if (> fail-count 0) (format ", %d failed" fail-count) "") | 1670 | (if (> fail-count 0) (format ", %d failed" fail-count) "") |
| 1660 | (if (> skip-count 0) (format ", %d skipped" skip-count) "") | 1671 | (if (> skip-count 0) (format ", %d skipped" skip-count) "") |
| 1661 | (if (> dir-count 1) (format " in %d directories" dir-count) ""))))) | 1672 | (if (> dir-count 1) |
| 1673 | (format " in %d directories" dir-count) ""))))) | ||
| 1662 | 1674 | ||
| 1663 | (defvar no-byte-compile nil | 1675 | (defvar no-byte-compile nil |
| 1664 | "Non-nil to prevent byte-compiling of emacs-lisp code. | 1676 | "Non-nil to prevent byte-compiling of emacs-lisp code. |
| @@ -1668,45 +1680,45 @@ This is normally set in local file variables at the end of the elisp file: | |||
| 1668 | ;;;###autoload(put 'no-byte-compile 'safe-local-variable 'booleanp) | 1680 | ;;;###autoload(put 'no-byte-compile 'safe-local-variable 'booleanp) |
| 1669 | 1681 | ||
| 1670 | ;;;###autoload | 1682 | ;;;###autoload |
| 1671 | (defun byte-compile-file (filename &optional load) | 1683 | (defun byte-compile-file (bytecomp-filename &optional load) |
| 1672 | "Compile a file of Lisp code named FILENAME into a file of byte code. | 1684 | "Compile a file of Lisp code named BYTECOMP-FILENAME into a file of byte code. |
| 1673 | The output file's name is generated by passing FILENAME to the | 1685 | The output file's name is generated by passing BYTECOMP-FILENAME to the |
| 1674 | `byte-compile-dest-file' function (which see). | 1686 | `byte-compile-dest-file' function (which see). |
| 1675 | With prefix arg (noninteractively: 2nd arg), LOAD the file after compiling. | 1687 | With prefix arg (noninteractively: 2nd arg), LOAD the file after compiling. |
| 1676 | The value is non-nil if there were no errors, nil if errors." | 1688 | The value is non-nil if there were no errors, nil if errors." |
| 1677 | ;; (interactive "fByte compile file: \nP") | 1689 | ;; (interactive "fByte compile file: \nP") |
| 1678 | (interactive | 1690 | (interactive |
| 1679 | (let ((file buffer-file-name) | 1691 | (let ((bytecomp-file buffer-file-name) |
| 1680 | (file-name nil) | 1692 | (bytecomp-file-name nil) |
| 1681 | (file-dir nil)) | 1693 | (bytecomp-file-dir nil)) |
| 1682 | (and file | 1694 | (and bytecomp-file |
| 1683 | (eq (cdr (assq 'major-mode (buffer-local-variables))) | 1695 | (eq (cdr (assq 'major-mode (buffer-local-variables))) |
| 1684 | 'emacs-lisp-mode) | 1696 | 'emacs-lisp-mode) |
| 1685 | (setq file-name (file-name-nondirectory file) | 1697 | (setq bytecomp-file-name (file-name-nondirectory bytecomp-file) |
| 1686 | file-dir (file-name-directory file))) | 1698 | bytecomp-file-dir (file-name-directory bytecomp-file))) |
| 1687 | (list (read-file-name (if current-prefix-arg | 1699 | (list (read-file-name (if current-prefix-arg |
| 1688 | "Byte compile and load file: " | 1700 | "Byte compile and load file: " |
| 1689 | "Byte compile file: ") | 1701 | "Byte compile file: ") |
| 1690 | file-dir file-name nil) | 1702 | bytecomp-file-dir bytecomp-file-name nil) |
| 1691 | current-prefix-arg))) | 1703 | current-prefix-arg))) |
| 1692 | ;; Expand now so we get the current buffer's defaults | 1704 | ;; Expand now so we get the current buffer's defaults |
| 1693 | (setq filename (expand-file-name filename)) | 1705 | (setq bytecomp-filename (expand-file-name bytecomp-filename)) |
| 1694 | 1706 | ||
| 1695 | ;; If we're compiling a file that's in a buffer and is modified, offer | 1707 | ;; If we're compiling a file that's in a buffer and is modified, offer |
| 1696 | ;; to save it first. | 1708 | ;; to save it first. |
| 1697 | (or noninteractive | 1709 | (or noninteractive |
| 1698 | (let ((b (get-file-buffer (expand-file-name filename)))) | 1710 | (let ((b (get-file-buffer (expand-file-name bytecomp-filename)))) |
| 1699 | (if (and b (buffer-modified-p b) | 1711 | (if (and b (buffer-modified-p b) |
| 1700 | (y-or-n-p (format "Save buffer %s first? " (buffer-name b)))) | 1712 | (y-or-n-p (format "Save buffer %s first? " (buffer-name b)))) |
| 1701 | (with-current-buffer b (save-buffer))))) | 1713 | (with-current-buffer b (save-buffer))))) |
| 1702 | 1714 | ||
| 1703 | ;; Force logging of the file name for each file compiled. | 1715 | ;; Force logging of the file name for each file compiled. |
| 1704 | (setq byte-compile-last-logged-file nil) | 1716 | (setq byte-compile-last-logged-file nil) |
| 1705 | (let ((byte-compile-current-file filename) | 1717 | (let ((byte-compile-current-file bytecomp-filename) |
| 1706 | (set-auto-coding-for-load t) | 1718 | (set-auto-coding-for-load t) |
| 1707 | target-file input-buffer output-buffer | 1719 | target-file input-buffer output-buffer |
| 1708 | byte-compile-dest-file) | 1720 | byte-compile-dest-file) |
| 1709 | (setq target-file (byte-compile-dest-file filename)) | 1721 | (setq target-file (byte-compile-dest-file bytecomp-filename)) |
| 1710 | (setq byte-compile-dest-file target-file) | 1722 | (setq byte-compile-dest-file target-file) |
| 1711 | (with-current-buffer | 1723 | (with-current-buffer |
| 1712 | (setq input-buffer (get-buffer-create " *Compiler Input*")) | 1724 | (setq input-buffer (get-buffer-create " *Compiler Input*")) |
| @@ -1715,7 +1727,7 @@ The value is non-nil if there were no errors, nil if errors." | |||
| 1715 | ;; Always compile an Emacs Lisp file as multibyte | 1727 | ;; Always compile an Emacs Lisp file as multibyte |
| 1716 | ;; unless the file itself forces unibyte with -*-coding: raw-text;-*- | 1728 | ;; unless the file itself forces unibyte with -*-coding: raw-text;-*- |
| 1717 | (set-buffer-multibyte t) | 1729 | (set-buffer-multibyte t) |
| 1718 | (insert-file-contents filename) | 1730 | (insert-file-contents bytecomp-filename) |
| 1719 | ;; Mimic the way after-insert-file-set-coding can make the | 1731 | ;; Mimic the way after-insert-file-set-coding can make the |
| 1720 | ;; buffer unibyte when visiting this file. | 1732 | ;; buffer unibyte when visiting this file. |
| 1721 | (when (or (eq last-coding-system-used 'no-conversion) | 1733 | (when (or (eq last-coding-system-used 'no-conversion) |
| @@ -1725,7 +1737,7 @@ The value is non-nil if there were no errors, nil if errors." | |||
| 1725 | (set-buffer-multibyte nil)) | 1737 | (set-buffer-multibyte nil)) |
| 1726 | ;; Run hooks including the uncompression hook. | 1738 | ;; Run hooks including the uncompression hook. |
| 1727 | ;; If they change the file name, then change it for the output also. | 1739 | ;; If they change the file name, then change it for the output also. |
| 1728 | (let ((buffer-file-name filename) | 1740 | (let ((buffer-file-name bytecomp-filename) |
| 1729 | (default-major-mode 'emacs-lisp-mode) | 1741 | (default-major-mode 'emacs-lisp-mode) |
| 1730 | ;; Ignore unsafe local variables. | 1742 | ;; Ignore unsafe local variables. |
| 1731 | ;; We only care about a few of them for our purposes. | 1743 | ;; We only care about a few of them for our purposes. |
| @@ -1733,15 +1745,15 @@ The value is non-nil if there were no errors, nil if errors." | |||
| 1733 | (enable-local-eval nil)) | 1745 | (enable-local-eval nil)) |
| 1734 | ;; Arg of t means don't alter enable-local-variables. | 1746 | ;; Arg of t means don't alter enable-local-variables. |
| 1735 | (normal-mode t) | 1747 | (normal-mode t) |
| 1736 | (setq filename buffer-file-name)) | 1748 | (setq bytecomp-filename buffer-file-name)) |
| 1737 | ;; Set the default directory, in case an eval-when-compile uses it. | 1749 | ;; Set the default directory, in case an eval-when-compile uses it. |
| 1738 | (setq default-directory (file-name-directory filename))) | 1750 | (setq default-directory (file-name-directory bytecomp-filename))) |
| 1739 | ;; Check if the file's local variables explicitly specify not to | 1751 | ;; Check if the file's local variables explicitly specify not to |
| 1740 | ;; compile this file. | 1752 | ;; compile this file. |
| 1741 | (if (with-current-buffer input-buffer no-byte-compile) | 1753 | (if (with-current-buffer input-buffer no-byte-compile) |
| 1742 | (progn | 1754 | (progn |
| 1743 | ;; (message "%s not compiled because of `no-byte-compile: %s'" | 1755 | ;; (message "%s not compiled because of `no-byte-compile: %s'" |
| 1744 | ;; (file-relative-name filename) | 1756 | ;; (file-relative-name bytecomp-filename) |
| 1745 | ;; (with-current-buffer input-buffer no-byte-compile)) | 1757 | ;; (with-current-buffer input-buffer no-byte-compile)) |
| 1746 | (when (file-exists-p target-file) | 1758 | (when (file-exists-p target-file) |
| 1747 | (message "%s deleted because of `no-byte-compile: %s'" | 1759 | (message "%s deleted because of `no-byte-compile: %s'" |
| @@ -1751,18 +1763,18 @@ The value is non-nil if there were no errors, nil if errors." | |||
| 1751 | ;; We successfully didn't compile this file. | 1763 | ;; We successfully didn't compile this file. |
| 1752 | 'no-byte-compile) | 1764 | 'no-byte-compile) |
| 1753 | (when byte-compile-verbose | 1765 | (when byte-compile-verbose |
| 1754 | (message "Compiling %s..." filename)) | 1766 | (message "Compiling %s..." bytecomp-filename)) |
| 1755 | (setq byte-compiler-error-flag nil) | 1767 | (setq byte-compiler-error-flag nil) |
| 1756 | ;; It is important that input-buffer not be current at this call, | 1768 | ;; It is important that input-buffer not be current at this call, |
| 1757 | ;; so that the value of point set in input-buffer | 1769 | ;; so that the value of point set in input-buffer |
| 1758 | ;; within byte-compile-from-buffer lingers in that buffer. | 1770 | ;; within byte-compile-from-buffer lingers in that buffer. |
| 1759 | (setq output-buffer | 1771 | (setq output-buffer |
| 1760 | (save-current-buffer | 1772 | (save-current-buffer |
| 1761 | (byte-compile-from-buffer input-buffer filename))) | 1773 | (byte-compile-from-buffer input-buffer bytecomp-filename))) |
| 1762 | (if byte-compiler-error-flag | 1774 | (if byte-compiler-error-flag |
| 1763 | nil | 1775 | nil |
| 1764 | (when byte-compile-verbose | 1776 | (when byte-compile-verbose |
| 1765 | (message "Compiling %s...done" filename)) | 1777 | (message "Compiling %s...done" bytecomp-filename)) |
| 1766 | (kill-buffer input-buffer) | 1778 | (kill-buffer input-buffer) |
| 1767 | (with-current-buffer output-buffer | 1779 | (with-current-buffer output-buffer |
| 1768 | (goto-char (point-max)) | 1780 | (goto-char (point-max)) |
| @@ -1791,9 +1803,10 @@ The value is non-nil if there were no errors, nil if errors." | |||
| 1791 | (kill-buffer (current-buffer))) | 1803 | (kill-buffer (current-buffer))) |
| 1792 | (if (and byte-compile-generate-call-tree | 1804 | (if (and byte-compile-generate-call-tree |
| 1793 | (or (eq t byte-compile-generate-call-tree) | 1805 | (or (eq t byte-compile-generate-call-tree) |
| 1794 | (y-or-n-p (format "Report call tree for %s? " filename)))) | 1806 | (y-or-n-p (format "Report call tree for %s? " |
| 1807 | bytecomp-filename)))) | ||
| 1795 | (save-excursion | 1808 | (save-excursion |
| 1796 | (display-call-tree filename))) | 1809 | (display-call-tree bytecomp-filename))) |
| 1797 | (if load | 1810 | (if load |
| 1798 | (load target-file)) | 1811 | (load target-file)) |
| 1799 | t)))) | 1812 | t)))) |
| @@ -4231,50 +4244,52 @@ already up-to-date." | |||
| 4231 | (while command-line-args-left | 4244 | (while command-line-args-left |
| 4232 | (if (file-directory-p (expand-file-name (car command-line-args-left))) | 4245 | (if (file-directory-p (expand-file-name (car command-line-args-left))) |
| 4233 | ;; Directory as argument. | 4246 | ;; Directory as argument. |
| 4234 | (let ((files (directory-files (car command-line-args-left))) | 4247 | (let ((bytecomp-files (directory-files (car command-line-args-left))) |
| 4235 | source dest) | 4248 | bytecomp-source bytecomp-dest) |
| 4236 | (dolist (file files) | 4249 | (dolist (bytecomp-file bytecomp-files) |
| 4237 | (if (and (string-match emacs-lisp-file-regexp file) | 4250 | (if (and (string-match emacs-lisp-file-regexp bytecomp-file) |
| 4238 | (not (auto-save-file-name-p file)) | 4251 | (not (auto-save-file-name-p bytecomp-file)) |
| 4239 | (setq source (expand-file-name file | 4252 | (setq bytecomp-source |
| 4240 | (car command-line-args-left))) | 4253 | (expand-file-name bytecomp-file |
| 4241 | (setq dest (byte-compile-dest-file source)) | 4254 | (car command-line-args-left))) |
| 4242 | (file-exists-p dest) | 4255 | (setq bytecomp-dest (byte-compile-dest-file |
| 4243 | (file-newer-than-file-p source dest)) | 4256 | bytecomp-source)) |
| 4244 | (if (null (batch-byte-compile-file source)) | 4257 | (file-exists-p bytecomp-dest) |
| 4258 | (file-newer-than-file-p bytecomp-source bytecomp-dest)) | ||
| 4259 | (if (null (batch-byte-compile-file bytecomp-source)) | ||
| 4245 | (setq error t))))) | 4260 | (setq error t))))) |
| 4246 | ;; Specific file argument | 4261 | ;; Specific file argument |
| 4247 | (if (or (not noforce) | 4262 | (if (or (not noforce) |
| 4248 | (let* ((source (car command-line-args-left)) | 4263 | (let* ((bytecomp-source (car command-line-args-left)) |
| 4249 | (dest (byte-compile-dest-file source))) | 4264 | (bytecomp-dest (byte-compile-dest-file bytecomp-source))) |
| 4250 | (or (not (file-exists-p dest)) | 4265 | (or (not (file-exists-p bytecomp-dest)) |
| 4251 | (file-newer-than-file-p source dest)))) | 4266 | (file-newer-than-file-p bytecomp-source bytecomp-dest)))) |
| 4252 | (if (null (batch-byte-compile-file (car command-line-args-left))) | 4267 | (if (null (batch-byte-compile-file (car command-line-args-left))) |
| 4253 | (setq error t)))) | 4268 | (setq error t)))) |
| 4254 | (setq command-line-args-left (cdr command-line-args-left))) | 4269 | (setq command-line-args-left (cdr command-line-args-left))) |
| 4255 | (kill-emacs (if error 1 0)))) | 4270 | (kill-emacs (if error 1 0)))) |
| 4256 | 4271 | ||
| 4257 | (defun batch-byte-compile-file (file) | 4272 | (defun batch-byte-compile-file (bytecomp-file) |
| 4258 | (if debug-on-error | 4273 | (if debug-on-error |
| 4259 | (byte-compile-file file) | 4274 | (byte-compile-file bytecomp-file) |
| 4260 | (condition-case err | 4275 | (condition-case err |
| 4261 | (byte-compile-file file) | 4276 | (byte-compile-file bytecomp-file) |
| 4262 | (file-error | 4277 | (file-error |
| 4263 | (message (if (cdr err) | 4278 | (message (if (cdr err) |
| 4264 | ">>Error occurred processing %s: %s (%s)" | 4279 | ">>Error occurred processing %s: %s (%s)" |
| 4265 | ">>Error occurred processing %s: %s") | 4280 | ">>Error occurred processing %s: %s") |
| 4266 | file | 4281 | bytecomp-file |
| 4267 | (get (car err) 'error-message) | 4282 | (get (car err) 'error-message) |
| 4268 | (prin1-to-string (cdr err))) | 4283 | (prin1-to-string (cdr err))) |
| 4269 | (let ((destfile (byte-compile-dest-file file))) | 4284 | (let ((bytecomp-destfile (byte-compile-dest-file bytecomp-file))) |
| 4270 | (if (file-exists-p destfile) | 4285 | (if (file-exists-p bytecomp-destfile) |
| 4271 | (delete-file destfile))) | 4286 | (delete-file bytecomp-destfile))) |
| 4272 | nil) | 4287 | nil) |
| 4273 | (error | 4288 | (error |
| 4274 | (message (if (cdr err) | 4289 | (message (if (cdr err) |
| 4275 | ">>Error occurred processing %s: %s (%s)" | 4290 | ">>Error occurred processing %s: %s (%s)" |
| 4276 | ">>Error occurred processing %s: %s") | 4291 | ">>Error occurred processing %s: %s") |
| 4277 | file | 4292 | bytecomp-file |
| 4278 | (get (car err) 'error-message) | 4293 | (get (car err) 'error-message) |
| 4279 | (prin1-to-string (cdr err))) | 4294 | (prin1-to-string (cdr err))) |
| 4280 | nil)))) | 4295 | nil)))) |