diff options
| -rw-r--r-- | lisp/subr.el | 10 |
1 files 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. | |||
| 2699 | The variable list SPEC is the same as in `if-let'." | 2699 | The variable list SPEC is the same as in `if-let'." |
| 2700 | (declare (indent 1) (debug if-let) | 2700 | (declare (indent 1) (debug if-let) |
| 2701 | (obsolete "use `when-let*' or `and-let*' instead." "31.1")) | 2701 | (obsolete "use `when-let*' or `and-let*' instead." "31.1")) |
| 2702 | `(with-suppressed-warnings ((obsolete if-let)) | 2702 | ;; Previously we expanded to `if-let', and then required a |
| 2703 | (if-let ,spec ,(macroexp-progn body)))) | 2703 | ;; `with-suppressed-warnings' to avoid doubling up the obsoletion |
| 2704 | ;; warnings. But that triggers a bytecompiler bug; see bug#74530. | ||
| 2705 | ;; So for now we reimplement `if-let' here. | ||
| 2706 | (when (and (<= (length spec) 2) | ||
| 2707 | (not (listp (car spec)))) | ||
| 2708 | (setq spec (list spec))) | ||
| 2709 | (list 'if-let* spec (macroexp-progn body))) | ||
| 2704 | 2710 | ||
| 2705 | (defmacro while-let (spec &rest body) | 2711 | (defmacro while-let (spec &rest body) |
| 2706 | "Bind variables according to SPEC and conditionally evaluate BODY. | 2712 | "Bind variables according to SPEC and conditionally evaluate BODY. |