summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2020-10-02 14:42:43 +0200
committerAndrea Corallo <akrl@sdf.org>2020-10-02 14:48:48 +0200
commit36e0c3fb07db9805e97fbd2650aa28ac2c169dba (patch)
tree171b3b19406e6372de7b42ce3cca6d53cf6605e0 /lisp/emacs-lisp
parent8dacc9e8c52ce873f2b0a54e7ca67cffd2c7f4f7 (diff)
downloademacs-36e0c3fb07db9805e97fbd2650aa28ac2c169dba.tar.gz
emacs-36e0c3fb07db9805e97fbd2650aa28ac2c169dba.tar.bz2
emacs-36e0c3fb07db9805e97fbd2650aa28ac2c169dba.zip
* When advising search in `comp-eln-load-path' the first writable dir
* lisp/emacs-lisp/comp.el (comp-tampoline-compile): Do not crash if we can't write in the first entry in `comp-eln-load-path' but search for another one.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/comp.el30
1 files changed, 19 insertions, 11 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 02b08119f9c..ef13c0ce63e 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -2593,17 +2593,25 @@ Return the its filename if found or nil otherwise."
;; the primitive we are replacing in the function reloc table.
(defalias trampoline-sym
`(closure nil ,lambda-list
- (let ((f #',subr-name))
- (,(if (memq '&rest lambda-list) 'apply 'funcall)
- f
- ,@(cl-loop
- for arg in lambda-list
- unless (memq arg '(&optional &rest))
- collect arg)))))
- (native-compile trampoline-sym nil
- (expand-file-name (comp-trampoline-filename subr-name)
- (concat (car comp-eln-load-path)
- comp-native-version-dir)))))
+ (let ((f #',subr-name))
+ (,(if (memq '&rest lambda-list) 'apply 'funcall)
+ f
+ ,@(cl-loop
+ for arg in lambda-list
+ unless (memq arg '(&optional &rest))
+ collect arg)))))
+ (native-compile
+ trampoline-sym nil
+ (cl-loop
+ for dir in comp-eln-load-path
+ for f = (expand-file-name
+ (comp-trampoline-filename subr-name)
+ (concat dir
+ comp-native-version-dir))
+ when (file-writable-p f)
+ do (cl-return f)
+ finally (error "Can't find a writable directory in \
+`comp-eln-load-path'")))))
;;;###autoload
(defun comp-subr-safe-advice (subr-name)