emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/compat c50b6e0b9a 06/10: Wrap provide calls in `compat-


From: ELPA Syncer
Subject: [elpa] externals/compat c50b6e0b9a 06/10: Wrap provide calls in `compat--inhibit-prefixed'
Date: Sun, 17 Jul 2022 17:57:25 -0400 (EDT)

branch: externals/compat
commit c50b6e0b9a76d24d1aa9326c9929c148201e3a9d
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    Wrap provide calls in `compat--inhibit-prefixed'
    
    This is even simpler and less risky than copying `features' as it
    alleviates the risk of confusing the loading procedure.
---
 compat-24.el |  2 +-
 compat-25.el |  2 +-
 compat-26.el |  2 +-
 compat-27.el |  2 +-
 compat-28.el |  2 +-
 compat.el    | 27 +++++++++++++++------------
 6 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/compat-24.el b/compat-24.el
index 1d3c18d167..f208ae7bd8 100644
--- a/compat-24.el
+++ b/compat-24.el
@@ -520,5 +520,5 @@ function for defining FACE and recalculating its 
attributes."
   (dolist (frame (frame-list))
     (face-spec-recalc face frame)))
 
-(provide 'compat-24)
+(compat--inhibit-prefixed (provide 'compat-24))
 ;;; compat-24.el ends here
diff --git a/compat-25.el b/compat-25.el
index 4f35b9109e..eb9d0a8b8f 100644
--- a/compat-25.el
+++ b/compat-25.el
@@ -316,5 +316,5 @@ recursion."
             (push (concat dir "/" file) files)))))
     (nconc result (nreverse files))))
 
-(provide 'compat-25)
+(compat--inhibit-prefixed (provide 'compat-25))
 ;;; compat-25.el ends here
diff --git a/compat-26.el b/compat-26.el
index 0764f1e9ec..83b89c56c1 100644
--- a/compat-26.el
+++ b/compat-26.el
@@ -627,5 +627,5 @@ If VALUE is nil, PROPERTY is removed from IMAGE."
                     (cdr ,image*)
                     ,property* ,value*)))))))
 
-(provide 'compat-26)
+(compat--inhibit-prefixed (provide 'compat-26))
 ;;; compat-26.el ends here
diff --git a/compat-27.el b/compat-27.el
index f4eb621b6e..de9e1748ca 100644
--- a/compat-27.el
+++ b/compat-27.el
@@ -694,5 +694,5 @@ The return value is a string (or nil in case we can’t find 
it)."
         31
       30)))
 
-(provide 'compat-27)
+(compat--inhibit-prefixed (provide 'compat-27))
 ;;; compat-27.el ends here
diff --git a/compat-28.el b/compat-28.el
index 89c24c2f52..b530306fcb 100644
--- a/compat-28.el
+++ b/compat-28.el
@@ -871,5 +871,5 @@ are 30 days long."
      (* (or (nth 4 time) 0) 60 60 24 30)
      (* (or (nth 5 time) 0) 60 60 24 365)))
 
-(provide 'compat-28)
+(compat--inhibit-prefixed (provide 'compat-28))
 ;;; compat-28.el ends here
diff --git a/compat.el b/compat.el
index c588766d1f..b0996f272e 100644
--- a/compat.el
+++ b/compat.el
@@ -48,18 +48,21 @@
 ;; and do nothing when loading each sub-feature manually.
 
 (defvar compat--inhibit-prefixed)
-(let* ((compat--inhibit-prefixed (not (bound-and-true-p compat-testing)))
-       (load-suffixes
-        (if (bound-and-true-p compat-testing)
-            (cons ".el" (remove ".el" load-suffixes))
-          load-suffixes))
-       (features (copy-sequence features)))
-  (ignore features)                     ;for the byte compiler
-  (require 'compat-24)
-  (require 'compat-25)
-  (require 'compat-26)
-  (require 'compat-27)
-  (require 'compat-28))
+(let ((compat--inhibit-prefixed (not (bound-and-true-p compat-testing)))
+      (load-suffixes
+       (if (bound-and-true-p compat-testing)
+           (cons ".el" (remove ".el" load-suffixes))
+         load-suffixes)))
+  ;; Instead of using `require', we manually check `features' and call
+  ;; `load' to avoid the issue of not using `provide' at the end of
+  ;; the file (which is disabled by `compat--inhibit-prefixed', so
+  ;; that the file can be loaded again at some later point when the
+  ;; prefixed definitions are needed).
+  (unless (memq 'compat-24 features) (load "compat-24"))
+  (unless (memq 'compat-25 features) (load "compat-25"))
+  (unless (memq 'compat-26 features) (load "compat-26"))
+  (unless (memq 'compat-27 features) (load "compat-27"))
+  (unless (memq 'compat-28 features) (load "compat-28")))
 
 (provide 'compat)
 ;;; compat.el ends here



reply via email to

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