From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Mark Oteiza Newsgroups: gmane.emacs.bugs Subject: bug#28254: 26.0.50; SRFI-2 and-let* Date: Wed, 13 Sep 2017 07:48:46 -0400 Message-ID: <20170913114846.GA25686@holos.localdomain> References: <20170902133604.GA27251@holos.localdomain> <20170904011356.GA21128@holos.localdomain> <20170905035548.GB11331@holos.localdomain> <20170909003355.GA3363@holos.localdomain> <87efrcccps.fsf@drachen> <20170912130947.GA23119@holos.localdomain> <87k213oiys.fsf@drachen> <20170912202134.GA14004@holos.localdomain> <8760cm299r.fsf@drachen> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1505303356 6737 195.159.176.226 (13 Sep 2017 11:49:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 13 Sep 2017 11:49:16 +0000 (UTC) User-Agent: Mutt/1.9.0 (2017-09-02) Cc: 28254@debbugs.gnu.org, Noam Postavsky To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 13 13:49:12 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ds6AI-0001c8-Vz for geb-bug-gnu-emacs@m.gmane.org; Wed, 13 Sep 2017 13:49:11 +0200 Original-Received: from localhost ([::1]:41761 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ds6AQ-0008Ax-9W for geb-bug-gnu-emacs@m.gmane.org; Wed, 13 Sep 2017 07:49:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ds6AF-00088f-Pj for bug-gnu-emacs@gnu.org; Wed, 13 Sep 2017 07:49:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ds6AA-00043d-T1 for bug-gnu-emacs@gnu.org; Wed, 13 Sep 2017 07:49:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:56804) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ds6AA-00043F-NS for bug-gnu-emacs@gnu.org; Wed, 13 Sep 2017 07:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ds6AA-0002o8-FY for bug-gnu-emacs@gnu.org; Wed, 13 Sep 2017 07:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mark Oteiza Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Sep 2017 11:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28254 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 28254-submit@debbugs.gnu.org id=B28254.150530333810783 (code B ref 28254); Wed, 13 Sep 2017 11:49:02 +0000 Original-Received: (at 28254) by debbugs.gnu.org; 13 Sep 2017 11:48:58 +0000 Original-Received: from localhost ([127.0.0.1]:37252 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ds6A6-0002nr-Hu for submit@debbugs.gnu.org; Wed, 13 Sep 2017 07:48:58 -0400 Original-Received: from mail-qk0-f178.google.com ([209.85.220.178]:35563) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ds6A4-0002na-LH for 28254@debbugs.gnu.org; Wed, 13 Sep 2017 07:48:57 -0400 Original-Received: by mail-qk0-f178.google.com with SMTP id r141so30978852qke.2 for <28254@debbugs.gnu.org>; Wed, 13 Sep 2017 04:48:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=udel-edu.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=FXp0CQ+b2TtSFNcY/yD2N/g52UgAL7WSfdu+oV2o+d8=; b=KZKs2yO2bTS67atHI3YXz1xGJZDdD/E+fjB1wdWEuU5kDSDjDff4zKGF+E6g9+5ed1 ttSQeEK+A0FGjFzAylx+LX/QqvzdeNg2MlQFedOmnMUH9I1eeeOdF+Fo6CgWq7u2VBw7 v81wNclg8HI5Fs62Vh5LcOYLaSRn6KsKoPuQJubIbFuK5futk+2Mxghc2XFnp8lUph8B QZqbSMwS8NXUcOND4VGaY0EU03ejTIiBP0hdXcwtIUrrfsvEdMjji0GAdFwPavY5AEnu a5aAFtnAmN3UFDYJy++aovI7K6pAH8MfWUQStYEZufvmb5HxdLtWQJ+HXBcORt2D3fUL N1pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=FXp0CQ+b2TtSFNcY/yD2N/g52UgAL7WSfdu+oV2o+d8=; b=rheBoZYTOeGqBL4bi4qUCpfC4UNZwiy5o8DUYlVm3MN39tdQPvEZwUdb6jI7v4pRVP uhZYk40GoWRo7cEx5kkAv+4WGrHEAzvyOJ3RfR2CRUTKtS2y0rJ+3kiYZumRNIhgizsI HU4ptlbj6tNTDMvBmhC0KActW+nzzDU4YxT/gZctLtXH5xHfBfgdG/Muyrv7pkbbCS/k lKj8Lu7tIiO9xsdkuUEHltslyTDtOeEeDRVQHJ982sMWVRwZhzmkd79Hc4de2bm+n5Rc vowQKg3w7g0iGEB3wWolpZPZMcTqIO0IGIHED4ScBdnpjal/JmV8q0pkAneU4eSJQHQV af9A== X-Gm-Message-State: AHPjjUgUmjOZT14+l6Ea5yznBpOSvwpvui1H8xbX9wYlHHYRbVimBT9l Eg+pX+o7MoKrnrKWhmyo/w== X-Google-Smtp-Source: AOwi7QAM41BjpRBPJt1g+x6xtWz9Vq2rsaQBEpxDTTDB9Ed5bOT0BoZCztV0Q2YqwCQ2TmoYXXmnig== X-Received: by 10.55.79.79 with SMTP id d76mr25893405qkb.173.1505303329341; Wed, 13 Sep 2017 04:48:49 -0700 (PDT) Original-Received: from holos.localdomain (pool-173-67-36-61.bltmmd.fios.verizon.net. [173.67.36.61]) by smtp.gmail.com with ESMTPSA id o17sm7820674qkl.14.2017.09.13.04.48.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Sep 2017 04:48:48 -0700 (PDT) Original-Received: by holos.localdomain (Postfix, from userid 1000) id 6648169FA0; Wed, 13 Sep 2017 07:48:46 -0400 (EDT) Content-Disposition: inline In-Reply-To: <8760cm299r.fsf@drachen> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:136876 Archived-At: On 13/09/17 at 12:16pm, Michael Heerdegen wrote: > Mark Oteiza writes: > > > > In `internal--listify': > > > isn't (or (listp form) (atom form)) always true? > > > > Yes, that could instead be (or form (null form)). It's meant to catch > > things like this: > > > > (should (equal nil (and-let* ((nil) (x 1))))) > > Why can't we just replace it with the equivalent `t' (and simplify the > code accordingly)? Oh goodness… thanks. > > > Secondly, in `internal--build-binding-value-form': > > > How can it happen that (car binding) is an atom but not symbolp? And if > > > (car binding) == var is not a symbol, how does the returned binding make > > > sense? > > > > It's an expression, like a number. > > > > (should (equal 1 (and-let* ((2) (x 1))))) > > AFAICT, this doesn't run the code I mention. If I trace > `internal--build-binding-value-form' and try this, I get > > 1 -> (internal--build-binding-value-form (#:s nil) t) > 1 <- internal--build-binding-value-form: (#:s (and t nil)) > ====================================================================== > 1 -> (internal--build-binding-value-form (x 1) #:s) > 1 <- internal--build-binding-value-form: (x (and #:s 1)) > > In both cases, (car binding) evals to a symbol. I guess the following is fine then--thanks for finding these. diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 3ea01065c8..ba0ab6cb4c 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -87,9 +87,7 @@ internal--listify If ELT is of the form ((EXPR)), listify (EXPR) with a dummy symbol." (cond ((symbolp elt) (list elt elt)) - ((and (null (cdr elt)) - (let ((form (car elt))) - (or (listp form) (atom form)))) + ((null (cdr elt)) (list (make-symbol "s") (car elt))) (t elt))) @@ -104,9 +102,7 @@ internal--check-binding (defsubst internal--build-binding-value-form (binding prev-var) "Build the conditional value form for BINDING using PREV-VAR." (let ((var (car binding))) - (if (and (null (cdr binding)) (atom (car binding)) (not (symbolp (car binding)))) - `(,var (and ,prev-var ,var)) - `(,var (and ,prev-var ,(cadr binding)))))) + `(,var (and ,prev-var ,(cadr binding))))) (defun internal--build-binding (binding prev-var) "Check and build a single BINDING with PREV-VAR."