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: Sat, 17 Feb 2024 01:28:55 +0100 Message-ID: <87mss09bnc.fsf@web.de> References: <87il2ryi30.fsf@web.de> 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="1896"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 69108@debbugs.gnu.org To: Konstantin Kharlamov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 17 01:28:58 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 1rb8Zd-0000Jg-Nl for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Feb 2024 01:28:57 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rb8ZQ-0000RT-Je; Fri, 16 Feb 2024 19:28:44 -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 1rb8ZO-0000RC-Pb for bug-gnu-emacs@gnu.org; Fri, 16 Feb 2024 19:28:42 -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 1rb8ZO-0005rj-HT for bug-gnu-emacs@gnu.org; Fri, 16 Feb 2024 19:28:42 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rb8Zh-00019p-No for bug-gnu-emacs@gnu.org; Fri, 16 Feb 2024 19:29:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Feb 2024 00:29:01 +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.17081297404442 (code B ref 69108); Sat, 17 Feb 2024 00:29:01 +0000 Original-Received: (at 69108) by debbugs.gnu.org; 17 Feb 2024 00:29:00 +0000 Original-Received: from localhost ([127.0.0.1]:60324 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rb8Zg-00019a-DV for submit@debbugs.gnu.org; Fri, 16 Feb 2024 19:29:00 -0500 Original-Received: from mout.web.de ([212.227.15.4]:53149) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rb8Zb-00019J-It for 69108@debbugs.gnu.org; Fri, 16 Feb 2024 19:28:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1708129709; x=1708734509; i=michael_heerdegen@web.de; bh=h4g0ABvUACM57c0j6Ds0TX0VQqmIJiTACug/sg33Ji4=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References: Date; b=vBRw6wuos7H/e7/51Fz8vLmKd8rUZ6jEF4j2zYaprCr4CRB4ynJvX+/itElyBzQ7 nNl7+f0zHYVkTAZ5iPmdSQZz8n/A6E39GxXzNMCyv+hRNp7V+/SpsW8jhmk7zRHPe GIBehsgonQi0wEcB4igxZ8eZCmiyHsOv6XAaz27DaN/mOEEgw5o5vzxih8OZ3ny0k NGR9fu03b0vWMsZJwozyG0Xr8Pt/YCdrdXjBUJHBqAkwV0w15KfU4VZAtd7rsvyh4 qdHmDWrJLYcHmtDZbpqMzEwgTnU2T+RRo/e0Xq86uGuB9v+kvawJ5HVbm53Gzimex Hid53b4EkSF+/aNySA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Original-Received: from drachen.dragon ([88.66.201.224]) by smtp.web.de (mrweb005 [213.165.67.108]) with ESMTPSA (Nemesis) id 1N4vNQ-1qrnKr1IJA-010xmB; Sat, 17 Feb 2024 01:28:29 +0100 In-Reply-To: <87il2ryi30.fsf@web.de> (Michael Heerdegen's message of "Wed, 14 Feb 2024 02:01:39 +0100") X-Provags-ID: V03:K1:5dzzlQlK2Tch0TzlWsBPgic9bi6vqS2jlF+jZaWVTmyj6Z/+fZq N2l48JAhq8iYW+WwEoPDQTHgs083LpbnQUF6P0LC5GPiAzThIXV4+4JKMMvAbkUeMXp8sV+ qNQt6gXbp6BDDr2myPe3zjvY56juMRpAwDxndPvH8geQ/VIpCylsTmmHthNyKaP/p9Fl8Us +dAY9yfeWrHpHK8hZYmUw== UI-OutboundReport: notjunk:1;M01:P0:T8yXx5nrZuQ=;SroLgD0C+hWhcLqM9axbMFxeyd6 EcfE9iFE8mtaO9y7zY8WoWjcvGv4B3btVV/oZc5wko4rE3E4Qlbl0kfJPIVxuuzL5+i4vGSAw BwazkOWzV7dO0fv5k6J/c7d8GQQW6Qar7gWjtGhXJTLVHrnsJ6p+Zs0eFeQ3S5lWGdR/kGZuO RiBusnfVopLEM1yGaaoMEu6xX8gACNqdkk1DZ03+dWx4VmxPe6B7fANtZZ8LhriPgmPT/4CHH AxY8iv13vZfgcuoB2/d7/7Is+jDJcJRsBsRjyOQJtytZjt84ONd8cgUK0jkQZOKglOnC3Deh7 1S1YZEqa7ltigD6zsYqBmpvLYzyCY+CyvrbGPb1PYi9ubVRMFQ3IbkunU073r4lC0a8iR9hdz xPOHD6OJoz5x1lpqwhSR6Wkn4Cf141SqYYx54HCJ99hP6DFMWzqjMoqrXxFTNATXyKMsgQnXh dFU+foWglvU51boZenLKQBFSKZl5QlqFCPepTJywEgtOyibVnDlRFRiLob5o8ueHhGS9kWKAI A4XhSzjlStT2tpBUSAGs721WLD8JEyR71/BqdU739f4n3umTcgZuxCdBkBjwU2AfIWRfmaHUX jSP9K/Q2gEXp5gXCakUU5BgI7YF3shA/IqOaGJeGtG5f0bToukTuHsUJ4h0+jDTD1oJtSQYN0 EscbsGvh0jpmpnu2z3gNLjM93mbXd4a9EdwpmEEi+OdPhlMI0VmKozAc/It8Obo1o8VwVzqER j437tPi1L5oDdfMsy41egTi6Sreww2HFoeYEvaTau+s5W/QM/t83rjsERzHZV0k1HXqPgI2P 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:280110 Archived-At: --=-=-= Content-Type: text/plain I write: > Would be a one liner to make both cases generate the same expansion. --=-=-= 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 906355a716864c87aa0ea112ac890ec9f59d0089 Mon Sep 17 00:00:00 2001 From: Michael Heerdegen Date: Fri, 16 Feb 2024 22:07:18 +0100 Subject: [PATCH] Don't warn about _ not left unused in if-let and alike Fix Bug#69108: The macro expansions did not leave a variable _ unused; this triggered a compiler warning. * lisp/subr.el (internal--build-binding): Handle (_ FORM) separately. (if-let, and-let*): Tweak doc. =2D-- lisp/subr.el | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index c317d558e24..4f22f0c6b3f 100644 =2D-- a/lisp/subr.el +++ b/lisp/subr.el @@ -2575,12 +2575,12 @@ delay-mode-hooks (defun internal--build-binding (binding prev-var) "Check and build a single BINDING with PREV-VAR." (setq binding - (cond - ((symbolp binding) + (pcase binding + ((pred symbolp) (list binding binding)) - ((null (cdr binding)) - (list (make-symbol "s") (car binding))) - (t binding))) + ((or `(,test) `(_ ,test)) + (list (make-symbol "s") test)) + (_ binding))) (when (> (length binding) 2) (signal 'error (cons "`let' bindings can have only one value-form" binding))= ) @@ -2620,7 +2620,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 @@ -2631,9 +2631,9 @@ and-let* (defmacro if-let (spec then &rest else) "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. +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 +value of the last ELSE form 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 @@ -2642,9 +2642,9 @@ if-let interest. It can also be of the form SYMBOL, then the binding of SYMBOL is checked for nil. -As a special case, interprets a SPEC of the form \(SYMBOL SOMETHING) -like \((SYMBOL SOMETHING)). This exists for backward compatibility -with an old syntax that accepted only one binding." +As a special case that exists for backward compatibility only, a +complete SPEC of the form \(SYMBOL SOMETHING) is interpreted like +\((SYMBOL SOMETHING))." (declare (indent 2) (debug ([&or (symbolp form) ; must be first, Bug#48489 (&rest [&or symbolp (symbolp form) (form)])] =2D- 2.39.2 --=-=-= Content-Type: text/plain Michael. --=-=-=--