aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2025-06-12 00:41:26 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2025-06-12 00:41:26 +0200
commit0c9c9d2b1a2041c67d83b55536bb2e49bd50753f (patch)
tree46e3e51d584d0bcd1a300808a35940b16f5c9f6d
parent2b5cdd30e9fb5cfd15f33643aba20efdab8dab44 (diff)
parenta9efb4a6c98da984a93df4a5d41d8d3e73459178 (diff)
Merge branch 'main' into emacs-31
-rw-r--r--compat-28.el8
-rw-r--r--compat-tests.el6
2 files changed, 12 insertions, 2 deletions
diff --git a/compat-28.el b/compat-28.el
index ae4978d..05217ea 100644
--- a/compat-28.el
+++ b/compat-28.el
@@ -518,8 +518,12 @@ as the new values of the bound variables in the recursive invocation."
(cons (car handler)
(funcall tco-progn (cdr handler))))
(nthcdr 3 expr))))
- ((memq (car-safe expr) '(and progn))
- (cons (car expr) (funcall tco-progn (cdr expr))))
+ ((eq (car-safe expr) 'and)
+ (if (cddr expr)
+ (funcall tco `(if ,(cadr expr) ,(cons 'and (cddr expr))))
+ (funcall tco (cadr expr))))
+ ((eq (car-safe expr) 'progn)
+ (cons (car expr) (funcall tco-progn (cdr expr))))
((memq (car-safe expr) '(let let*))
(append (list (car expr) (cadr expr))
(funcall tco-progn (cddr expr))))
diff --git a/compat-tests.el b/compat-tests.el
index 79d7e4c..d9de74a 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -2326,6 +2326,12 @@
(cond ((= x 0) 'ok)
((and t (lop (1- x))))))
'ok)
+ (should-equal (let ((n 0))
+ (named-let lop ((l '(1 2 3)))
+ (setq n (1+ n))
+ (and l (lop (cdr l))))
+ n)
+ 4)
(should-equal (let ((b t))
(named-let lop ((i 0))
(cond ((null i) nil) ((= i 10000) 'ok)