From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 13 16:21:35 2024 Received: (at submit) by debbugs.gnu.org; 13 Feb 2024 21:21:35 +0000 Received: from localhost ([127.0.0.1]:48084 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ra0De-0000a4-J8 for submit@debbugs.gnu.org; Tue, 13 Feb 2024 16:21:35 -0500 Received: from lists.gnu.org ([209.51.188.17]:35922) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ra0Dc-0000Zr-7Q for submit@debbugs.gnu.org; Tue, 13 Feb 2024 16:21:33 -0500 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 1ra0DK-0002fS-3a for bug-gnu-emacs@gnu.org; Tue, 13 Feb 2024 16:21:14 -0500 Received: from forward102a.mail.yandex.net ([178.154.239.85]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ra0DF-0007ic-Ok for bug-gnu-emacs@gnu.org; Tue, 13 Feb 2024 16:21:13 -0500 Received: from mail-nwsmtp-smtp-production-main-74.vla.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-74.vla.yp-c.yandex.net [IPv6:2a02:6b8:c1d:47bd:0:640:2492:0]) by forward102a.mail.yandex.net (Yandex) with ESMTPS id 061CE60AA1 for ; Wed, 14 Feb 2024 00:21:02 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-74.vla.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id 1LvaDB0kCKo0-yff0kHbR; Wed, 14 Feb 2024 00:21:01 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1707859261; bh=pdCBFxC36Lfmrndc0u0O1Rty67nNz3Hai0mJS9CEUzM=; h=Date:To:From:Subject:Message-ID; b=syBy+Ehl+MMvZ7KoDeV+TLvWIf2IrMXDE9A8KYAG6BYJnsISTZl6PgHhIdqRKLkqw WPIFkdQU+clT0ZzPBj4dDtXJhX+ugLDQxv0RGtgAyB4o0KerO7kUgVsnDZJRrH9imo 1JC6tr2bNUGfFGHvM5ibi7rjxZ17Z2T1L197jK5U= Authentication-Results: mail-nwsmtp-smtp-production-main-74.vla.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: Subject: false-positive warning "variable =?UTF-8?Q?=E2=80=98=5F=E2=80=99?= not left unused" in if-let* and if-let From: Konstantin Kharlamov To: bug-gnu-emacs@gnu.org Date: Wed, 14 Feb 2024 00:21:01 +0300 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.3 MIME-Version: 1.0 Received-SPF: pass client-ip=178.154.239.85; envelope-from=Hi-Angel@yandex.ru; helo=forward102a.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) I've been writing an answer for a question on emacs.stackexchange=C2=B9 and= to avoid nested `if` and `let` clauses I used a `if-let*`, and result of one of the = checks I assigned to a `_` variable, because the variable would be left unused, it's= only the check being non-nil that mattered. But when byte-compiled that triggered a: test.el:6:9: Warning: variable =E2=80=98_=E2=80=99 not left unused =E2=80=A6which is untrue, because it is unused. The problem is present in both `if-let` and `if-let*` # Steps to reproduce 1. Create test.el with the following code: ;;; -*- lexical-binding: t -*- (if-let* ((_ nil)) (print "then clause") (print "else clause")) 2. M-x byte-compile test.el ## Expected It byte-compiles with no warnings ## Actual It compiles with a warning: test.el:3:7: Warning: variable =E2=80=98_=E2=80=99 not left unused # Additional information Emacs version: commit d4d5830f8a0 built two weeks ago from master. 1: https://emacs.stackexchange.com/questions/80351/delete-prettify-symbol From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 13 20:01:44 2024 Received: (at 69108) by debbugs.gnu.org; 14 Feb 2024 01:01:44 +0000 Received: from localhost ([127.0.0.1]:48875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ra3ei-00080f-BV for submit@debbugs.gnu.org; Tue, 13 Feb 2024 20:01:44 -0500 Received: from mout.web.de ([212.227.17.12]:59647) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ra3ec-00080D-5c for 69108@debbugs.gnu.org; Tue, 13 Feb 2024 20:01:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1707872474; x=1708477274; i=michael_heerdegen@web.de; bh=3Xq1xjCostnC7iY4gPW6jy9cm9BF0iaFQEPW2+kWfiE=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References: Date; b=OcpHDgMK/Y5X7g6XTvLxGnbAI6T+f5w9PZ88X/epiHmnJJHqNxT1cg2do1r9nbC9 KpH6cLKYLFVAxPZmf7gcgz9vrmkK3I6R2sXroFLMQCuEF3luaD/M87PjUxWP6hF47 JazjyydzCi2HWIS45NS5rj73TPiTx9DX55Wx1O+FP/lR6hfmRrHMpIoHhztDKOrGG ZOKg2vETEW2FwlA5HaJNW4KMtIWGF3XlcEj3qEu91/d16dSBolXXhKiY3+10wZ9Yr EVcocFTN2tJ4OfRL2EBoQg6eQketVjzTNRBPSJOLQI4WRrKmDKhrQUkzLneWOOWrf a/MKIIKQx+5sllSNRw== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from drachen.dragon ([88.66.201.224]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MPrLN-1rNjp43lJL-00MuI1; Wed, 14 Feb 2024 02:01:13 +0100 From: Michael Heerdegen To: Konstantin Kharlamov Subject: Re: bug#69108: false-positive warning "variable =?utf-8?B?4oCY?= =?utf-8?B?X+KAmQ==?= not left unused" in if-let* and if-let In-Reply-To: (Konstantin Kharlamov's message of "Wed, 14 Feb 2024 00:21:01 +0300") References: Date: Wed, 14 Feb 2024 02:01:39 +0100 Message-ID: <87il2ryi30.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:0K77YDCXqhcgl0XH9wwC8V5l0aEv2s7xlXAu7g/H7CGkYvqpZ8R T1w43cwSG2UPzZZTzzKOlnSn9cnl4jPTarkvA62k6LFyXsL/EdjU3CMcEb0+ZYJwaAnpWPl hBr+FjyDT2crfY4ZmLwqIgHaR93Zd4hzOoXKb4krtEx4vF6TWlKskhfw5sf+I1oCYoCZi+A dSeTNnLsskag44ngFr5ag== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:7vbzFHxkzg8=;S5uaqZUFRrb8tMN0rsc1yosNaIh TdM5dZckr4BC9I3aChkIn4am/xy/u3XzIFF4IN41+Y4BLfJZrcSTlftu1kiA31SbN3cSUyBpy /Uxx8AXMsYyBG55Z/3jfmzRG2Z91Rnh9DaB60DeJkIC5JDZdvEhfISO/+FEEeBLmp9ah1MXvs s0Aekl5Jm4O2IJmH5DDth3ckSVVOHiU6mPs1YljiC4ofKDLYXKOyl1bJ2o8YaJULjdIq4u+3Y RH7cTsQh1e11bxYxFuS59p6255cGRBWhNfnFRiCiUhTFi8F7jMETe+MZuCx8TNxCPXjj5uXZ7 oupbKntiIMiAO4D+MqkKPvZjzTKGDoX8OTrKpsmEP4McOlhEG0zXk0sqBuhWeYs8LrPpNpzO3 0pblgimhFgchAmwrYjV9FO8qWnWzZI4bWCToywjBn87mRiBjBJLhTKIlbbNHJzJAQihnpx3KK gAIQmW3zWUJikuUuzKPwQ+9vFZ4bxioZ3tqKv715XE9sFU/oBTZeDLcgrq+Hmm796N+g2YAmX 9YG/GhHVfLJu/VqXNI4ftvkUIVv46YMfbIlbfids5HxG59fHueZuh8nBcVzK7U0mzm/Y8e3We DeFIVKg+D2l2qOGVINVwoAHeY+9W8sIjErDKEn9m8woCYAci2D2poM8Wx9zQfp2Fk8qaedIYL gdXm1rrjn7Z0TA8LtpRsl9tQJZv2mkklLfAxNEaZHhuK1ZRKMls568W+K9Kb6WeG7K5Ak5QKE D7RrRBnn0qihiCQMUj/Iv9J0QyNPOyX2Z8Teay8Vq1Bpiy9H61T46mXbSxLCZfSBOhHMM0FCB U8ioIRiYFvWvPUVthoMRUhLHFlMXlrls3MKaZMMMb5HIw= X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 69108 Cc: 69108@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.9 (--) Konstantin Kharlamov writes: > I've been writing an answer for a question on emacs.stackexchange=C2=B9 a= nd > to avoid nested `if` and `let` clauses I used a `if-let*`, and result > of one of the checks I assigned to a `_` variable, because the > variable would be left unused, it's only the check being non-nil that > mattered. > > But when byte-compiled that triggered a: > > test.el:6:9: Warning: variable =E2=80=98_=E2=80=99 not left unused > > =E2=80=A6which is untrue, because it is unused. I also find this annoying. Currently the variable is actually used (implicitly, in the expansion), so it's not an error in the compiler. But the warning is not really helpful (code works as intended), and (_ TEST-EXPR) is maybe even easier to read or more intuitive than the official (TEST-EXPR) syntax. Would be a one liner to make both cases generate the same expansion. Are there any votes against this? Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 16 19:29:00 2024 Received: (at 69108) by debbugs.gnu.org; 17 Feb 2024 00:29:00 +0000 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 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 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 From: Michael Heerdegen To: Konstantin Kharlamov Subject: Re: bug#69108: false-positive warning "variable =?utf-8?B?4oCY?= =?utf-8?B?X+KAmQ==?= not left unused" in if-let* and if-let In-Reply-To: <87il2ryi30.fsf@web.de> (Michael Heerdegen's message of "Wed, 14 Feb 2024 02:01:39 +0100") References: <87il2ryi30.fsf@web.de> Date: Sat, 17 Feb 2024 01:28:55 +0100 Message-ID: <87mss09bnc.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Provags-ID: V03:K1:5dzzlQlK2Tch0TzlWsBPgic9bi6vqS2jlF+jZaWVTmyj6Z/+fZq N2l48JAhq8iYW+WwEoPDQTHgs083LpbnQUF6P0LC5GPiAzThIXV4+4JKMMvAbkUeMXp8sV+ qNQt6gXbp6BDDr2myPe3zjvY56juMRpAwDxndPvH8geQ/VIpCylsTmmHthNyKaP/p9Fl8Us +dAY9yfeWrHpHK8hZYmUw== X-Spam-Flag: NO 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/t83rjsERzHZV0k1HXqPgI2P4 N9oSDRsGc3ndN/Sb6ILooJvZTFWYhzNnNa5KZfP1dsQ/8= X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 69108 Cc: 69108@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.6 (---) --=-=-= 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. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 17 03:04:49 2024 Received: (at 69108) by debbugs.gnu.org; 17 Feb 2024 08:04:49 +0000 Received: from localhost ([127.0.0.1]:60381 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbFgm-0004wZ-Nq for submit@debbugs.gnu.org; Sat, 17 Feb 2024 03:04:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39844) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbFgh-0004wI-MZ for 69108@debbugs.gnu.org; Sat, 17 Feb 2024 03:04:46 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rbFgG-0003Wq-5m; Sat, 17 Feb 2024 03:04:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=UD78Zcv0aFTSjCO5sh0tu3KCpH2QeGSIAVQBU1cJICE=; b=ELYP/0SuCKUp55ToV+Pq NH6QMYRqwgqpBtrv10Q3KyxAv6Ct+Yh9rlnGs6TvyCONUD4PZ+ZiBgAcKwkWrV7Tq3A7GQXL7Ugk+ 8VCrbymz2CtWlOQXXNffICFqbVbQbEz4HwYqUblXA1xqjWTzhNNP+erKTTElGr67vVHiFs7aZKF1o 2kya1GbYqRBSZS8Z39x7Jz6MNQz/ku6ihKoJOut4Ude3foyF65kYZRMOry6eZWU5bqSIO9Np+6HI9 uueV4KYpxVnBXrzDQlbTeUUeyN/hYZp6Vhie3LaSw4lP6ul4ZqLUZaZVwYc6DnUtdu+xLvN0UmF8I ntKRgHmWbTmfDw==; Date: Sat, 17 Feb 2024 10:04:11 +0200 Message-Id: <86eddbv7no.fsf@gnu.org> From: Eli Zaretskii To: Michael Heerdegen In-Reply-To: <87mss09bnc.fsf@web.de> (bug-gnu-emacs@gnu.org) Subject: Re: bug#69108: false-positive warning "variable =?utf-8?B?4oCYX+KAmQ==?= not left unused" in if-let* and if-let References: <87il2ryi30.fsf@web.de> <87mss09bnc.fsf@web.de> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 69108 Cc: 69108@debbugs.gnu.org, Hi-Angel@yandex.ru X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.2 (-----) > Cc: 69108@debbugs.gnu.org > Date: Sat, 17 Feb 2024 01:28:55 +0100 > From: Michael Heerdegen via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > --- 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))) Thanks, but can we please leave this as 'cond', instead of converting it to a 'pcase'? It doesn't seem to be justified here, and even less so since you need to rewrite all the existing conditions. > (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)])] This hunk seems to be unrelated? And it is not necessarily for the better, IMO, at least not all of it (replaces active tense with passive, refills text that doesn't need refilling, and other minor issues, like the confusing use of construct state in "last ELSE form"). From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 17 04:20:45 2024 Received: (at 69108) by debbugs.gnu.org; 17 Feb 2024 09:20:45 +0000 Received: from localhost ([127.0.0.1]:60455 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbGsG-0007H9-Vt for submit@debbugs.gnu.org; Sat, 17 Feb 2024 04:20:45 -0500 Received: from forward502c.mail.yandex.net ([178.154.239.210]:55604) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbGsC-0007Gv-3g for 69108@debbugs.gnu.org; Sat, 17 Feb 2024 04:20:44 -0500 Received: from mail-nwsmtp-smtp-production-main-29.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-29.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:2214:0:640:d6b5:0]) by forward502c.mail.yandex.net (Yandex) with ESMTPS id 8300060C15; Sat, 17 Feb 2024 12:20:17 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-29.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id GKKHWrMAXCg0-EL6ZksTh; Sat, 17 Feb 2024 12:20:17 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1708161617; bh=k6h6OWWCu9zl96/qbv+Mw7lr9v0LjEchC1q/TD+Kr/w=; h=References:Date:In-Reply-To:Cc:To:From:Subject:Message-ID; b=GjF5WyFp3i6hN/B8KA374F2w69zWcSIPTC7KEJ1qufbbzO4m9m2TGkQSSfdrE0ZZ0 XlwXkrPiNLf8qNUW7xvQEfl3zuy1v/CTJH3W/lixUZ1yFTsEL5pkQNofpTOBIXsF0a 2hr46ZGqSOT4pr8wLWq0ViTF2xVB+DqUx6ZGuMIw= Authentication-Results: mail-nwsmtp-smtp-production-main-29.myt.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: <78798be7b3bc7a7bb477d4ec952734b199588d00.camel@yandex.ru> Subject: Re: 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 From: Konstantin Kharlamov To: Eli Zaretskii , Michael Heerdegen Date: Sat, 17 Feb 2024 12:20:16 +0300 In-Reply-To: <86eddbv7no.fsf@gnu.org> References: <87il2ryi30.fsf@web.de> <87mss09bnc.fsf@web.de> <86eddbv7no.fsf@gnu.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.3 MIME-Version: 1.0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 69108 Cc: 69108@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.9 (--) On Sat, 2024-02-17 at 10:04 +0200, Eli Zaretskii wrote: > > Cc: 69108@debbugs.gnu.org > > Date: Sat, 17 Feb 2024 01:28:55 +0100 > > From:=C2=A0 Michael Heerdegen via "Bug reports for GNU Emacs, > > =C2=A0the Swiss army knife of text editors" > >=20 > > --- a/lisp/subr.el > > +++ b/lisp/subr.el > > @@ -2575,12 +2575,12 @@ delay-mode-hooks > > =C2=A0(defun internal--build-binding (binding prev-var) > > =C2=A0=C2=A0 "Check and build a single BINDING with PREV-VAR." > > =C2=A0=C2=A0 (setq binding > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (cond > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((symbolp binding) > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (pcase binding > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((pred symbolp) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (list bind= ing binding)) > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((null (cdr binding)) > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (list (make-sym= bol "s") (car binding))) > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (t binding))) > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((or `(,test) `(_ ,te= st)) > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (list (make-sym= bol "s") test)) > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (_ binding))) >=20 > Thanks, but can we please leave this as 'cond', instead of converting > it to a 'pcase'?=C2=A0 It doesn't seem to be justified here, and even les= s > so since you need to rewrite all the existing conditions. Just a side note, from my experience pcase is very slow=C2=B9, so if a function supposed to be called often, I presume it's better to avoid `pcase`. Although, Idk how it compares to `cond`. But judging from the fact `cond` is implemented in C, it is likely faster. 1: https://github.com/ankurdave/color-identifiers-mode/commit/bc566bcdbd79f230= b35eafd2b6c4f8428402ec09 From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 17 04:45:59 2024 Received: (at 69108) by debbugs.gnu.org; 17 Feb 2024 09:45:59 +0000 Received: from localhost ([127.0.0.1]:60479 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbHGS-00088o-Ln for submit@debbugs.gnu.org; Sat, 17 Feb 2024 04:45:59 -0500 Received: from mout02.posteo.de ([185.67.36.66]:33409) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbHGQ-00088a-BN for 69108@debbugs.gnu.org; Sat, 17 Feb 2024 04:45:43 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 2624D240104 for <69108@debbugs.gnu.org>; Sat, 17 Feb 2024 10:45:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1708163116; bh=DPpPDW4oPVqpN24nIMjsfKn8NUkSw0Sqv8W7AEsM0BM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:From; b=Y+IJXpOkDSHxBC3xhfGvcRVCCuSB2w9esttFhAVTd9VKkLl109LL2Qc4j+GZfaoEl Tn6rYv7ZMV2cs+4AJ6xxwordaLFbsjCtPd/Cx5R5KkthsOMHekYELJ3CGsfO6EGzaC 1nb332tK70Mq0lPu2q89GZFXyC9QjbeOh24QCW0tK8O3pht+Bbks6gl7KE8JJXpiOn xrjR0WZU1KLpDEM7EpnFJaeUIEQ+Jxk7BvldRWOqh0Kb+IhgluFUODfyLkrOmkmo00 hFEB+C4TkWDx01UunD7MGuZ7dBuZXkgWtSOsPJtKRucD6965kpriHLTPQN86lAsJWz +7Dzo1JHRckGQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TcP6f5L7tz6tm8; Sat, 17 Feb 2024 10:45:14 +0100 (CET) From: Ihor Radchenko To: Konstantin Kharlamov Subject: Re: bug#69108: false-positive warning "variable =?utf-8?B?4oCY?= =?utf-8?B?X+KAmQ==?= not left unused" in if-let* and if-let In-Reply-To: <78798be7b3bc7a7bb477d4ec952734b199588d00.camel@yandex.ru> References: <87il2ryi30.fsf@web.de> <87mss09bnc.fsf@web.de> <86eddbv7no.fsf@gnu.org> <78798be7b3bc7a7bb477d4ec952734b199588d00.camel@yandex.ru> Date: Sat, 17 Feb 2024 11:45:30 +0000 Message-ID: <878r3jz545.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 69108 Cc: Michael Heerdegen , Eli Zaretskii , 69108@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.9 (--) Konstantin Kharlamov writes: > Just a side note, from my experience pcase is very slow=C2=B9, so if a > function supposed to be called often, I presume it's better to avoid > `pcase`. Although, Idk how it compares to `cond`. But judging from the > fact `cond` is implemented in C, it is likely faster. > > 1: > https://github.com/ankurdave/color-identifiers-mode/commit/bc566bcdbd79f2= 30b35eafd2b6c4f8428402ec09 I very much doubt the assertion of that commit. AFAIK, pcase expands to a similar consp check. If may be slow only when you macro-expand it during run time, not byte-compiling the code during benchmark. I recommend `benchmark-run-compiled' for testing. Or even to use native-compilation. --=20 Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 17 05:09:52 2024 Received: (at 69108) by debbugs.gnu.org; 17 Feb 2024 10:09:52 +0000 Received: from localhost ([127.0.0.1]:60483 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbHdm-0000Se-Rj for submit@debbugs.gnu.org; Sat, 17 Feb 2024 05:09:52 -0500 Received: from forward500b.mail.yandex.net ([178.154.239.144]:50020) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbHdh-0000SJ-7k for 69108@debbugs.gnu.org; Sat, 17 Feb 2024 05:09:49 -0500 Received: from mail-nwsmtp-smtp-production-main-84.iva.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-84.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:4816:0:640:cd71:0]) by forward500b.mail.yandex.net (Yandex) with ESMTPS id E118360F4A; Sat, 17 Feb 2024 13:09:22 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-84.iva.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id L9Lgd7IOkOs0-scQzvBDq; Sat, 17 Feb 2024 13:09:22 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1708164562; bh=xklU1LtUnG94LS/ewlGbZpCrGdgihUTCoMyqNbMdqcU=; h=References:Date:In-Reply-To:Cc:To:From:Subject:Message-ID; b=c5/fqx7lP9mU+dR0htL4UHda0EteCdydiOQJFQn76Km4Ns7Qjm5bbKd1wZV36C1lx Wr3ZPDnfcD0oVPsQJyqYRDCt8SZXq2dgxWt5Q3tcP9fGNAG7VhW+umg0dN/Hx0463W aYUa+/i2FvTXDxvEQuPH/AaUrVBrM2flYVsUAXS4= Authentication-Results: mail-nwsmtp-smtp-production-main-84.iva.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: Subject: Re: 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 From: Konstantin Kharlamov To: Ihor Radchenko Date: Sat, 17 Feb 2024 13:09:21 +0300 In-Reply-To: <878r3jz545.fsf@localhost> References: <87il2ryi30.fsf@web.de> <87mss09bnc.fsf@web.de> <86eddbv7no.fsf@gnu.org> <78798be7b3bc7a7bb477d4ec952734b199588d00.camel@yandex.ru> <878r3jz545.fsf@localhost> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.3 MIME-Version: 1.0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 69108 Cc: Michael Heerdegen , Eli Zaretskii , 69108@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.9 (--) On Sat, 2024-02-17 at 11:45 +0000, Ihor Radchenko wrote: > Konstantin Kharlamov writes: > > > Just a side note, from my experience pcase is very slow=C2=B9, so if a > > function supposed to be called often, I presume it's better to > > avoid > > `pcase`. Although, Idk how it compares to `cond`. But judging from > > the > > fact `cond` is implemented in C, it is likely faster. > > > > 1: > > https://github.com/ankurdave/color-identifiers-mode/commit/bc566bcdbd79= f230b35eafd2b6c4f8428402ec09 > > I very much doubt the assertion of that commit. > AFAIK, pcase expands to a similar consp check. If may be slow only > when > you macro-expand it during run time, not byte-compiling the code > during > benchmark. I recommend `benchmark-run-compiled' for testing. Or even > to > use native-compilation. Sure, I just re-tested with `benchmark-run-compiled` and the result is simi= lar. Here's what I do: 1. In color-identifers repo `git checkout bc566bcdbd79f230b35eafd2b6c4f8428= 402ec09` 2. Open a `emacs ./color-identifiers-mode.el` 3. Now, I don't know for sure if `benchmark-run-compiled` compiles child fu= nctions or not. But just to be on the safe side I merged the two functions, so: 1. Inside function `color-identifiers:elisp-get-declarations` remove the= call `(color-identifiers:elisp-declarations-in-sexp sexp result)` 2. Copy the body of `color-identifiers:elisp-declarations-in-sexp` start= ing with the first `(let)` call and paste it in place where we removed the cal= l. 4. Evaluate `color-identifiers:elisp-get-declarations` 5. Open Emacs's `simple.el` 6. Evaluate `(benchmark-run-compiled 1 (color-identifiers:elisp-get-declara= tions))` Results for 3 times are (this is another laptop, so numbers are a bit di= fferent): (2.0673167670000003 54 1.316455474999998) (2.0684198769999997 54 1.3043319699999998) (2.079789413 54 1.3183175779999985) 7. Undo code changes and call `git checkout HEAD^` to test code prior to th= e commit 8. Repeat 3 and 4 9. Evaluate `(benchmark-run-compiled 1 (color-identifiers:elisp-get-declara= tions))`. Results for 3 times are: (5.194122174 135 3.313309744999998) (5.130884611 135 3.2485326989999948) (5.155663089 134 3.2561076369999995) From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 17 16:46:08 2024 Received: (at 69108) by debbugs.gnu.org; 17 Feb 2024 21:46:08 +0000 Received: from localhost ([127.0.0.1]:33961 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbSVb-0004kV-UJ for submit@debbugs.gnu.org; Sat, 17 Feb 2024 16:46:08 -0500 Received: from mout.web.de ([212.227.15.14]:41433) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbSVa-0004jz-1o for 69108@debbugs.gnu.org; Sat, 17 Feb 2024 16:46:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1708206339; x=1708811139; i=michael_heerdegen@web.de; bh=fB2s8VkYgFcOlFohY7YsUfq8tlq5LYeHsmFmlojBHbo=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References: Date; b=E26tGplTZDLs5YfbUVk9RMT78UgX1J/z+f8/tXLaliuP81dQ4BR0qub7V2H/x8R4 nsrhVHcZ+xPr9Sy96VXM0T/p+bHRiVK6aAA5g8MCQS0EKtJ0LaHKvkDgpE+vI0JZC O14yCooksFEbTEpCGQeldW2/sfhWVhL5Hk2cKHoSwBDAvEDEHIgQtKCGrPdm9gBYV xXmr/IfFjTnIpxdOHhmzdCVMhsDSnvzTGwjRfL1xLiG02ElNQMYw5kBeS2zlmr+82 Il5TMHXtzEvmq00ZoxOFnYNOmagsdoOpIJ/YpNRc9HGLEoHXAr/B8i+J+nIFWL9Dz r6TqfsK1xghOmP6oxA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from drachen.dragon ([88.66.201.224]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1M4bYo-1rd7C91Z26-001fzB; Sat, 17 Feb 2024 22:45:39 +0100 From: Michael Heerdegen To: Konstantin Kharlamov Subject: Re: bug#69108: false-positive warning "variable =?utf-8?B?4oCY?= =?utf-8?B?X+KAmQ==?= not left unused" in if-let* and if-let In-Reply-To: <78798be7b3bc7a7bb477d4ec952734b199588d00.camel@yandex.ru> (Konstantin Kharlamov's message of "Sat, 17 Feb 2024 12:20:16 +0300") References: <87il2ryi30.fsf@web.de> <87mss09bnc.fsf@web.de> <86eddbv7no.fsf@gnu.org> <78798be7b3bc7a7bb477d4ec952734b199588d00.camel@yandex.ru> Date: Sat, 17 Feb 2024 22:46:06 +0100 Message-ID: <878r3iahnl.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:tjJsU2lzEQ1fD+XYPlSK+kQlACFkBzRaC0Rd9dF+esRJb9UUHc6 gN8MgxbILlHJgRbL8buOD2oImRYQ/s1+7/y4DwcoA1BR6V+m8hQpbs0m/dMlOdvDa4pJt3c xEh58xTzBmJ1kRO5/jLRi+8pnpIcuPJFehc5pshbNNEbl6eetYnlVxAYhuQwG17yqmaDP/X jdCYYyRnOe+qPEngoFl6Q== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:GlhiynDjS1M=;h7/2xTjqBZSc5EBVcIC2N2mmA64 xvc3qvuzH9OCL1YcjiTKrgJQf/Gu/gagSubqzCybTY3uM6f6nC5HSGhZlNxnR+GxeCMt8Wrl0 BXpVNjFSKD0VdMMJxNOITdEn889QDrIohqMrV4qxf3rZ/zu8Ny1GPUDwCYKdbYVfMD8ZfawIt m4UY7juiqMo39v28MQyxF2xc0kM8dfrYrfEl04CfYgWSlAZ/9mtF2qBnYDr7DAy8Mg9BriXtp rXW1quT77l0o/LUawLid/w1sUrhm2/hr0ZGLRgf8RasuQ6+0BMBFaz6j+a4J9B89csnJBcsDJ fr0/lTt5mi74MPNRcjNmr1eF61dy8ww3tYGTtwcTIx7+UjISm0/bPh9ati+qx5vSe/UEOgzJi Mo2Lxhf6xJzTV9Adv6i/5eFpKZ0duav2B6X80iTeaABKyDJwOzl8ZnpBI0+OaIcKUNCB2xWea dwLwPQ+gdGccxxp+PaRiGjbqsN6pFn4cEt4JiwsfY5pwMB7eJZ0dQZOPiWX1py3eGC9Pyw1R3 GoDW5gVBTfjRMNHdCHrPG91ErnGjJ62WtUoDyzNg7H8Vn41PC+MEzVUpcsLpaHc9Xl8Neclpf MYLoku1+U2DKyt9DCRc5MKvcYZ640vfRHMT+wzL1PDuQ6pTqe9jpWQmDDebl0swMjZxeK5LD4 Gcgc88Stja12OJeLTnHaq4VcciqtR4dujBGCitvmbTFLdJd1rxzuAI4MpeZ9gwW3EE72xOC6Z mu2cqk5yFlkBLhxLTUBm/Cvd5pgE3732nj1OHvit/Pon0JvwyhR419x1zCPeCxUAX7U5vxYzs xmeSZa1MVhyeUw0qambKTvM90Gk5DNmpNb0T6fCGTUwXw= X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 69108 Cc: Eli Zaretskii , 69108@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.6 (---) Konstantin Kharlamov writes: > Just a side note, from my experience pcase is very slow=C2=B9, so if a > function supposed to be called often, The function I changed is only called when generating the expansions of `if-let' etc, so this is not really an issue here. > I presume it's better to avoid `pcase`. Although, Idk how it compares > to `cond`. But judging from the fact `cond` is implemented in C, it is > likely faster. ?... pcase also expands to things that are implemented in C, this is a too simple benchmark. If you want to discuss this, maybe in a different thread, as it is not relevant here. Michael. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 17 17:02:10 2024 Received: (at 69108) by debbugs.gnu.org; 17 Feb 2024 22:02:10 +0000 Received: from localhost ([127.0.0.1]:33965 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbSl7-0005FE-Jc for submit@debbugs.gnu.org; Sat, 17 Feb 2024 17:02:09 -0500 Received: from mout.web.de ([217.72.192.78]:58103) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbSl4-0005Ef-Us for 69108@debbugs.gnu.org; Sat, 17 Feb 2024 17:02:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1708207300; x=1708812100; i=michael_heerdegen@web.de; bh=i01qF9RZKNSJlfq677xRzIDGRG2+8pveplPRBPlbfrM=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References: Date; b=gWTs57U/0KaZ6mQU04vlI7xRdDjVc2BBN2DoAlx3Akn833ypHq/vXunzuJncr+rv qSTZn6C2xyoo1nJ4DgIPZ8mBSjYCURfQXpKd8V1xjL4Fm8gXwPyySqxkvwIGZbSjf CxuGKaITRsoZW6SLawW7sT6tocpM7jJAVD1pY0K0g+a5NwN91lnn53UXGG26lvsaU g6/egFJZo/cr6G6TztpwV9i6+zDueMp1a+1Qw06nIEpsLixeeVIQrPvtS4Q6BQES9 rhQr/9Z2tZ9i58GQXLHm116eX/BuA0W1SeqjSQtlwUXuQ95lUPcdKivuUAdIKZMJ7 +jM8BNkvzFEJNlaWeQ== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from drachen.dragon ([88.66.201.224]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1My6lR-1qk3QJ1goZ-00zX2g; Sat, 17 Feb 2024 23:01:40 +0100 From: Michael Heerdegen To: Eli Zaretskii Subject: Re: bug#69108: false-positive warning "variable =?utf-8?B?4oCY?= =?utf-8?B?X+KAmQ==?= not left unused" in if-let* and if-let In-Reply-To: <86eddbv7no.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 17 Feb 2024 10:04:11 +0200") References: <87il2ryi30.fsf@web.de> <87mss09bnc.fsf@web.de> <86eddbv7no.fsf@gnu.org> Date: Sat, 17 Feb 2024 23:02:07 +0100 Message-ID: <874je6agww.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:JDOA3pa64Cv0j1oJ7XWwSDtY4Y4I3LEceAjixbu+Sk6rb1hfE3H HWG5sHYTGc4srt5jffAep+ZfHq4S+H1xuzLSc621KchkFRUEMHaaQ52OHVyT6QoBJcbUk/j axRKlY5wTJLslqn+2UiyaPUke4qI2HcRa10zinAy8kUYL9vB1Fw6iTmFQszuUF9Q+E0uVUJ A/BkVFyd4shycCsFVRjzg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:6ItfqwdMZA0=;1Vs/WvWHefUKjImZH8cyVNdnB9U xiY81g4kjYqusD0U/IH9wt4FE0qFK00DK85y377LM0Qf9mPnoG6nwsaUS2nVNPkrloPPqooG4 oEohVcEF39ceO34Bzt/RpnqF9jY+l5sTroytn4ijzI45o/yT3BpADOErDh9KYqH6yRJevhMF0 xm4RKMBmeBGW1S/pA2h/m+h7aAJpUy/BDrnd3Bs6mjlaOq6LQNbV4MsBQlTo+BTIMlJSG/M3g 8SnzTn+HuyOgGYna47BT7Gl8NZ5VADoEvxTDVGfjXAa5K5A9C4uQqOOXP4JNYQZv57hR8gPUB qW7GvZv7fezJ438PcpTcn93raOT6vo6yi1eZGs5wmp6JyRqF40RoSUA1TxNtIvOqXFNqcGL92 TZRbkk0bUnKkeWz72QTL5svVo0Ugg3sO1lAZDlb2pksuaLUFIXe+oJL55+Da8bGtE6wTRCBYs KNJ/uOIh0IZ7TOrav+6+j2gbosXc8rCWUN3K+SkMp+xniv8H4ON3cbzyLMUAokdn67vMU6WjZ yqkiSky34MufaXXcuyC+w63T496zZrDDTJC0qZDGCAFaSQeyiW1Ov6iXKrDbuLUB4Uf8NZXqH YpeFHvMu6Uva4fEzzwyhbVe2+PlXiU9VwffDctPF4xhSbObhHU68cSla7wwGRHi4xb/OQwgYm BseRBJ7MlEXiav9o/iu+0xGQpHHPj4N87gXU0f+NwkQH3X8VMsf34O8m4kPd0Kdr/szNwSqoN d2DlOP8QMUWD6kcdJfn/dhjAfG8+OGVWiJNUvmyKPbPILy0CqeBLDwzVofaQgOKFL9nZj/Xhx 4BOGEBOCkRhsOWwOPDuts/+5VydGghQguZWrph8O1h+HE= Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 69108 Cc: Hi-Angel@yandex.ru, 69108@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.6 (---) Eli Zaretskii writes: > > Cc: 69108@debbugs.gnu.org > > Date: Sat, 17 Feb 2024 01:28:55 +0100 > > From: Michael Heerdegen via "Bug reports for GNU Emacs, > > the Swiss army knife of text editors" > > > > --- 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))) > > Thanks, but can we please leave this as 'cond', instead of converting > it to a 'pcase'? It doesn't seem to be justified here, and even less > so since you need to rewrite all the existing conditions. Oh no. If I don't rewrite this with `pcase', we would either artificially split this case: ((or `(,test) `(_ ,test)) (list (make-symbol "s") test)) into two separate `cond' branches, or we had to merge them into a one bran= ch like this: ((or (null (cdr binding)) (eq '_ (car binding))) (list (make-symbol "s") (if (null (cdr binding)) (car binding) (cadr binding)))) repeating a test. Is this what you prefer? We could also move the test for _ to the beginning, destroying the logic of the code. All of those alternatives seems worse wrt readability. Please to everyone: let's avoid a new discussion about `pcase'. Please, not again. > > [My doc tweaks] > This hunk seems to be unrelated? Yes, I can make it a separate commit it drop it entirely if you prefer. > And it is not necessarily for the better, IMO, at least not all of it > (replaces active tense with passive, refills text that doesn't need > refilling, and other minor issues, I can try to improve that of course. > like the confusing use of construct state in "last ELSE form"). Dunno what a "construct state" is. The doc missed to tell what `if-let' returns when optional ELSE forms are omitted (which is allowed, and then there is no last ELSE form return value), so I tried to add that. Did I mess up the grammar? Michael. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 18 01:54:19 2024 Received: (at 69108) by debbugs.gnu.org; 18 Feb 2024 06:54:19 +0000 Received: from localhost ([127.0.0.1]:34107 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbb46-0002DG-Vk for submit@debbugs.gnu.org; Sun, 18 Feb 2024 01:54:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43592) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbb44-0002D2-7P for 69108@debbugs.gnu.org; Sun, 18 Feb 2024 01:54:17 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rbb3d-0006PV-3i; Sun, 18 Feb 2024 01:53:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=e8jBDo4t+DWRfkFgJBC6Z0x+6RL3zCHgj/OFQLV4FZc=; b=dont3oOX1CuLkN6bZgPK Z2iTJ8agETpKVnxqKpmNiAJNmgXPIWUdD/MtzeNzVr694TjOPmdNh2N/97fcoDdZa+GZGBV4G32q4 tx4in3+CIz6z84+yxjyqYw2OlsJyFY43ec60fU7Ky6nLKiE0AYtuMQBiYNlbafEHXVsQ6F3xMoAOJ tnklO038eizc/hc6/QHh9GNYU4gsZ1qsI8MPpgJNy7iY1ZVz9/JVM1mhQ5yMyrPIQddILdTnkaOO2 2F/96PLXz4KwWQbB9yfs2Odk+VHTS3JPlvByvFlGv/FP2zaGpWF5QfeEqjR4qlX0umKdaWOHyD7L7 YTOEjnCMmRXsKQ==; Date: Sun, 18 Feb 2024 08:53:37 +0200 Message-Id: <86o7ces1ou.fsf@gnu.org> From: Eli Zaretskii To: Michael Heerdegen In-Reply-To: <874je6agww.fsf@web.de> (message from Michael Heerdegen on Sat, 17 Feb 2024 23:02:07 +0100) Subject: Re: bug#69108: false-positive warning "variable =?utf-8?B?4oCY?= =?utf-8?B?X+KAmQ==?= not left unused" in if-let* and if-let References: <87il2ryi30.fsf@web.de> <87mss09bnc.fsf@web.de> <86eddbv7no.fsf@gnu.org> <874je6agww.fsf@web.de> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 69108 Cc: Hi-Angel@yandex.ru, 69108@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.2 (-----) > From: Michael Heerdegen > Cc: 69108@debbugs.gnu.org, Hi-Angel@yandex.ru > Date: Sat, 17 Feb 2024 23:02:07 +0100 > > Eli Zaretskii writes: > > > Thanks, but can we please leave this as 'cond', instead of converting > > it to a 'pcase'? It doesn't seem to be justified here, and even less > > so since you need to rewrite all the existing conditions. > > Oh no. > > If I don't rewrite this with `pcase', we would either artificially split > this case: > > ((or `(,test) `(_ ,test)) > (list (make-symbol "s") test)) > > into two separate `cond' branches, or we had to merge them into a one branch > like this: > > ((or (null (cdr binding)) > (eq '_ (car binding))) > (list (make-symbol "s") > (if (null (cdr binding)) > (car binding) > (cadr binding)))) > > 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. Or did I misunderstand the issues? > Please to everyone: let's avoid a new discussion about `pcase'. Please, > not again. It isn't a discussion. I'm asking you (and everyone else) to avoid using pcase where a simple cond will do, certainly when changing code that already uses cond for most of the conditions. That will both decrease the code churn, and thus minimize the probability of inadvertent mistakes, and make the code easier to read for some. > > > [My doc tweaks] > > This hunk seems to be unrelated? > > Yes, I can make it a separate commit it drop it entirely if you prefer. If it's unrelated, then yes, I'd prefer to separate it. > > And it is not necessarily for the better, IMO, at least not all of it > > (replaces active tense with passive, refills text that doesn't need > > refilling, and other minor issues, > > I can try to improve that of course. > > > like the confusing use of construct state in "last ELSE form"). > > Dunno what a "construct state" is. https://en.wikipedia.org/wiki/Construct_state It has to do with juxtaposition of several nouns to express genitive. In this case I meant the replacement of "last form in ELSE" with "the last ELSE form", which is more confusing, because it isn't clear whether "last" refers to "ELSE" or to "form". > The doc missed to tell what `if-let' returns when optional ELSE > forms are omitted (which is allowed, and then there is no last ELSE > form return value), so I tried to add that. Did I mess up the > grammar? The grammar might be okay, but "last form in ELSE" is still better, and your rewording lacks crucial punctuation which could have helped interpreting the text correctly. For example, there should be a comma before "or nil if there are none". From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 19 07:34:27 2024 Received: (at 69108) by debbugs.gnu.org; 19 Feb 2024 12:34:27 +0000 Received: from localhost ([127.0.0.1]:40578 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rc2qp-0001FD-7w for submit@debbugs.gnu.org; Mon, 19 Feb 2024 07:34:27 -0500 Received: from mout02.posteo.de ([185.67.36.66]:35551) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rc2qm-0001Ey-8i for 69108@debbugs.gnu.org; Mon, 19 Feb 2024 07:34:26 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 34A83240103 for <69108@debbugs.gnu.org>; Mon, 19 Feb 2024 13:33:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1708346037; bh=yLCU6jSadTchhXwYr9tFZRcvRy93L7ZRan2ZVXpvw60=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=OEeVGA5I8aZjul2uPShTLjIavPU6UnnwL8v3N7z47jFMB2WPAUwfGDd7Yv+d2fGwS pf9hK8eIPl4WXCSVJZHGfMLWpGX87xOSp4C+y2x78m6NqtZshUT6rkWewGId9EeQ46 dwrbJo8bQIRBCYa8SSLotUtl+JEobULd8pShYNgWP3Y/nQ5/duoh7rU5IIx7Z3dEDR 5OWMzPCMR3llrSClHrWTytpHiBFpL6cWlTQzaMdFP4roU0v/gr2RkVQFly3ppjyyN9 Q59N/NYOqQ2VfeorzJYqYr1Sf6XJlefGk+cfvfCG190c5T80wTi8Wtzi+eo75uGiGz fXPMejb/Mh2SQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TdhmN3Vdfz9rxF; Mon, 19 Feb 2024 13:33:56 +0100 (CET) From: Ihor Radchenko To: Konstantin Kharlamov Subject: Re: bug#69108: false-positive warning "variable =?utf-8?B?4oCY?= =?utf-8?B?X+KAmQ==?= not left unused" in if-let* and if-let In-Reply-To: References: <87il2ryi30.fsf@web.de> <87mss09bnc.fsf@web.de> <86eddbv7no.fsf@gnu.org> <78798be7b3bc7a7bb477d4ec952734b199588d00.camel@yandex.ru> <878r3jz545.fsf@localhost> Date: Mon, 19 Feb 2024 12:37:40 +0000 Message-ID: <87v86keijv.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 69108 Cc: Michael Heerdegen , Eli Zaretskii , 69108@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.2 (-----) Konstantin Kharlamov writes: > 6. Evaluate `(benchmark-run-compiled 1 (color-identifiers:elisp-get-declarations))` This is not enough. You also need to run (byte-compile #'color-identifiers:elisp-get-declarations) With this, I am getting (0.014252469 0 0.0) (0.014183416999999999 0 0.0) with pcase and (0.014351118 0 0.0) (0.014329416 0 0.0) with cond No measurable difference. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 19 08:44:54 2024 Received: (at 69108) by debbugs.gnu.org; 19 Feb 2024 13:44:54 +0000 Received: from localhost ([127.0.0.1]:40729 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rc3wz-00008z-Ps for submit@debbugs.gnu.org; Mon, 19 Feb 2024 08:44:54 -0500 Received: from forward501b.mail.yandex.net ([178.154.239.145]:50230) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rc3wt-00008j-Ug for 69108@debbugs.gnu.org; Mon, 19 Feb 2024 08:44:52 -0500 Received: from mail-nwsmtp-smtp-production-main-39.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-39.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:53a9:0:640:8a1f:0]) by forward501b.mail.yandex.net (Yandex) with ESMTPS id BE1666101A; Mon, 19 Feb 2024 16:44:23 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-39.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id MiQMTmOPjmI0-lMyYDxzp; Mon, 19 Feb 2024 16:44:23 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1708350263; bh=FmHn9JN7nWmjF3p+WL8jcHpfsSVwbLx5y2FeFs1xnc0=; h=References:Date:In-Reply-To:Cc:To:From:Subject:Message-ID; b=AeVjtQ7BN6UnBKabQ5NNB8AgWxgvEGZcfKvmVefnyWX04bZ083frkOrZZSxovSW90 xjv61QS8LBXKzfHDX/JSt+4/57eDXjRqiLt3KorkeZtYTISS1V61cJo3hrkg6uiBZ5 Bkp/eUu4FBtpslxYPgTG+1c/7VmEtczUs59ZW0p0= Authentication-Results: mail-nwsmtp-smtp-production-main-39.myt.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: <508a0205d8a0242ef3385f54722587e99f9a5ffd.camel@yandex.ru> Subject: Re: 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 From: Konstantin Kharlamov To: Ihor Radchenko Date: Mon, 19 Feb 2024 16:44:22 +0300 In-Reply-To: <87v86keijv.fsf@localhost> References: <87il2ryi30.fsf@web.de> <87mss09bnc.fsf@web.de> <86eddbv7no.fsf@gnu.org> <78798be7b3bc7a7bb477d4ec952734b199588d00.camel@yandex.ru> <878r3jz545.fsf@localhost> <87v86keijv.fsf@localhost> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.3 MIME-Version: 1.0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 69108 Cc: Michael Heerdegen , Eli Zaretskii , 69108@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.9 (--) You were right after all =F0=9F=98=8A I confirm your findings, thank you fo= r explanation! On Mon, 2024-02-19 at 12:37 +0000, Ihor Radchenko wrote: > Konstantin Kharlamov writes: >=20 > > 6. Evaluate `(benchmark-run-compiled 1 (color-identifiers:elisp- > > get-declarations))` >=20 > This is not enough. You also need to run > (byte-compile #'color-identifiers:elisp-get-declarations) >=20 > With this, I am getting >=20 > (0.014252469 0 0.0) > (0.014183416999999999 0 0.0) > with pcase >=20 > and >=20 > (0.014351118 0 0.0) > (0.014329416 0 0.0) > with cond >=20 > No measurable difference. >=20 From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 24 20:54:14 2024 Received: (at 69108) by debbugs.gnu.org; 25 Feb 2024 01:54:14 +0000 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 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 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 From: Michael Heerdegen To: Eli Zaretskii Subject: Re: bug#69108: false-positive warning "variable =?utf-8?B?4oCY?= =?utf-8?B?X+KAmQ==?= not left unused" in if-let* and if-let In-Reply-To: <86o7ces1ou.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 18 Feb 2024 08:53:37 +0200") References: <87il2ryi30.fsf@web.de> <87mss09bnc.fsf@web.de> <86eddbv7no.fsf@gnu.org> <874je6agww.fsf@web.de> <86o7ces1ou.fsf@gnu.org> Date: Sun, 25 Feb 2024 02:54:04 +0100 Message-ID: <87a5npux4z.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Provags-ID: V03:K1:P871b/BbkS8EOz8Q4I2iR5Vg7oQbEBEM6ZAddJQjwPkFP7DcXyM gnEOU15D0UHc/dYyGlX14bDlV/FWQJUN/vpJmahWxa4xVcAzPfDQ1gQ8D3E3i158dKHkwYX 6Z5cuR74FQl2btX5TLlrzH3pm6m5IAe7U7seGK291FvEWk0YzcZYPcx4CouisMSebaxHSvX UYeig9wJCFFSNET3jbNIw== X-Spam-Flag: NO 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/piWiKQtYPvzk gPZydrQdh55tuDdLK0mM4som1n8S1g3JB8dzDCD+NYmmE= X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 69108 Cc: Hi-Angel@yandex.ru, 69108@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= 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. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 25 02:59:16 2024 Received: (at 69108-done) by debbugs.gnu.org; 25 Feb 2024 07:59:16 +0000 Received: from localhost ([127.0.0.1]:51615 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1re9Pl-0001jZ-0n for submit@debbugs.gnu.org; Sun, 25 Feb 2024 02:59:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57260) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1re9Pi-0001jC-NQ for 69108-done@debbugs.gnu.org; Sun, 25 Feb 2024 02:59:11 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1re99I-0003ay-31; Sun, 25 Feb 2024 02:42:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=rsH480Dkv5S6l1+k1lL6MTkShK6m8JFkh91YQA4tfYs=; b=BS8JlA6/OTF14e4gwWHu gtG4mx4IsQgCWukgPNyWDp7x9894VJqsjtWnh7pSJA8UygYY1ZKO4mliw3yNHZXK03iCSy2neMbuZ bAOLiqxksjCeclyWcQLfAgNEthqXYowSYy3YWpLHIjO2ifquNqbdgU13iHsTVH/Lxg0EVFPtKgUnw eB3QwvV8DakrF1EPaMDPt6cpW5iu+6fG3/1UTddFbTWlh7NwOeqyzKrhYcy6q1/5Qgrj8LEOY+dwH Dy/PJC49ZCCCCVFeqLCqWUUq7u6dtI5vapndp1PN+jlLs+SePpsu2VYzVr0BUwygXSty9XQ8ZKVzV 7YLbJPgxzkAsBQ==; Date: Sun, 25 Feb 2024 09:42:07 +0200 Message-Id: <86a5npxa5s.fsf@gnu.org> From: Eli Zaretskii To: Michael Heerdegen In-Reply-To: <87a5npux4z.fsf@web.de> (message from Michael Heerdegen on Sun, 25 Feb 2024 02:54:04 +0100) Subject: Re: bug#69108: false-positive warning "variable =?utf-8?B?4oCY?= =?utf-8?B?X+KAmQ==?= not left unused" in if-let* and if-let References: <87il2ryi30.fsf@web.de> <87mss09bnc.fsf@web.de> <86eddbv7no.fsf@gnu.org> <874je6agww.fsf@web.de> <86o7ces1ou.fsf@gnu.org> <87a5npux4z.fsf@web.de> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 69108-done Cc: 69108-done@debbugs.gnu.org, Hi-Angel@yandex.ru X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Michael Heerdegen > Cc: 69108@debbugs.gnu.org, Hi-Angel@yandex.ru > Date: Sun, 25 Feb 2024 02:54:04 +0100 > > 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? Yes, thanks. > > > {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. I installed them both, thanks. Closing the bug. From unknown Tue Aug 19 05:08:33 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 24 Mar 2024 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator