aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Corallo2021-06-14 14:37:14 +0200
committerAndrea Corallo2021-06-14 15:02:17 +0200
commit663fb3b774887d3d15a6791c3f35af56daa3c676 (patch)
treea2d98b3e9f68b3d5ff1b912dfb708c91ff61cd15
parent8f2f91f7acf5792f0dc38f8045dc0d3ffe2e4593 (diff)
downloademacs-663fb3b774887d3d15a6791c3f35af56daa3c676.tar.gz
emacs-663fb3b774887d3d15a6791c3f35af56daa3c676.zip
* Do not produce .elc temporary file when unnecessary (bug#48978)
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Produce .elc temporary files only when non native compiling or when native compiling but `byte+native-compile' is non nil.
-rw-r--r--lisp/emacs-lisp/bytecomp.el29
1 files changed, 14 insertions, 15 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 909a1b4412a..5ed6bfeddcc 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -2067,16 +2067,17 @@ See also `emacs-lisp-byte-compile-and-load'."
2067 (insert "\n") ; aaah, unix. 2067 (insert "\n") ; aaah, unix.
2068 (cond 2068 (cond
2069 ((null target-file) nil) ;We only wanted the warnings! 2069 ((null target-file) nil) ;We only wanted the warnings!
2070 ((or byte-native-compiling 2070 ((and (or (null byte-native-compiling)
2071 (and (file-writable-p target-file) 2071 (and byte-native-compiling byte+native-compile))
2072 ;; We attempt to create a temporary file in the 2072 (file-writable-p target-file)
2073 ;; target directory, so the target directory must be 2073 ;; We attempt to create a temporary file in the
2074 ;; writable. 2074 ;; target directory, so the target directory must be
2075 (file-writable-p 2075 ;; writable.
2076 (file-name-directory 2076 (file-writable-p
2077 ;; Need to expand in case TARGET-FILE doesn't 2077 (file-name-directory
2078 ;; include a directory (Bug#45287). 2078 ;; Need to expand in case TARGET-FILE doesn't
2079 (expand-file-name target-file))))) 2079 ;; include a directory (Bug#45287).
2080 (expand-file-name target-file))))
2080 ;; We must disable any code conversion here. 2081 ;; We must disable any code conversion here.
2081 (let* ((coding-system-for-write 'no-conversion) 2082 (let* ((coding-system-for-write 'no-conversion)
2082 ;; Write to a tempfile so that if another Emacs 2083 ;; Write to a tempfile so that if another Emacs
@@ -2105,11 +2106,9 @@ See also `emacs-lisp-byte-compile-and-load'."
2105 ;; recompiled). Previously this was accomplished by 2106 ;; recompiled). Previously this was accomplished by
2106 ;; deleting target-file before writing it. 2107 ;; deleting target-file before writing it.
2107 (if byte-native-compiling 2108 (if byte-native-compiling
2108 (if byte+native-compile 2109 ;; Defer elc final renaming.
2109 ;; Defer elc final renaming. 2110 (setf byte-to-native-output-file
2110 (setf byte-to-native-output-file 2111 (cons tempfile target-file))
2111 (cons tempfile target-file))
2112 (delete-file tempfile))
2113 (rename-file tempfile target-file t))) 2112 (rename-file tempfile target-file t)))
2114 (or noninteractive 2113 (or noninteractive
2115 byte-native-compiling 2114 byte-native-compiling