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 23:02:07 +0100 Message-ID: <874je6agww.fsf@web.de> References: <87il2ryi30.fsf@web.de> <87mss09bnc.fsf@web.de> <86eddbv7no.fsf@gnu.org> Reply-To: Michael Heerdegen Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36014"; 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 Sat Feb 17 23:03:06 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 1rbSm1-0009C5-LM for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Feb 2024 23:03:05 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rbSlf-0003Lb-RZ; Sat, 17 Feb 2024 17:02:43 -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 1rbSle-0003LS-Ib for bug-gnu-emacs@gnu.org; Sat, 17 Feb 2024 17:02: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 1rbSle-0004uC-7P for bug-gnu-emacs@gnu.org; Sat, 17 Feb 2024 17:02:42 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rbSlx-0005GN-VJ for bug-gnu-emacs@gnu.org; Sat, 17 Feb 2024 17:03: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 22:03: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.170820733020170 (code B ref 69108); Sat, 17 Feb 2024 22:03:01 +0000 Original-Received: (at 69108) by debbugs.gnu.org; 17 Feb 2024 22:02:10 +0000 Original-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 Original-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 Original-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 In-Reply-To: <86eddbv7no.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 17 Feb 2024 10:04:11 +0200") X-Provags-ID: V03:K1:JDOA3pa64Cv0j1oJ7XWwSDtY4Y4I3LEceAjixbu+Sk6rb1hfE3H HWG5sHYTGc4srt5jffAep+ZfHq4S+H1xuzLSc621KchkFRUEMHaaQ52OHVyT6QoBJcbUk/j axRKlY5wTJLslqn+2UiyaPUke4qI2HcRa10zinAy8kUYL9vB1Fw6iTmFQszuUF9Q+E0uVUJ A/BkVFyd4shycCsFVRjzg== 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/Xh 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:280150 Archived-At: 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.