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

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

[nongnu] elpa/buttercup c0e4d17c90 3/4: Define buttercup--thunk-p withou


From: ELPA Syncer
Subject: [nongnu] elpa/buttercup c0e4d17c90 3/4: Define buttercup--thunk-p without Oclosures
Date: Wed, 17 Jul 2024 22:00:22 -0400 (EDT)

branch: elpa/buttercup
commit c0e4d17c908b59ef645d3c39d52c372a58d5fbf0
Author: Ola Nilsson <ola.nilsson@gmail.com>
Commit: Ola Nilsson <ola.nilsson@gmail.com>

    Define buttercup--thunk-p without Oclosures
    
    Define a buttercup--thunk-p alias that always return false when
    Oclosures are not available.  That way we wont have to test for both
    Oclosure avaliabllity and whether an object is a buttercup-thunk.
---
 buttercup.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/buttercup.el b/buttercup.el
index ca1f93451f..5f0086b90e 100644
--- a/buttercup.el
+++ b/buttercup.el
@@ -69,10 +69,12 @@
               'buttercup-internals-error)
 
 (eval-and-compile
-  (when (fboundp 'oclosure-define)      ;Emacs≥29
+  (if (fboundp 'oclosure-define)      ;Emacs≥29
     (oclosure-define (buttercup--thunk (:predicate buttercup--thunk-p))
       "An elisp expression as a function and original code."
-      expr)))
+      expr)
+    (defalias 'buttercup--thunk-p #'ignore
+      "Always return nil when Oclosures are not available.")))
 
 (defun buttercup--enclosed-expr (fun)
   "Given a FUN `buttercup-thunk', return its unevaluated expression.
@@ -88,8 +90,7 @@ and the return value will be EXPR, unevaluated. The quoted 
EXPR
 is useful if EXPR is a macro call, in which case the `quote'
 ensures access to the un-expanded form."
   (cl-assert (functionp fun) t "Expected FUN to be a function")
-  (if (and (fboundp 'buttercup--thunk-p)      ;Emacs≥29
-           (buttercup--thunk-p fun))
+  (if (buttercup--thunk-p fun)
       (buttercup--thunk--expr fun)
   (pcase fun
     ;; This should be the normal case, a closure with unknown enclosed



reply via email to

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