emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 663fb3b: * Do not produce .elc temporary file when unnecessary (b


From: Andrea Corallo
Subject: master 663fb3b: * Do not produce .elc temporary file when unnecessary (bug#48978)
Date: Mon, 14 Jun 2021 09:02:35 -0400 (EDT)

branch: master
commit 663fb3b774887d3d15a6791c3f35af56daa3c676
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>

    * 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.
---
 lisp/emacs-lisp/bytecomp.el | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 909a1b4..5ed6bfe 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'."
          (insert "\n")                 ; aaah, unix.
          (cond
           ((null target-file) nil)     ;We only wanted the warnings!
-          ((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)))))
+          ((and (or (null byte-native-compiling)
+                     (and byte-native-compiling byte+native-compile))
+                 (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
@@ -2105,11 +2106,9 @@ See also `emacs-lisp-byte-compile-and-load'."
              ;; recompiled).  Previously this was accomplished by
              ;; deleting target-file before writing it.
              (if byte-native-compiling
-                  (if byte+native-compile
-                      ;; Defer elc final renaming.
-                      (setf byte-to-native-output-file
-                            (cons tempfile target-file))
-                    (delete-file tempfile))
+                  ;; Defer elc final renaming.
+                  (setf byte-to-native-output-file
+                        (cons tempfile target-file))
                 (rename-file tempfile target-file t)))
            (or noninteractive
                byte-native-compiling



reply via email to

[Prev in Thread] Current Thread [Next in Thread]