emacs-diffs
[Top][All Lists]
Advanced

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

master 40b734c500 2/3: Don't prune *.eln files in parent of eln-load-pat


From: Stefan Kangas
Subject: master 40b734c500 2/3: Don't prune *.eln files in parent of eln-load-path
Date: Mon, 17 Oct 2022 09:49:26 -0400 (EDT)

branch: master
commit 40b734c5003c71dc533d588bb00ea51a983bd730
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    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.
---
 lisp/emacs-lisp/comp.el            |  4 +++-
 test/lisp/emacs-lisp/comp-tests.el | 11 +++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 686c7aeb3d..460d260192 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -4334,7 +4334,9 @@ of (commands) to run simultaneously."
     ;; `invocation-directory'.
     (setq dir (expand-file-name dir invocation-directory))
     (when (file-exists-p dir)
-      (dolist (subdir (directory-files dir t))
+      (dolist (subdir (seq-filter
+                       (lambda (f) (not (string-match (rx "/." (? ".") eos) 
f)))
+                       (directory-files dir t)))
         (when (and (file-directory-p subdir)
                    (file-writable-p subdir)
                    (not (equal (file-name-nondirectory
diff --git a/test/lisp/emacs-lisp/comp-tests.el 
b/test/lisp/emacs-lisp/comp-tests.el
index 97761cd728..31f32dad1f 100644
--- a/test/lisp/emacs-lisp/comp-tests.el
+++ b/test/lisp/emacs-lisp/comp-tests.el
@@ -59,4 +59,15 @@
    (should (file-regular-p (expand-file-name "keep1.txt" c1)))
    (should (file-regular-p (expand-file-name "keep2.txt" c2)))))
 
+(ert-deftest test-native-compile-prune-cache/dont-delete-in-parent-of-cache ()
+  (skip-unless (featurep 'native-compile))
+  (with-test-native-compile-prune-cache
+   (let ((f1 (expand-file-name "some.eln" (expand-file-name ".." testdir)))
+         (f2 (expand-file-name "some.eln" testdir)))
+     (with-temp-file f1 (insert "foo"))
+     (with-temp-file f2 (insert "foo"))
+     (native-compile-prune-cache)
+     (should (file-regular-p f1))
+     (should (file-regular-p f2)))))
+
 ;;; comp-tests.el ends here



reply via email to

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