summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorPhilip Kaludercic <philipk@posteo.net>2022-08-11 11:26:45 +0200
committerPhilip Kaludercic <philipk@posteo.net>2022-08-11 12:18:59 +0200
commit8638aace3fbe01529f33870f469fa60bf5e43ee7 (patch)
treeca340fa13fd94c44006268c1f34531958f74254c /lisp/emacs-lisp
parent5fe97dd9dd8b0312541d8583b8cb3e36087beae5 (diff)
downloademacs-8638aace3fbe01529f33870f469fa60bf5e43ee7.tar.gz
emacs-8638aace3fbe01529f33870f469fa60bf5e43ee7.tar.bz2
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'.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/bytecomp.el16
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."
(interactive "DByte force recompile (directory): ")
(byte-recompile-directory directory nil t))
+(defvar byte-compile-ignore-files nil
+ "List of regexps for files to ignore during byte compilation.")
+
;;;###autoload
(defun byte-recompile-directory (directory &optional arg force follow-symlinks)
"Recompile every `.el' file in DIRECTORY that needs recompilation.
@@ -1932,14 +1935,23 @@ also be compiled."
;; This file is a subdirectory. Handle them differently.
(or (null arg) (eq 0 arg)
(y-or-n-p (concat "Check " source "? ")))
- (setq directories (nconc directories (list source))))
+ (setq directories (nconc directories (list source)))
+ ;; Directory is requested to be ignored
+ (string-match-p
+ (regexp-opt byte-compile-ignore-files)
+ source)
+ (setq directories (nconc directories (list source))))
;; It is an ordinary file. Decide whether to compile it.
(if (and (string-match emacs-lisp-file-regexp source)
;; The next 2 tests avoid compiling lock files
(file-readable-p source)
(not (string-match "\\`\\.#" file))
(not (auto-save-file-name-p source))
- (not (member source (dir-locals--all-files directory))))
+ (not (member source (dir-locals--all-files directory)))
+ ;; File is requested to be ignored
+ (string-match-p
+ (regexp-opt byte-compile-ignore-files)
+ source))
(progn (cl-incf
(pcase (byte-recompile-file source force arg)
('no-byte-compile skip-count)