emacs-diffs
[Top][All Lists]
Advanced

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

master e4abb06e5bf: * lisp/subr.el (when-let): Reimplement so as to avoi


From: Sean Whitton
Subject: master e4abb06e5bf: * lisp/subr.el (when-let): Reimplement so as to avoid bug#74530.
Date: Tue, 26 Nov 2024 21:37:25 -0500 (EST)

branch: master
commit e4abb06e5bf982a4688de0638b1eeecf4ff38d95
Author: Sean Whitton <spwhitton@spwhitton.name>
Commit: Sean Whitton <spwhitton@spwhitton.name>

    * lisp/subr.el (when-let): Reimplement so as to avoid bug#74530.
---
 lisp/subr.el | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index a959c6a9810..02cc84c04b7 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2699,8 +2699,14 @@ If all are non-nil, return the value of the last form in 
BODY.
 The variable list SPEC is the same as in `if-let'."
   (declare (indent 1) (debug if-let)
            (obsolete "use `when-let*' or `and-let*' instead." "31.1"))
-  `(with-suppressed-warnings ((obsolete if-let))
-     (if-let ,spec ,(macroexp-progn body))))
+  ;; Previously we expanded to `if-let', and then required a
+  ;; `with-suppressed-warnings' to avoid doubling up the obsoletion
+  ;; warnings.  But that triggers a bytecompiler bug; see bug#74530.
+  ;; So for now we reimplement `if-let' here.
+  (when (and (<= (length spec) 2)
+             (not (listp (car spec))))
+    (setq spec (list spec)))
+  (list 'if-let* spec (macroexp-progn body)))
 
 (defmacro while-let (spec &rest body)
   "Bind variables according to SPEC and conditionally evaluate BODY.



reply via email to

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