From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#59633: 29.0.50; tree-sitter-bash: Incorrect behaviour of heredocs with expansions Date: Tue, 13 Dec 2022 20:01:31 -0800 Message-ID: <91CDE39D-4598-480D-B84B-5E3E152B15BC@gmail.com> References: <871qpocq7s.fsf@miha-pc> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17723"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59633@debbugs.gnu.org To: miha@kamnitnik.top Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 14 05:02:29 2022 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 1p5IyT-0004RS-3y for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Dec 2022 05:02:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5Iy7-0007Un-GZ; Tue, 13 Dec 2022 23:02:07 -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 1p5Iy6-0007UY-Ig for bug-gnu-emacs@gnu.org; Tue, 13 Dec 2022 23:02:06 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p5Iy2-0002Fq-Kp for bug-gnu-emacs@gnu.org; Tue, 13 Dec 2022 23:02:06 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p5Iy2-0001OT-2v for bug-gnu-emacs@gnu.org; Tue, 13 Dec 2022 23:02:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <871qpocq7s.fsf@miha-pc> Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Dec 2022 04:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59633 X-GNU-PR-Package: emacs Original-Received: via spool by 59633-submit@debbugs.gnu.org id=B59633.16709905025348 (code B ref 59633); Wed, 14 Dec 2022 04:02:02 +0000 Original-Received: (at 59633) by debbugs.gnu.org; 14 Dec 2022 04:01:42 +0000 Original-Received: from localhost ([127.0.0.1]:36437 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5Ixh-0001OC-Qx for submit@debbugs.gnu.org; Tue, 13 Dec 2022 23:01:42 -0500 Original-Received: from mail-pl1-f170.google.com ([209.85.214.170]:42962) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5Ixf-0001O6-0C for 59633@debbugs.gnu.org; Tue, 13 Dec 2022 23:01:39 -0500 Original-Received: by mail-pl1-f170.google.com with SMTP id d7so2058676pll.9 for <59633@debbugs.gnu.org>; Tue, 13 Dec 2022 20:01:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=XML92rZJYomhDah/X+zwyWP1sZHElfyYnp8C9bqqSVg=; b=bmH3KgR8jM6xJ4gZTabtMp96pVT+fJYuO2OLZ5lb6tvczWWcKdQ0VY33btD+BvCOLM FPNdSeUeckFXfu/i2jFWRnI3rUMKpVxC+YkXCEaGPI6cg+CYVocNSqyrYZZtj10fus6k K96DHdI7o4FM3cr0XfuULnJyNGUgvRcRJKORgOwczfr4A0lf8yGbBn3HykryPwSknlMD ztsCt8BUwYXBGDCnet7DeaIDfPYI7DcltOerLljsGnZqpiWxgna8wFEIHZkCERj2pkA0 Z0uDeqnz9gc+cPfqAj7HADbmVHA6dmyhmUaf8DrcDj3nFqkYi4Unamx21RHC3Dd5jK2p iIDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XML92rZJYomhDah/X+zwyWP1sZHElfyYnp8C9bqqSVg=; b=TFiYVDCmfrDkFdVijzimoY0/67AemAx3dz0v/dapQYHcnw7Z5snfw/cQO7wgHUG2ax tlWUeH6x3BP4d891bqgdHLbSYn4bd4fzBlF0gw78eZctKp1sUrkYKY4+Zrsk1ZrCFrXH pKLR9dab+M2dswAbnwFPklPJmzmbPR0zNwYBD79dB+1uBioW/DafFOeVBsOjWnHMoc2d QpepuEYQ7WGwW3ThT+xA5s3U14OkHT0pgsPTTWsY93plho/jZbybfwlom8FM637rU5nR kM+aVmFKrASSuv67k3oNdHQ7GWaoRTFzRf/ghF1vvvoBSVTKpgv5/tl0bjquQOuO12Zh EpbQ== X-Gm-Message-State: ANoB5pmh7U+Ve/P6Dp1CoDDTk/t05set6TgUcpM2C5afayfHdm+t1zoH 5yZ/dIS3ZyXbmDici5Qc9A5ZbwMkOgTIAg== X-Google-Smtp-Source: AA0mqf5gcYTN3pz6Vy4aZndZ72D1ZhCxi/XaZBMN/0ovPgHZBbxtGERUpV/vQG4nQ1fVmrh0eMIRMg== X-Received: by 2002:a17:90a:fc95:b0:218:ff8e:5d6b with SMTP id ci21-20020a17090afc9500b00218ff8e5d6bmr23375568pjb.16.1670990493025; Tue, 13 Dec 2022 20:01:33 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id e13-20020a17090a7c4d00b00218e8a0d7f0sm284571pjl.22.2022.12.13.20.01.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Dec 2022 20:01:32 -0800 (PST) X-Mailer: Apple Mail (2.3696.120.41.1.1) 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:250914 Archived-At: Yuan Fu writes: > writes: > >> Yuan Fu writes: >> >>> What=E2=80=99s the return value of (treesit-node-at (point)) at that = point? >>> Probably the command_substitution node, and since it doesn=E2=80=99t = have any >>> children, treesit-node-first-child-for-pos would return nil. >> >> (treesit-node-at (point) 'bash) >> =3D> # >> >> I forgot to say that point is before "text2", outside of the >> command_substitution node. >> >>> Yuan >> >> tee << EOF >> text1 $var >> text2 $(echo cmd) >> text3 >> $var2 >> EOF >> >> >> Filling a test buffer with these contents and placing point before >> "text2", we get >> >> (treesit-node-at (point) 'bash) >> =3D> # >> >> (treesit-node-children (treesit-node-at (point) 'bash)) >> =3D> (# >> # >> #) >> >> This is now expected. >> >> (point) >> =3D> 23 >> >> (treesit-node-first-child-for-pos (treesit-node-at (point) 'bash) = (point)) >> =3D> nil >> >> This is not expected. One would expect this to return >> command_substitution node, since it follows the position 23. > > Ah, I (finally) see what you mean. I agree that it should return the > command_substitution node. It seems that tree-sitter returns nil > whenever POS is not in a child node. I need to see what=E2=80=99s the = problem > here since treesit-node-first-child-for-pos is just a think wrapper > around the C counterpart. Seems to be tree-sitter-bash problem, I submitted an issue at https://github.com/tree-sitter/tree-sitter-bash/issues/139 Yuan