From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#69108: false-positive warning "variable =?UTF-8?Q?=E2=80=98=5F=E2=80=99?= not left unused" in if-let* and if-let Date: Sun, 25 Feb 2024 02:54:04 +0100 Message-ID: <87a5npux4z.fsf@web.de> References: <87il2ryi30.fsf@web.de> <87mss09bnc.fsf@web.de> <86eddbv7no.fsf@gnu.org> <874je6agww.fsf@web.de> <86o7ces1ou.fsf@gnu.org> Reply-To: Michael Heerdegen Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32465"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Hi-Angel@yandex.ru, 69108@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 25 02:55:00 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1re3jI-0008CK-D5 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 25 Feb 2024 02:55:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1re3ix-00025z-AF; Sat, 24 Feb 2024 20:54:39 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1re3iw-00025m-EL for bug-gnu-emacs@gnu.org; Sat, 24 Feb 2024 20:54:38 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1re3iw-0006tn-6Y for bug-gnu-emacs@gnu.org; Sat, 24 Feb 2024 20:54:38 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1re3jK-0003Uq-7f for bug-gnu-emacs@gnu.org; Sat, 24 Feb 2024 20:55:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 25 Feb 2024 01:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69108 X-GNU-PR-Package: emacs Original-Received: via spool by 69108-submit@debbugs.gnu.org id=B69108.170882605413256 (code B ref 69108); Sun, 25 Feb 2024 01:55:02 +0000 Original-Received: (at 69108) by debbugs.gnu.org; 25 Feb 2024 01:54:14 +0000 Original-Received: from localhost ([127.0.0.1]:52508 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1re3iW-0003Rc-C0 for submit@debbugs.gnu.org; Sat, 24 Feb 2024 20:54:14 -0500 Original-Received: from mout.web.de ([212.227.17.12]:40645) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1re3iT-0003R3-Fx for 69108@debbugs.gnu.org; Sat, 24 Feb 2024 20:54:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1708826018; x=1709430818; i=michael_heerdegen@web.de; bh=9gMzS6uF4gx9I6EMe7y85mcTLApSOntVdUMqVdMKJZk=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References: Date; b=TRXEh6ytUdtV+nbXepr4uqTRDpgVIF/ZqV4nKZNsXEzTy8BaySZXjAgyhnrE0MiE DHMNdNriDxo9C0hccS/JO/fhuHsvSQ7vHCu887p7RhFj9LNZjVcZqbI/TvlMX/6pO lOJYMePrvoHOgt7rsqD3Rut6vqotU2UeIyNeGSugOE7Wn67p7mpvVUtQlzO6KzftP FB9ao5I2An+N1qrjkOzucIMy7dS1eTrAUOgjWCaLNmEqbCHGdbR6oqQUxdIBILi8c 0Izo/ibIPMNz3s9rbD+zAszBHwxTKk0uG1dI92tEBE5DCykJoegS5WKYE6PRwFU2a 5KUuvgFzv6NOmrXyRg== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Original-Received: from drachen.dragon ([92.76.229.82]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MSqXM-1rThaW00xa-00UjBX; Sun, 25 Feb 2024 02:53:38 +0100 In-Reply-To: <86o7ces1ou.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 18 Feb 2024 08:53:37 +0200") X-Provags-ID: V03:K1:P871b/BbkS8EOz8Q4I2iR5Vg7oQbEBEM6ZAddJQjwPkFP7DcXyM gnEOU15D0UHc/dYyGlX14bDlV/FWQJUN/vpJmahWxa4xVcAzPfDQ1gQ8D3E3i158dKHkwYX 6Z5cuR74FQl2btX5TLlrzH3pm6m5IAe7U7seGK291FvEWk0YzcZYPcx4CouisMSebaxHSvX UYeig9wJCFFSNET3jbNIw== UI-OutboundReport: notjunk:1;M01:P0:zXKmfv/jMLM=;aFfw1LoyITQdEM2LujMyAAqWzAq 2WVnPXHT4lG8BMGo+Cy+62fd2MAdT5uV3JfpzNHEVQYR6XH1wycfZzR85rJ5LCZPnDvzDMClB uQWVCW5KP5BbSp3cfJF2Ie0viFyRpxHkIClOlqAVS+Xb+MvCjmqd0okcvnkKejvHCtyL2zhPS Tt55N/TI1XWT4LeGmS58TTFNNpY5CM/5+3BOdy2hoLTdcZGVsvJtmwvMbD5GBxWW9nw6lf2bJ UvQMschxXRNpV5GEme/LXbei3Vvsx9ox053gVgXak1nJLx7etB2g/3k99TN9KP+zLa685okXs Q7G3M5OIhqtyyozMyJg0VzRARPSlqjNK2Liensymr7vZGiT6EmvczOnaSh7VsWop9cXVET1dc OIkbp2/6AScLRc92pYW4HLpOztkY8wr9yyrKJ3ojmide+vr7MoZeof3MvIto6lbTGbWP4Hv4K QxHO/LSjN7m+HigJbLr9bPDnGoE9/LbIoWtm4tBNGyI1vQztGFVyXn8tKyNsmuq+TwkfA9yXO PIoVWH/AgBq6AmjYAmpLZ3gw1O3CzGWx69f6Silv9kJZvCCNVU93LUFvGPmIAbRSz9zu2w1qq K8F/zXivRIAsSqtrvapMgPTYNYHhAy+oFzxkk50TDdp9GSfMSonQ57olFDiRqF42Or4UpeKmF CR+4ESFh8b/rTY4MWZDxHWcbBoOs0VOqY1DUkb9VumKwJbjcama39oaXaBZAFBE+0tBmcbLS/ wxSQKl3Xj6ZadNn9XuuSVATCH/bjjXofVBflJydl9rIpsvzlwLsNUVCbyxzW/piWiKQtYPvz X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280582 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: > > [...] repeating a test. Is this what you prefer? > > Yes, I think so. And you could perhaps avoid repetition of > (cdr binding) by saving the result of (null (cdr binding)) in > a local variable. I went with a separate `cond' branch added instead, I think this is even simpler. Ok? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Don-t-warn-about-_-not-left-unused-in-if-let-and-ali.patch Content-Transfer-Encoding: quoted-printable =46rom 83d42089a77bc0fa4745f708ca73b5e7cddd1829 Mon Sep 17 00:00:00 2001 From: Michael Heerdegen Date: Fri, 16 Feb 2024 22:07:18 +0100 Subject: [PATCH 1/2] Don't warn about _ not left unused in if-let and alik= e The macro expansions did not leave a variable _ unused; this triggered an irritating compiler warning (bug#69108). * lisp/subr.el (internal--build-binding): Handle bindings of the form (_ EXPR) separately. =2D-- lisp/subr.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/subr.el b/lisp/subr.el index c317d558e24..afbe6845d7a 100644 =2D-- a/lisp/subr.el +++ b/lisp/subr.el @@ -2580,6 +2580,8 @@ internal--build-binding (list binding binding)) ((null (cdr binding)) (list (make-symbol "s") (car binding))) + ((eq '_ (car binding)) + (list (make-symbol "s") (cadr binding))) (t binding))) (when (> (length binding) 2) (signal 'error =2D- 2.39.2 --=-=-= Content-Type: text/plain > > {My unsuccessful doc tweaks} > > [...] I'd prefer to separate it. Done. Feel free to tune it to your likes. Or send me an "ok", then I'll just commit this version. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0002-WIP-lisp-subr.el-if-let-and-let-Tweak-doc.patch Content-Transfer-Encoding: quoted-printable =46rom 117a82505c3fe9ec1148cb2a7b870cb8e2eb2b6d Mon Sep 17 00:00:00 2001 From: Michael Heerdegen Date: Sun, 18 Feb 2024 02:27:56 +0100 Subject: [PATCH 2/2] WIP: ; * lisp/subr.el (if-let, and-let*): Tweak doc =2D-- lisp/subr.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index afbe6845d7a..62600ff49bf 100644 =2D-- a/lisp/subr.el +++ b/lisp/subr.el @@ -2622,7 +2622,7 @@ when-let* (defmacro and-let* (varlist &rest body) "Bind variables according to VARLIST and conditionally evaluate BODY. Like `when-let*', except if BODY is empty and all the bindings -are non-nil, then the result is non-nil." +are non-nil, then the result is the value of the last binding." (declare (indent 1) (debug if-let*)) (let (res) (if varlist @@ -2635,7 +2635,8 @@ if-let "Bind variables according to SPEC and evaluate THEN or ELSE. Evaluate each binding in turn, as in `let*', stopping if a binding value is nil. If all are non-nil return the value of -THEN, otherwise the last form in ELSE. +THEN, otherwise the value of the last form in ELSE, or nil if +there are none. Each element of SPEC is a list (SYMBOL VALUEFORM) that binds SYMBOL to the value of VALUEFORM. An element can additionally be =2D- 2.39.2 --=-=-= Content-Type: text/plain > https://en.wikipedia.org/wiki/Construct_state Thanks. Did not expect that my change could be interpreted involving genitive... Michael. --=-=-=--