From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 29 19:38:44 2024 Received: (at submit) by debbugs.gnu.org; 30 Nov 2024 00:38:44 +0000 Received: from localhost ([127.0.0.1]:44842 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHBVU-00031o-66 for submit@debbugs.gnu.org; Fri, 29 Nov 2024 19:38:44 -0500 Received: from lists.gnu.org ([209.51.188.17]:42322) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHBVQ-00031b-OC for submit@debbugs.gnu.org; Fri, 29 Nov 2024 19:38:41 -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 1tHBVP-0001EK-Uf for bug-gnu-emacs@gnu.org; Fri, 29 Nov 2024 19:38:40 -0500 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tHBVN-0002qI-8R for bug-gnu-emacs@gnu.org; Fri, 29 Nov 2024 19:38:38 -0500 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-724e5fb3f9dso2114591b3a.3 for ; Fri, 29 Nov 2024 16:38:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732927114; x=1733531914; darn=gnu.org; h=to:date:message-id:subject:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=vWsrzbvO+sWW7ro6dJ8gduU55XBvEI8Wbz/L8S8ZDKE=; b=NNyWh53/lkbbd/u8MEL1IJa9DyIFNQYQvAbeThWAmXRRSfWNTJQLC70RkGVi7Q9BCH RTWBIzWfIYPvqPX7z4CMitCd3/7Z1lOv9nfIJZGdiyzNUXqm7+JYh2xE/52TIRlfos+7 IbbITQYKB9wtLDtPIlgxwN4HIOGz/BkwLJxUhC8qmnpsXXxSMYo1mEKeJa5+j7RMc+Mv gm+Y/vuHnXt6c8tqLAzmLNjslce0XsyeI3LDJ5eIDOg2bG/pyB3j5L0aYPmtF+d+KkI7 IjkAFWy4pw9CrX0hm5y1SS4zSWX2a8PTZk/N4XO8Ct8Dm0drQetf1+RefshxV7hZKqh+ zJqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732927114; x=1733531914; h=to:date:message-id:subject:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=vWsrzbvO+sWW7ro6dJ8gduU55XBvEI8Wbz/L8S8ZDKE=; b=rJCmgmLVE3oTRCE+Jdj43AHlB0cPJ7JkUiNzsyN8/tX4kA8VcDb7esMelfs2GL6GHp dM2ACdmUe+Vqmk9Ua2ZHLe34BQogZ6k0MEhMF+UqvLTZeQ/aAqBYGCrmrIKYTJCM2ytL Qzz8EoYBWrGPaOFG7/6UXKmuEYExX0GIjPbRAz6cswEYgwBZ+5CH6yYFgJKhbCD6WmRg rk7bSRCQ5M0bzX7OEo9/eUVUYBkg7ZVSVSFX6q7Pb5J3Fwv0/erk83huwnhF5hriO3xX tH/J/LOn3JSZNj8LndcVmJiel/0bAJA/b/XIdy/pIZYYLY9LVUktIUZVvLZpSQQFv4Gj KLvg== X-Gm-Message-State: AOJu0Ywyg9DZyZG0cEBUWDVPDEG1Mhce7ynIua98sN/tgn/lHzIZnYmS jnYyTH07BqnjBhIPKhRw1dnEeN3OLbMUhdKOjbUwkYc1so0ltlNDnYEXjA== X-Gm-Gg: ASbGncvL95D07AkYxlyFZifS+XsGOv+tZf+0dAchUaeGtSOOU33mvxxiGOo20BRi3nl SQ79rYs0//y/+extlFe2ByN7kYyZxWvVzpeqCdAp/htfC+ZsBdbucmO/nddfzEfaObhlBrvqth/ +9l4dw9B9EiDeIZQgiE4Po+hKs2oBveNAyAS7zYAQrUOR9Th/G1B6br6SNibJ80IYdM3eRxmIGk owuu8fxr7JFcnTLK2akgg1CzibRM4l4ExONFcT47V31Fkhs20+1ovwtW6oCH63O9G2+i1o0xQ== X-Google-Smtp-Source: AGHT+IGUaQ+lf82nTDrJMCJAxmirVPyaB6N9aloq87F1CMOQFWd/yPMToonVr4GB7u3uQTFi2iezeA== X-Received: by 2002:a05:6a00:809:b0:724:680d:d12c with SMTP id d2e1a72fcca58-72530060ccamr15959303b3a.12.1732927114381; Fri, 29 Nov 2024 16:38:34 -0800 (PST) Received: from smtpclient.apple ([2601:646:8f81:6120:71b7:718f:7faa:8436]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7254176fc40sm4066872b3a.71.2024.11.29.16.38.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Nov 2024 16:38:33 -0800 (PST) From: Yuan Fu Content-Type: multipart/mixed; boundary="Apple-Mail=_0CC2C434-50BB-4694-8B1E-30BCE70C4125" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Subject: 30.0.90; [PATCH] Allow passing nil to treesit-node-match-p Message-Id: <2D3B1979-C9A2-4843-8F64-DC26FA42EE25@gmail.com> Date: Fri, 29 Nov 2024 16:38:22 -0800 To: Bug Report Emacs X-Mailer: Apple Mail (2.3776.700.51) Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=casouri@gmail.com; helo=mail-pf1-x42a.google.com 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) 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 (--) --Apple-Mail=_0CC2C434-50BB-4694-8B1E-30BCE70C4125 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Eli, are you ok with this patch on emacs-30? Almost all tree-sitter node = functions allows user to pass nil for NODE, so treesit-node-match-p = should too. Yuan --Apple-Mail=_0CC2C434-50BB-4694-8B1E-30BCE70C4125 Content-Disposition: attachment; filename=treesit-node-match-p.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="treesit-node-match-p.patch" Content-Transfer-Encoding: quoted-printable =46rom=209ab20d03e30e46e2b8502877de68eec0b511d3da=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Yuan=20Fu=20=0ADate:=20Fri,=20= 29=20Nov=202024=2016:33:28=20-0800=0ASubject:=20[PATCH]=20Allow=20= passing=20nil=20to=20treesit-node-match-p=0A=0A*=20src/treesit.c=20= (Ftreesit_node_match_p):=20Return=20nil=20if=20NODE=20is=20nil.=0A---=0A=20= src/treesit.c=20|=205=20++++-=0A=201=20file=20changed,=204=20= insertions(+),=201=20deletion(-)=0A=0Adiff=20--git=20a/src/treesit.c=20= b/src/treesit.c=0Aindex=204031d80f7c9..cda6d4af2ee=20100644=0A---=20= a/src/treesit.c=0A+++=20b/src/treesit.c=0A@@=20-4017,7=20+4017,8=20@@=20= DEFUN=20("treesit-node-match-p",=0A=20`treesit-thing-settings',=20or=20a=20= predicate,=20like=20regexp=20matching=20node=0A=20type,=20etc.=20=20See=20= `treesit-thing-settings'=20for=20more=20details.=0A=20=0A-Return=20= non-nil=20if=20NODE=20matches=20PREDICATE,=20nil=20otherwise.=0A+Return=20= non-nil=20if=20NODE=20matches=20PREDICATE,=20nil=20otherwise.=20=20If=20= NODE=20is=0A+nil,=20return=20nil.=0A=20=0A=20Signals=20= `treesit-invalid-predicate'=20if=20there's=20no=20definition=20of=20= THING=0A=20in=20`treesit-thing-settings',=20or=20if=20PREDICATE=20is=20= malformed.=20=20If=0A@@=20-4025,6=20+4026,8=20@@=20DEFUN=20= ("treesit-node-match-p",=0A=20definition,=20but=20still=20signal=20for=20= malformed=20PREDICATE.=20=20*/)=0A=20=20=20(Lisp_Object=20node,=20= Lisp_Object=20predicate,=20Lisp_Object=20ignore_missing)=0A=20{=0A+=20=20= if=20(NILP=20(node))=20return=20Qnil;=0A+=0A=20=20=20CHECK_TS_NODE=20= (node);=0A=20=0A=20=20=20Lisp_Object=20parser=20=3D=20XTS_NODE=20= (node)->parser;=0A--=20=0A2.39.5=20(Apple=20Git-151)=0A=0A= --Apple-Mail=_0CC2C434-50BB-4694-8B1E-30BCE70C4125-- From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 30 02:22:40 2024 Received: (at 74612) by debbugs.gnu.org; 30 Nov 2024 07:22:40 +0000 Received: from localhost ([127.0.0.1]:45234 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHHoO-0007K6-1E for submit@debbugs.gnu.org; Sat, 30 Nov 2024 02:22:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52068) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHHoL-0007Jj-IW for 74612@debbugs.gnu.org; Sat, 30 Nov 2024 02:22:38 -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 1tHHoD-0005Sy-R0; Sat, 30 Nov 2024 02:22:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=J/T6H0fA8/Hia6JFSm7qm+YA8jv0aRDXjyqywwlMZts=; b=Mdnf9rbWdqYo ah0b4BhNVdJmxCBRhX61pe/K6Mr51gg1tCuSKiqSqxp6PdCFUfMxKkcJovAjkvSF5eMnVwWuY86OL kqa2MZHwHYFU2I0F/nQgVPLGpaq2CBOXmqgK5XHh7T0QmoNwSuNJIin2bj3C+dFfNUrQ1E9fHuvs1 YIY59YlKAPs6MOXaE2FscXJTH/Y2F6tsCufQaCbwPCjQqg4Ns8l1JBntzVrhJ/taDn3UvhZYSL5lU HidqvZp0JuZ2eC7aOCyRNKBgiLC6WfmTOwSdEz7gin+xtexxbmzMnPx62PpY5bhFTF3f1VPkUc0Jo K3LQK750twphcCwojs1Xww==; Date: Sat, 30 Nov 2024 09:22:28 +0200 Message-Id: <867c8lb2yz.fsf@gnu.org> From: Eli Zaretskii To: Yuan Fu In-Reply-To: <2D3B1979-C9A2-4843-8F64-DC26FA42EE25@gmail.com> (message from Yuan Fu on Fri, 29 Nov 2024 16:38:22 -0800) Subject: Re: bug#74612: 30.0.90; [PATCH] Allow passing nil to treesit-node-match-p References: <2D3B1979-C9A2-4843-8F64-DC26FA42EE25@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74612 Cc: 74612@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.3 (---) > From: Yuan Fu > Date: Fri, 29 Nov 2024 16:38:22 -0800 > > Eli, are you ok with this patch on emacs-30? Almost all tree-sitter node functions allows user to pass nil for NODE, so treesit-node-match-p should too. Does this solve an actual problem you've seen somewhere (and if so, which problem), or does it solve a potential problem that didn't actually happen yet? Also, does CHECK_TS_NODE allow nil or does it currently signal an error? From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 01 03:32:22 2024 Received: (at 74612) by debbugs.gnu.org; 1 Dec 2024 08:32:22 +0000 Received: from localhost ([127.0.0.1]:50223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHfNO-0002sK-60 for submit@debbugs.gnu.org; Sun, 01 Dec 2024 03:32:22 -0500 Received: from mail-pf1-f178.google.com ([209.85.210.178]:50374) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHfNL-0002sB-7K for 74612@debbugs.gnu.org; Sun, 01 Dec 2024 03:32:19 -0500 Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-724d8422dbaso2685608b3a.0 for <74612@debbugs.gnu.org>; Sun, 01 Dec 2024 00:32:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733041878; x=1733646678; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=oMon2F8HWpcTEIVYM3Cl4cdG1tmj/aZGbeS1fxoFkgY=; b=X0oPoFYh3ErK4gkT+KGvYq/bJae8Lq6aIkxTrBGC22jYc58K+Vz4jzpci4YyM+W8LL 3g1WFU0OglYQj8lEHL9Y6A8UlbiksZk4LjZNxcdPR4AmXvXk9O8VR2iZF/uRCJ3qAGix P0TaxRFAIovfsuRF/yyAKCDu1eMfQm1JPpAjBsgD3yn0E3VotVTt3NNNBDejQetISMwv FmITOtmNdtR1D7oP95wqUYp2wNWlXdv2ZgCd3WzPyErUmTTAZvlauqHduwNkwfX/1xGd fYp4O6pH9QjT8MLSYR6Qq6AW8f1Y4uJikYYcipKprgXjj6avkKYUD5y55+TqjIHITBbk 3urQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733041878; x=1733646678; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oMon2F8HWpcTEIVYM3Cl4cdG1tmj/aZGbeS1fxoFkgY=; b=h2TwYDmwdsfwV+hbUS3GRztl0cfk0xUUz/rKzGp9TA24O5Y18JuVWEvwwKrOJ6ly21 WnemMeh0dY05OYx9sQdQDIqRyYb+Py/fGlEs2jYb5IIvLdddey9y42chKqu3wY+FPP7H 1sQvAthsAz5W1ZCKqSt/AS4QINCVz2bWNoqTXM4/K1Cu7IbOI2EL8p9awNCJg61pLoJg bczZAjrXYYy70cVh+Lf1hrACgREUkQ1Gu4e6qnXCro64dh36K8gvPLoiJTFACF0divxj tguNJd6NUHX9JVF4eHVzB5EFVdrINNgW+2otYXXTL2VxIywuukzwaiYOFCB8xdkNH3IC C0gA== X-Gm-Message-State: AOJu0YxAaTfm9jxOwGZsRqjwZcGC6suogFH0/0Be7ZVdeTiUaFpu2Iji CBPZJZMYQuD60QBr9n1cyjbLtG6cYkKqtkzqFZrxZwWuikNkBWC3bVm00Q== X-Gm-Gg: ASbGncscixpFStz18Jvhm9EBJe10juIAMrI3bwj7zpYss1+Sx2tYiN74ZQHdqutuVNh w9gI88OZQ7YA1CQ5eF3SNwa3R2T1YcYNYh+V8YZUX0VaKjMkaVzlDirVjW0cHUP628Y+vSptBZ/ tv2gAIXXMeL1wMe+apOIfzzaKh/H+KKJegRYZ5KM38iIXI/GDIU5gSQ11I2bEr+mdoumzvHjJxV m5lqJE6tmywQLPaXEyuHtPID9lyuKCTGn+7+/tXrOW4pBkXx7iOZ13YGSQbd7OBaW0JkOSlDA== X-Google-Smtp-Source: AGHT+IHVRzhK1W1fArMKGM8jyBrdl6oAbM98kiEpaaeclEIvK3+TLv21oPcqP9QlvUt7BbPeKFtIpw== X-Received: by 2002:a17:902:e84e:b0:215:77f8:6c1e with SMTP id d9443c01a7336-21577f86fa4mr33477235ad.41.1733041878527; Sun, 01 Dec 2024 00:31:18 -0800 (PST) Received: from smtpclient.apple ([2601:646:8f81:6120:71b7:718f:7faa:8436]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21521906159sm56211125ad.84.2024.12.01.00.31.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Dec 2024 00:31:17 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Subject: Re: bug#74612: 30.0.90; [PATCH] Allow passing nil to treesit-node-match-p From: Yuan Fu In-Reply-To: <867c8lb2yz.fsf@gnu.org> Date: Sun, 1 Dec 2024 00:31:05 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <6FD7EC70-CA0B-46CE-9829-B33B4D38523B@gmail.com> References: <2D3B1979-C9A2-4843-8F64-DC26FA42EE25@gmail.com> <867c8lb2yz.fsf@gnu.org> To: Eli Zaretskii X-Mailer: Apple Mail (2.3776.700.51) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74612 Cc: 74612@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 (-) > On Nov 29, 2024, at 11:22=E2=80=AFPM, Eli Zaretskii = wrote: >=20 >> From: Yuan Fu >> Date: Fri, 29 Nov 2024 16:38:22 -0800 >>=20 >> Eli, are you ok with this patch on emacs-30? Almost all tree-sitter = node functions allows user to pass nil for NODE, so treesit-node-match-p = should too. >=20 > Does this solve an actual problem you've seen somewhere (and if so, > which problem), or does it solve a potential problem that didn't > actually happen yet? I encountered this problem (more like an inconvenience, since without = this feature I=E2=80=99d need to test for nullness before passing a node = to treesit-node-match-p) when using treesit-node-match-p for some new = code I=E2=80=99m writing for master branch. Since (treesit-node-match-p = node =E2=80=9Ctype name=E2=80=9D) is easier to write and shorter than = (equal (treesit-node-type node) =E2=80=9Ctype name=E2=80=9D) or = (string-match-p =E2=80=9Ctype name regex=E2=80=9D (treesit-node-type = node)), I=E2=80=99ve been using it liberally in new code :) >=20 > Also, does CHECK_TS_NODE allow nil or does it currently signal an > error? CHECK_TS_NODE currently signals an error. All the tree-sitter node = functions that accepts nil has the "if (NILP (node)) return Qnil=E2=80=9D = line before CHECK_TS_NODE (or treesit_check_node) If you=E2=80=99re not too comfortable with the change, we can apply it = to master. It wouldn=E2=80=99t create any backward-incompatibility since = this change makes treesit-node-match-p more lenient on its argument, not = stricter. The drawback is treesit-node-match-p will be a bit more = annoying to use. Yuan From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 01 05:00:10 2024 Received: (at 74612) by debbugs.gnu.org; 1 Dec 2024 10:00:10 +0000 Received: from localhost ([127.0.0.1]:50331 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHgkL-0007G9-UL for submit@debbugs.gnu.org; Sun, 01 Dec 2024 05:00:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47308) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHgkJ-0007AI-Jd for 74612@debbugs.gnu.org; Sun, 01 Dec 2024 05:00:08 -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 1tHgkE-0001p0-7T; Sun, 01 Dec 2024 05:00:02 -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=zsn8oBeq3rFZt/ydC/Mn1JgX95gGiijhm06+9KyJ6j4=; b=EgxDVOzPHnx165VSoWwF ssIqCdOUEnYXAmBpO/ihRzUcIS4gGXQADHr7m3cNllbUTXilY95IJzxfjh32ZAk95t2OsleOj/xym OSeZErdrpbK+4PlYs4YF8GAqANBmel2hgUXt4KOawoNSz5lNVAYM9hwGw3wDXwQGfe5MJtuyj0np/ UNT7+yDln2QfSxk2llRSwPuTjp6rxWG4jCw4z6V3a+Q3KRUMTHPSK/XM4XVHJ5oiFnB1CbOawel/S gEM172jG75sbtBGt+fsMn9CmzqaF4mtFpBWsLD/egzVhxgluF/6YrhCK7J37BKV9iQ1tvcWWu3fne UtUBzmAfUxFnoA==; Date: Sun, 01 Dec 2024 11:59:58 +0200 Message-Id: <86ed2r67vl.fsf@gnu.org> From: Eli Zaretskii To: Yuan Fu In-Reply-To: <6FD7EC70-CA0B-46CE-9829-B33B4D38523B@gmail.com> (message from Yuan Fu on Sun, 1 Dec 2024 00:31:05 -0800) Subject: Re: bug#74612: 30.0.90; [PATCH] Allow passing nil to treesit-node-match-p References: <2D3B1979-C9A2-4843-8F64-DC26FA42EE25@gmail.com> <867c8lb2yz.fsf@gnu.org> <6FD7EC70-CA0B-46CE-9829-B33B4D38523B@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74612 Cc: 74612@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.3 (---) > From: Yuan Fu > Date: Sun, 1 Dec 2024 00:31:05 -0800 > Cc: 74612@debbugs.gnu.org > > > > > On Nov 29, 2024, at 11:22 PM, Eli Zaretskii wrote: > > > >> From: Yuan Fu > >> Date: Fri, 29 Nov 2024 16:38:22 -0800 > >> > >> Eli, are you ok with this patch on emacs-30? Almost all tree-sitter node functions allows user to pass nil for NODE, so treesit-node-match-p should too. > > > > Does this solve an actual problem you've seen somewhere (and if so, > > which problem), or does it solve a potential problem that didn't > > actually happen yet? > > I encountered this problem (more like an inconvenience, since without this feature I’d need to test for nullness before passing a node to treesit-node-match-p) when using treesit-node-match-p for some new code I’m writing for master branch. Since (treesit-node-match-p node “type name”) is easier to write and shorter than (equal (treesit-node-type node) “type name”) or (string-match-p “type name regex” (treesit-node-type node)), I’ve been using it liberally in new code :) > > > > > Also, does CHECK_TS_NODE allow nil or does it currently signal an > > error? > > CHECK_TS_NODE currently signals an error. All the tree-sitter node functions that accepts nil has the "if (NILP (node)) return Qnil” line before CHECK_TS_NODE (or treesit_check_node) > > If you’re not too comfortable with the change, we can apply it to master. It wouldn’t create any backward-incompatibility since this change makes treesit-node-match-p more lenient on its argument, not stricter. The drawback is treesit-node-match-p will be a bit more annoying to use. OK, please install on emacs-30, and thanks. From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 05 04:44:39 2024 Received: (at 74612-done) by debbugs.gnu.org; 5 Dec 2024 09:44:39 +0000 Received: from localhost ([127.0.0.1]:38312 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJ8PX-0002np-6h for submit@debbugs.gnu.org; Thu, 05 Dec 2024 04:44:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60410) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJ8PU-0002nZ-Bh for 74612-done@debbugs.gnu.org; Thu, 05 Dec 2024 04:44:37 -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 1tJ8PP-0006Yw-3n; Thu, 05 Dec 2024 04:44:31 -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=0g+et7N8m/DCTVWYUaPKXCLzlE4OhZaOWnH1210mYxQ=; b=mHE3noeK4mvrjVfYKkcS hexoT7jFqtaekc3ah+Lq1OgLQZNUrZa/b6dgLUFB73kHCdpyK9AeAKCj5vLhAPo2pnPSFxjmVuHm9 +LI/Dv0UfHZB6UuA2qvn8cipWIq5oxWPwQ4AVcJeCqyyZBmDznP8NG96fkQ9IDOd2DENVfT4GAm0X NVZatfWFRXt6pCAZuUvQo74szZYMKAVEe3zbWl55RpFzW1kJ7ecJ9ch4czhkIDfkizmOepLLsmxbR J+dou05MZGTYPmSsgWimqegaL2eCugdS/M+eeP7ZGlX2A0WXRaUsz3zzABL3IXw/GlGeOfmwpSG6X c5ndEBql55I4ug==; Date: Thu, 05 Dec 2024 11:43:58 +0200 Message-Id: <868qsuxy5d.fsf@gnu.org> From: Eli Zaretskii To: casouri@gmail.com In-Reply-To: <86ed2r67vl.fsf@gnu.org> (message from Eli Zaretskii on Sun, 01 Dec 2024 11:59:58 +0200) Subject: Re: bug#74612: 30.0.90; [PATCH] Allow passing nil to treesit-node-match-p References: <2D3B1979-C9A2-4843-8F64-DC26FA42EE25@gmail.com> <867c8lb2yz.fsf@gnu.org> <6FD7EC70-CA0B-46CE-9829-B33B4D38523B@gmail.com> <86ed2r67vl.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74612-done Cc: 74612-done@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.3 (---) > Cc: 74612@debbugs.gnu.org > Date: Sun, 01 Dec 2024 11:59:58 +0200 > From: Eli Zaretskii > > > From: Yuan Fu > > Date: Sun, 1 Dec 2024 00:31:05 -0800 > > Cc: 74612@debbugs.gnu.org > > > > > > > > > On Nov 29, 2024, at 11:22 PM, Eli Zaretskii wrote: > > > > > >> From: Yuan Fu > > >> Date: Fri, 29 Nov 2024 16:38:22 -0800 > > >> > > >> Eli, are you ok with this patch on emacs-30? Almost all tree-sitter node functions allows user to pass nil for NODE, so treesit-node-match-p should too. > > > > > > Does this solve an actual problem you've seen somewhere (and if so, > > > which problem), or does it solve a potential problem that didn't > > > actually happen yet? > > > > I encountered this problem (more like an inconvenience, since without this feature I’d need to test for nullness before passing a node to treesit-node-match-p) when using treesit-node-match-p for some new code I’m writing for master branch. Since (treesit-node-match-p node “type name”) is easier to write and shorter than (equal (treesit-node-type node) “type name”) or (string-match-p “type name regex” (treesit-node-type node)), I’ve been using it liberally in new code :) > > > > > > > > Also, does CHECK_TS_NODE allow nil or does it currently signal an > > > error? > > > > CHECK_TS_NODE currently signals an error. All the tree-sitter node functions that accepts nil has the "if (NILP (node)) return Qnil” line before CHECK_TS_NODE (or treesit_check_node) > > > > If you’re not too comfortable with the change, we can apply it to master. It wouldn’t create any backward-incompatibility since this change makes treesit-node-match-p more lenient on its argument, not stricter. The drawback is treesit-node-match-p will be a bit more annoying to use. > > OK, please install on emacs-30, and thanks. I see you did, so I'm closing this bug. From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 06 02:25:46 2024 Received: (at 74612-done) by debbugs.gnu.org; 6 Dec 2024 07:25:46 +0000 Received: from localhost ([127.0.0.1]:41853 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJSif-0008EX-Jh for submit@debbugs.gnu.org; Fri, 06 Dec 2024 02:25:45 -0500 Received: from mail-pl1-f171.google.com ([209.85.214.171]:55498) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJSid-0008EH-E8 for 74612-done@debbugs.gnu.org; Fri, 06 Dec 2024 02:25:44 -0500 Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-21568166415so13805655ad.2 for <74612-done@debbugs.gnu.org>; Thu, 05 Dec 2024 23:25:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733469877; x=1734074677; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=HXZbBRSI9br8KZbO/oZB2HfDYtQQvMDKpMqksqmBOrg=; b=aK0yd9QhH6YXh4jLghZC9dwa0ATE3jYjukktAR2dHIQn/lG8h4ohMEYf26Go/LVx1m fU6Xbsb1St3bCL9t88MdpeuwWE1avzP0IVvQC8IZP3MagXJI6qoEcHM1r6QVJdGvtn6e XN70Kb3ADzEqqmc5TKm9k0uvuSkdOKF2BZPEE30saDLNHvwxaAfpPE/NzI7WxPPjaW4I EVQgOvZDUvmOKrx8rbSRDwd8tVd3MYX//JK8Qu1kNjSf+91DLJ7HvF+veB/RdVaOAJiU ed479vpmmhtY/USU8EpbLli356R735Klb4hU7+4WqbPEkpa97vG2BOmHfp0VlOsScxf6 pdnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733469877; x=1734074677; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HXZbBRSI9br8KZbO/oZB2HfDYtQQvMDKpMqksqmBOrg=; b=YeGOVGaVowDaAG9+2kGfH2/GwXNIFqHYKSG5vAfUaWbXUdHhduznCx4IQBHRB5ohjF 7i4pozcxDLL3CmtqJjMvaHFqYCYBED2IHPIv54jdon1cIKVJrbbmynXEotI8dT0M1Tp2 Cp9seDl1eEvzGKZjWKjDAkvsIQoc4PPWgw0CTcNzQMEWFzn7ekhlgS1mmm54D8Ncso2U g1hpcSllFeDpHjsHxUnQ6kApM37LmouchAibdvYUbmnKaI0RqNwiUxXTqGoQ1qx6Ynci U4t4WvQ4dIi+RrTGvmMGe7UuPmwwSn3KZLle2Cqy4fRwcpX+GDHC97seO1yMj+YDFBv1 kd0Q== X-Gm-Message-State: AOJu0YxjhfZwbzZh8WSvP+BnGQBAmxQ/KEQIzqvqDGIukhxzNmtwr48e IE6uGpFVtH3r+JExBwi+ORi/0MW6dKwxHo9L/2uCcoPcOqodAtiM X-Gm-Gg: ASbGnct1km70aHXbZ3WEk2OSX7kHFYFJdago2HV55lpcshV9Ubuu0LTcLtftRW2jXfi LAg+uWS5gk1OPL5QV/24sMppIDLXCUpLF/7lloJebvsHPQyiD5KpNdHjPZg9oOLn3FDVElEf1X9 o5Pmnvju8QUO59VXeNm0ZgGMxDa2pZinkS8sWdBFtq9F7prj1EILTkNUtCoauPk1pwX6y0GBEHj BudcwbMOXWbHxDJ3ma+eGXbzSbqVhz3ecM1nVTbjuGyJaA3ZbY7xowau52i+TaO4pV/t8FqjA== X-Google-Smtp-Source: AGHT+IGK9fhp3CBVNqgP6srA3cqkhg9R4djX2E52NAeNyie8HPqMb3D1WB+LSZQpubZBOanFAmEz8g== X-Received: by 2002:a17:903:228c:b0:212:615f:c1 with SMTP id d9443c01a7336-21614d354e0mr29430125ad.14.1733469877499; Thu, 05 Dec 2024 23:24:37 -0800 (PST) Received: from smtpclient.apple ([2601:646:8f81:6120:d59e:a328:96f3:f483]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-215f8e5f2d6sm23046895ad.71.2024.12.05.23.24.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Dec 2024 23:24:36 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Subject: Re: bug#74612: 30.0.90; [PATCH] Allow passing nil to treesit-node-match-p From: Yuan Fu In-Reply-To: <868qsuxy5d.fsf@gnu.org> Date: Thu, 5 Dec 2024 23:24:25 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: References: <2D3B1979-C9A2-4843-8F64-DC26FA42EE25@gmail.com> <867c8lb2yz.fsf@gnu.org> <6FD7EC70-CA0B-46CE-9829-B33B4D38523B@gmail.com> <86ed2r67vl.fsf@gnu.org> <868qsuxy5d.fsf@gnu.org> To: Eli Zaretskii X-Mailer: Apple Mail (2.3776.700.51) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74612-done Cc: 74612-done@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 (-) > On Dec 5, 2024, at 1:43=E2=80=AFAM, Eli Zaretskii = wrote: >=20 >> Cc: 74612@debbugs.gnu.org >> Date: Sun, 01 Dec 2024 11:59:58 +0200 >> From: Eli Zaretskii >>=20 >>> From: Yuan Fu >>> Date: Sun, 1 Dec 2024 00:31:05 -0800 >>> Cc: 74612@debbugs.gnu.org >>>=20 >>>=20 >>>=20 >>>> On Nov 29, 2024, at 11:22=E2=80=AFPM, Eli Zaretskii = wrote: >>>>=20 >>>>> From: Yuan Fu >>>>> Date: Fri, 29 Nov 2024 16:38:22 -0800 >>>>>=20 >>>>> Eli, are you ok with this patch on emacs-30? Almost all = tree-sitter node functions allows user to pass nil for NODE, so = treesit-node-match-p should too. >>>>=20 >>>> Does this solve an actual problem you've seen somewhere (and if so, >>>> which problem), or does it solve a potential problem that didn't >>>> actually happen yet? >>>=20 >>> I encountered this problem (more like an inconvenience, since = without this feature I=E2=80=99d need to test for nullness before = passing a node to treesit-node-match-p) when using treesit-node-match-p = for some new code I=E2=80=99m writing for master branch. Since = (treesit-node-match-p node =E2=80=9Ctype name=E2=80=9D) is easier to = write and shorter than (equal (treesit-node-type node) =E2=80=9Ctype = name=E2=80=9D) or (string-match-p =E2=80=9Ctype name regex=E2=80=9D = (treesit-node-type node)), I=E2=80=99ve been using it liberally in new = code :) >>>=20 >>>>=20 >>>> Also, does CHECK_TS_NODE allow nil or does it currently signal an >>>> error? >>>=20 >>> CHECK_TS_NODE currently signals an error. All the tree-sitter node = functions that accepts nil has the "if (NILP (node)) return Qnil=E2=80=9D = line before CHECK_TS_NODE (or treesit_check_node) >>>=20 >>> If you=E2=80=99re not too comfortable with the change, we can apply = it to master. It wouldn=E2=80=99t create any backward-incompatibility = since this change makes treesit-node-match-p more lenient on its = argument, not stricter. The drawback is treesit-node-match-p will be a = bit more annoying to use. >>=20 >> OK, please install on emacs-30, and thanks. >=20 > I see you did, so I'm closing this bug. Thank you Eli.= From unknown Mon Jun 23 18:29:52 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 03 Jan 2025 12:24:06 +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