diff options
| author | Philip Kaludercic | 2022-08-11 11:26:45 +0200 |
|---|---|---|
| committer | Philip Kaludercic | 2022-08-11 12:18:59 +0200 |
| commit | 8638aace3fbe01529f33870f469fa60bf5e43ee7 (patch) | |
| tree | ca340fa13fd94c44006268c1f34531958f74254c | |
| parent | 5fe97dd9dd8b0312541d8583b8cb3e36087beae5 (diff) | |
| download | emacs-8638aace3fbe01529f33870f469fa60bf5e43ee7.tar.gz emacs-8638aace3fbe01529f33870f469fa60bf5e43ee7.zip | |
Allow ignoring files during byte compilation
* bytecomp.el (byte-compile-ignore-files): Add new variable.
(byte-recompile-directory): Respect 'byte-compile-ignore-files'.
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 1ecd77f7517..b0ace9dae6a 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -1876,6 +1876,9 @@ Files in subdirectories of DIRECTORY are processed also." | |||
| 1876 | (interactive "DByte force recompile (directory): ") | 1876 | (interactive "DByte force recompile (directory): ") |
| 1877 | (byte-recompile-directory directory nil t)) | 1877 | (byte-recompile-directory directory nil t)) |
| 1878 | 1878 | ||
| 1879 | (defvar byte-compile-ignore-files nil | ||
| 1880 | "List of regexps for files to ignore during byte compilation.") | ||
| 1881 | |||
| 1879 | ;;;###autoload | 1882 | ;;;###autoload |
| 1880 | (defun byte-recompile-directory (directory &optional arg force follow-symlinks) | 1883 | (defun byte-recompile-directory (directory &optional arg force follow-symlinks) |
| 1881 | "Recompile every `.el' file in DIRECTORY that needs recompilation. | 1884 | "Recompile every `.el' file in DIRECTORY that needs recompilation. |
| @@ -1932,14 +1935,23 @@ also be compiled." | |||
| 1932 | ;; This file is a subdirectory. Handle them differently. | 1935 | ;; This file is a subdirectory. Handle them differently. |
| 1933 | (or (null arg) (eq 0 arg) | 1936 | (or (null arg) (eq 0 arg) |
| 1934 | (y-or-n-p (concat "Check " source "? "))) | 1937 | (y-or-n-p (concat "Check " source "? "))) |
| 1935 | (setq directories (nconc directories (list source)))) | 1938 | (setq directories (nconc directories (list source))) |
| 1939 | ;; Directory is requested to be ignored | ||
| 1940 | (string-match-p | ||
| 1941 | (regexp-opt byte-compile-ignore-files) | ||
| 1942 | source) | ||
| 1943 | (setq directories (nconc directories (list source)))) | ||
| 1936 | ;; It is an ordinary file. Decide whether to compile it. | 1944 | ;; It is an ordinary file. Decide whether to compile it. |
| 1937 | (if (and (string-match emacs-lisp-file-regexp source) | 1945 | (if (and (string-match emacs-lisp-file-regexp source) |
| 1938 | ;; The next 2 tests avoid compiling lock files | 1946 | ;; The next 2 tests avoid compiling lock files |
| 1939 | (file-readable-p source) | 1947 | (file-readable-p source) |
| 1940 | (not (string-match "\\`\\.#" file)) | 1948 | (not (string-match "\\`\\.#" file)) |
| 1941 | (not (auto-save-file-name-p source)) | 1949 | (not (auto-save-file-name-p source)) |
| 1942 | (not (member source (dir-locals--all-files directory)))) | 1950 | (not (member source (dir-locals--all-files directory))) |
| 1951 | ;; File is requested to be ignored | ||
| 1952 | (string-match-p | ||
| 1953 | (regexp-opt byte-compile-ignore-files) | ||
| 1954 | source)) | ||
| 1943 | (progn (cl-incf | 1955 | (progn (cl-incf |
| 1944 | (pcase (byte-recompile-file source force arg) | 1956 | (pcase (byte-recompile-file source force arg) |
| 1945 | ('no-byte-compile skip-count) | 1957 | ('no-byte-compile skip-count) |