From: Michael Heerdegen <michael_heerdegen@web.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: johnw@gnu.org, emacs-devel@gnu.org
Subject: Re: Heads-up: Emacs 26.1 RC1
Date: Tue, 27 Mar 2018 02:01:43 +0200 [thread overview]
Message-ID: <87tvt2fkt4.fsf@web.de> (raw)
In-Reply-To: <87o9jaob5x.fsf@web.de> (Michael Heerdegen's message of "Mon, 26 Mar 2018 22:05:14 +0200")
[-- Attachment #1: Type: text/plain, Size: 192 bytes --]
Michael Heerdegen <michael_heerdegen@web.de> writes:
> I'll work on it in the next hours.
Sorry about the procrastination.
Here is the updated patch. Does it look ok?
Thanks,
Michael.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-De-obsolete-if-let-and-when-let.patch --]
[-- Type: text/x-diff, Size: 5032 bytes --]
From 441fe201ea129709ac9807b9b6b30caa45bbd293 Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen@web.de>
Date: Sat, 10 Mar 2018 16:39:41 +0100
Subject: [PATCH] De-obsolete `if-let' and `when-let'
For the following release it is planned to make `if-let*' and
`when-let*' aliases for `if-let' and `when-let'. For now we revert
declaring `if-let' and `when-let' obsolete and tweak the docstrings.
* lisp/emacs-lisp/subr-x.el (if-let*, when-let*): Make docstrings
refer to those of `if-let' and `when-let'.
(if-let, when-let): De-obsolete. Rewrite documentation.
---
etc/NEWS | 8 ++------
lisp/emacs-lisp/subr-x.el | 46 ++++++++++++++++++++++++++--------------------
2 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index f5da6870b7..4adedfce1a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1305,12 +1305,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
+SRFI-2 (Scheme Request for Implementation 2).
---
** '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..7fab9083e8 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -123,15 +123,8 @@ internal--build-bindings
(defmacro if-let* (varlist then &rest else)
"Bind variables according to VARLIST and eval THEN or ELSE.
-Each binding is evaluated in turn, and evaluation stops if a
-binding value is nil. If all are non-nil, the value of THEN is
-returned, or the last form in ELSE is returned.
-
-Each element of VARLIST is a list (SYMBOL VALUEFORM) which binds
-SYMBOL to the value of VALUEFORM. An element can additionally
-be of the form (VALUEFORM), which is evaluated and checked for
-nil; i.e. SYMBOL can be omitted if only the test result is of
-interest."
+This is like `if-let' but doesn't handle a VARLIST of the form
+\(SYMBOL SOMETHING) specially."
(declare (indent 2)
(debug ((&rest [&or symbolp (symbolp form) (form)])
form body)))
@@ -144,11 +137,8 @@ if-let*
(defmacro when-let* (varlist &rest body)
"Bind variables according to VARLIST and conditionally eval BODY.
-Each binding is evaluated in turn, and evaluation stops if a
-binding value is nil. If all are non-nil, the value of the last
-form in BODY is returned.
-
-VARLIST is the same as in `if-let*'."
+This is like `when-let' but doesn't handle a VARLIST of the form
+\(SYMBOL SOMETHING) specially."
(declare (indent 1) (debug if-let*))
(list 'if-let* varlist (macroexp-progn body)))
@@ -168,12 +158,25 @@ and-let*
(defmacro if-let (spec then &rest else)
"Bind variables according to SPEC and eval THEN or ELSE.
-Like `if-let*' except SPEC can have the form (SYMBOL VALUEFORM)."
+Each binding is evaluated in turn, and evaluation stops if a
+binding value is nil. If all are non-nil, the value of THEN is
+returned, or the last form in ELSE is returned.
+
+Each element of SPEC is a list (SYMBOL VALUEFORM) which binds
+SYMBOL to the value of VALUEFORM. An element can additionally be
+of the form (VALUEFORM), which is evaluated and checked for nil;
+i.e. SYMBOL can be omitted if only the test result is of
+interest. It can also be of the form SYMBOL, then the binding of
+SYMBOL is checked for nil.
+
+As a special case, a SPEC of the form \(SYMBOL SOMETHING) is
+interpreted like \((SYMBOL SOMETHING)). This exists for backward
+compatibility with the old syntax that accepted only one
+binding."
(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
@@ -182,9 +185,12 @@ 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"))
+Each binding is evaluated in turn, and evaluation stops if a
+binding value is nil. If all are non-nil, the value of the last
+form in BODY is returned.
+
+The variable list SPEC is the same as in `if-let'."
+ (declare (indent 1) (debug if-let))
(list 'if-let spec (macroexp-progn body)))
(defsubst hash-table-empty-p (hash-table)
--
2.16.2
next prev parent reply other threads:[~2018-03-27 0:01 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-19 15:59 Heads-up: Emacs 26.1 RC1 Eli Zaretskii
2018-03-19 18:46 ` Pierre Téchoueyres
2018-03-19 19:28 ` Eli Zaretskii
2018-03-19 19:59 ` Pierre Téchoueyres
2018-03-19 20:12 ` Eli Zaretskii
2018-03-20 6:10 ` Eric Abrahamsen
2018-03-20 7:16 ` Eli Zaretskii
2018-03-20 8:25 ` Eric Abrahamsen
2018-03-20 9:18 ` Eli Zaretskii
2018-03-20 23:22 ` Eric Abrahamsen
2018-03-20 23:33 ` Dmitry Gutov
2018-03-21 0:11 ` Eric Abrahamsen
2018-03-21 6:34 ` Eli Zaretskii
2018-03-21 9:48 ` Eric Abrahamsen
2018-03-21 9:57 ` Eric Abrahamsen
2018-03-21 12:54 ` Eli Zaretskii
2018-03-21 13:50 ` Eric Abrahamsen
2018-03-22 19:38 ` Pierre Téchoueyres
2018-03-19 21:00 ` Michael Heerdegen
2018-03-20 7:03 ` Eli Zaretskii
2018-03-26 18:53 ` Eli Zaretskii
2018-03-26 20:05 ` Michael Heerdegen
2018-03-27 0:01 ` Michael Heerdegen [this message]
2018-03-27 2:40 ` Eli Zaretskii
2018-03-27 2:58 ` Michael Heerdegen
2018-03-27 3:12 ` Eli Zaretskii
2018-03-19 21:04 ` Phillip Lord
2018-03-19 21:11 ` Noam Postavsky
2018-03-20 7:05 ` Eli Zaretskii
2018-03-20 10:31 ` Phillip Lord
2018-03-19 21:33 ` Richard Copley
2018-03-20 7:08 ` Eli Zaretskii
2018-03-20 9:52 ` Robert Pluim
2018-03-20 12:32 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tvt2fkt4.fsf@web.de \
--to=michael_heerdegen@web.de \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=johnw@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.