summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2020-12-26 20:16:26 +0100
committerAndrea Corallo <akrl@sdf.org>2020-12-26 20:38:36 +0100
commit271fb8a269aff924070b188f23355d0c368356dd (patch)
tree2a89a757c63d9df9ecfe786040e8fb66834fe440 /lisp/emacs-lisp
parentd8939520535224ccee663bba5b3da752f1648009 (diff)
downloademacs-271fb8a269aff924070b188f23355d0c368356dd.tar.gz
emacs-271fb8a269aff924070b188f23355d0c368356dd.tar.bz2
emacs-271fb8a269aff924070b188f23355d0c368356dd.zip
* Fix `byte-compile-file' for native compilation (bug#45442)
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Fix logic for native compilation.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/bytecomp.el23
1 files changed, 12 insertions, 11 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 620f15c619d..9f5d121024a 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -2020,16 +2020,16 @@ See also `emacs-lisp-byte-compile-and-load'."
(insert "\n") ; aaah, unix.
(cond
((null target-file) nil) ;We only wanted the warnings!
- ((and (or (file-writable-p target-file)
- byte-native-compiling)
- ;; We attempt to create a temporary file in the
- ;; target directory, so the target directory must be
- ;; writable.
- (file-writable-p
- (file-name-directory
- ;; Need to expand in case TARGET-FILE doesn't
- ;; include a directory (Bug#45287).
- (expand-file-name target-file))))
+ ((or byte-native-compiling
+ (and (file-writable-p target-file)
+ ;; We attempt to create a temporary file in the
+ ;; target directory, so the target directory must be
+ ;; writable.
+ (file-writable-p
+ (file-name-directory
+ ;; Need to expand in case TARGET-FILE doesn't
+ ;; include a directory (Bug#45287).
+ (expand-file-name target-file)))))
;; We must disable any code conversion here.
(let* ((coding-system-for-write 'no-conversion)
;; Write to a tempfile so that if another Emacs
@@ -2037,7 +2037,8 @@ See also `emacs-lisp-byte-compile-and-load'."
;; parallel bootstrap), it does not risk getting a
;; half-finished file. (Bug#4196)
(tempfile
- (make-temp-file (expand-file-name target-file)))
+ (make-temp-file (when (file-writable-p target-file)
+ (expand-file-name target-file))))
(default-modes (default-file-modes))
(temp-modes (logand default-modes #o600))
(desired-modes (logand default-modes #o666))