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

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

[elpa] externals/compat 50767a8 90/99: Load deferred code even if file d


From: ELPA Syncer
Subject: [elpa] externals/compat 50767a8 90/99: Load deferred code even if file doesn't exist
Date: Sun, 17 Oct 2021 05:58:03 -0400 (EDT)

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

    Load deferred code even if file doesn't exist
---
 compat-macs.el | 10 ++++++----
 compat.el      | 18 +++++++++++++-----
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/compat-macs.el b/compat-macs.el
index 46ea7aa..3f710d2 100644
--- a/compat-macs.el
+++ b/compat-macs.el
@@ -102,10 +102,12 @@ TYPE is used to set the symbol property `compat-type' for 
NAME."
        (put ',realname 'compat-version ,version)
        ,(funcall def-fn realname version)
        ,(if feature
-            ;; Warning: This might be able throw an error if the code
-            ;; is not byte compiled, as explained in:
-            ;; https://nullprogram.com/blog/2018/02/22/.
-            `(eval-after-load ',feature (lambda () ,body))
+            `(progn
+               (put ',feature 'setup-deferred-p t)
+               ;; Warning: This might be able throw an error if the code
+               ;; is not byte compiled, as explained in:
+               ;; https://nullprogram.com/blog/2018/02/22/.
+               (eval-after-load ',feature (lambda () ,body)))
           body))))
 
 (defun compat-common-fdefine (type name arglist docstring rest)
diff --git a/compat.el b/compat.el
index 2ec5aaa..515e34f 100644
--- a/compat.el
+++ b/compat.el
@@ -145,14 +145,22 @@ advice."
 (compat-advise require (feature &optional filename noerror)
   "Avoid throwing an error if library has compatibility code."
   ;; As the compatibility advise around `require` is more a hack than
-  ;; of of actual value, the highlighting is supressed.
+  ;; of of actual value, the highlighting is suppressed.
   :no-highlight t
   (condition-case err
-      (funcall oldfun feature filename noerror)
+      (funcall oldfun feature filename)
     (file-missing
-     ;; FIXME: avoid false negatives, check if compat defined a
-     ;;        feature.
-     (unless (assq feature after-load-alist)
+     (let ((entry (assq feature after-load-alist)))
+       (unless (and entry
+                    (get feature 'setup-deferred-p)
+                    (null noerror))
+         (signal (car err) (cdr err)))
+       (let ((load-file-name nil))
+         (dolist (form (cdr entry))
+           (funcall (eval form t))))
+       feature))
+    (error
+     (unless noerror
        (signal (car err) (cdr err))))))
 
 ;; Load the actual compatibility definitions:



reply via email to

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