emacs-diffs
[Top][All Lists]
Advanced

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

feature/inhibit-native-comp-cleanup ce4a066ed1: * Generate trampolines i


From: Andrea Corallo
Subject: feature/inhibit-native-comp-cleanup ce4a066ed1: * Generate trampolines in a temporary directory if no other option is viable
Date: Tue, 14 Feb 2023 06:28:32 -0500 (EST)

branch: feature/inhibit-native-comp-cleanup
commit ce4a066ed1ea07f651f439132017db8ceb32779c
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>

    * Generate trampolines in a temporary directory if no other option is viable
    
    * lisp/emacs-lisp/comp.el (comp--trampoline-abs-filename): Use
    temporary file if no other option is viable.
---
 lisp/emacs-lisp/comp.el | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index ed706feb92..a6b9b3f57e 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -3800,18 +3800,22 @@ Return the trampoline if found or nil otherwise."
                      (list (expand-file-name comp-native-version-dir
                                              native-compile-target-directory))
                    (comp-eln-load-path-eff)))
+   with rel-filename = (comp-trampoline-filename subr-name)
    for dir in dirs
-   for f = (expand-file-name
-            (comp-trampoline-filename subr-name)
-            dir)
+   for abs-filename = (expand-file-name rel-filename dir)
    unless (file-exists-p dir)
      do (ignore-errors
           (make-directory dir t)
-          (cl-return f))
-   when (file-writable-p f)
-     do (cl-return f)
-   finally (error "Cannot find suitable directory for output in \
-`native-comp-eln-load-path'")))
+          (cl-return abs-filename))
+   when (file-writable-p abs-filename)
+     do (cl-return abs-filename)
+   ;; Default to some temporary directory if no better option was
+   ;; found.
+   finally (cl-return
+            (expand-file-name
+             (make-temp-file-internal (file-name-sans-extension rel-filename)
+                                      0 ".eln" nil)
+             temporary-file-directory))))
 
 (defun comp-trampoline-compile (subr-name)
   "Synthesize compile and return a trampoline for SUBR-NAME."



reply via email to

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