[Top][All Lists]

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

Re: if-let/if-let*/and-let/..

From: Michael Heerdegen
Subject: Re: if-let/if-let*/and-let/..
Date: Sat, 10 Mar 2018 18:16:37 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.91 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

> If you really meant and-let*, then it's covered by the "foo-let*"
> catch-all, and I assumed it, too, won't be mentioned.

Yes, I meant that.

Then this is what I have so far:

>From 065374524104eaa471d199528cff180754975def Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <address@hidden>
Date: Sat, 10 Mar 2018 16:39:41 +0100
Subject: [PATCH] De-obsolete `if-let' and `when-let'

Revert declaring `if-let' and `when-let' obsolete....
 etc/NEWS                  | 8 ++------
 lisp/emacs-lisp/subr-x.el | 6 ++----
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index eded00e655..b87715ddbc 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1301,12 +1301,8 @@ current buffer or the self-insertion takes place within 
a comment.
 ** The alist 'ucs-names' is now a hash table.
-** 'if-let' and 'when-let' are subsumed by 'if-let*' and 'when-let*'.
-The incumbent 'if-let' and 'when-let' are now marked obsolete.
-'if-let*' and 'when-let*' do not accept the single tuple special case.
-New macro 'and-let*' is an implementation of the Scheme SRFI-2 syntax
-of the same name.  'if-let*' and 'when-let*' now accept the same
-binding syntax as 'and-let*'.
+** 'if-let' and 'when-let' now support binding lists as defined by the
 ** 'C-up', 'C-down', 'C-left' and 'C-right' are now defined in term
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 21dba377bf..e620e2062f 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -172,8 +172,7 @@ if-let
   (declare (indent 2)
            (debug ([&or (&rest [&or symbolp (symbolp form) (form)])
                         (symbolp form)]
-                   form body))
-           (obsolete "use `if-let*' instead." "26.1"))
+                   form body)))
   (when (and (<= (length spec) 2)
              (not (listp (car spec))))
     ;; Adjust the single binding case
@@ -183,8 +182,7 @@ if-let
 (defmacro when-let (spec &rest body)
   "Bind variables according to SPEC and conditionally eval BODY.
 Like `when-let*' except SPEC can have the form (SYMBOL VALUEFORM)."
-  (declare (indent 1) (debug if-let)
-           (obsolete "use `when-let*' instead." "26.1"))
+  (declare (indent 1) (debug if-let))
   (list 'if-let spec (macroexp-progn body)))
 (defsubst hash-table-empty-p (hash-table)

But we still can't use this, because the documentation of if-let and
when-let in emacs-26 refers to the documentation of if-let* and
when-let*.  I would at least also have to rewrite the docstrings of
if-let and when-let.  I'm beginning to wonder if what we are
constructing here is really simpler than my initial approach.

BTW, the srfi-2 allows a SYMBOL as element of the binding spec.  AFAIK
all of the macros (foo-let and foo-let*) support that case, but it's not
documented.  I dunno why, the original author, Mark Oteiza
<address@hidden>, didn't respond to my questions in emacs-dev.  My
guess is that it hasn't been documented because the foo-let
single-binding case intersects with this syntax.


reply via email to

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