aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2022-10-17 15:26:21 +0200
committerStefan Kangas2022-10-17 15:26:34 +0200
commit40b734c5003c71dc533d588bb00ea51a983bd730 (patch)
tree05eb67127c447fab4383c98a80a6fec9b400c650
parent24b85b10e388303c9c871a65ccf5deeed19b04f8 (diff)
downloademacs-40b734c5003c71dc533d588bb00ea51a983bd730.tar.gz
emacs-40b734c5003c71dc533d588bb00ea51a983bd730.zip
Don't prune *.eln files in parent of eln-load-path
* lisp/emacs-lisp/comp.el (native-compile-prune-cache): Don't prune *.eln files in parent directory of `native-comp-eln-load-path'. * test/lisp/emacs-lisp/comp-tests.el (test-native-compile-prune-cache/dont-delete-in-parent-of-cache): New test.
-rw-r--r--lisp/emacs-lisp/comp.el4
-rw-r--r--test/lisp/emacs-lisp/comp-tests.el11
2 files changed, 14 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 686c7aeb3db..460d260192d 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -4334,7 +4334,9 @@ of (commands) to run simultaneously."
4334 ;; `invocation-directory'. 4334 ;; `invocation-directory'.
4335 (setq dir (expand-file-name dir invocation-directory)) 4335 (setq dir (expand-file-name dir invocation-directory))
4336 (when (file-exists-p dir) 4336 (when (file-exists-p dir)
4337 (dolist (subdir (directory-files dir t)) 4337 (dolist (subdir (seq-filter
4338 (lambda (f) (not (string-match (rx "/." (? ".") eos) f)))
4339 (directory-files dir t)))
4338 (when (and (file-directory-p subdir) 4340 (when (and (file-directory-p subdir)
4339 (file-writable-p subdir) 4341 (file-writable-p subdir)
4340 (not (equal (file-name-nondirectory 4342 (not (equal (file-name-nondirectory
diff --git a/test/lisp/emacs-lisp/comp-tests.el b/test/lisp/emacs-lisp/comp-tests.el
index 97761cd728e..31f32dad1f5 100644
--- a/test/lisp/emacs-lisp/comp-tests.el
+++ b/test/lisp/emacs-lisp/comp-tests.el
@@ -59,4 +59,15 @@
59 (should (file-regular-p (expand-file-name "keep1.txt" c1))) 59 (should (file-regular-p (expand-file-name "keep1.txt" c1)))
60 (should (file-regular-p (expand-file-name "keep2.txt" c2))))) 60 (should (file-regular-p (expand-file-name "keep2.txt" c2)))))
61 61
62(ert-deftest test-native-compile-prune-cache/dont-delete-in-parent-of-cache ()
63 (skip-unless (featurep 'native-compile))
64 (with-test-native-compile-prune-cache
65 (let ((f1 (expand-file-name "some.eln" (expand-file-name ".." testdir)))
66 (f2 (expand-file-name "some.eln" testdir)))
67 (with-temp-file f1 (insert "foo"))
68 (with-temp-file f2 (insert "foo"))
69 (native-compile-prune-cache)
70 (should (file-regular-p f1))
71 (should (file-regular-p f2)))))
72
62;;; comp-tests.el ends here 73;;; comp-tests.el ends here