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: Fri, 9 Dec 2022 14:10:55 -0800 Message-ID: <4702319F-E4AF-44DB-BA2D-4A05B1FFBAB6@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="3206"; 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 Fri Dec 09 23:12:13 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 1p3lbI-0000af-D9 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 09 Dec 2022 23:12:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p3lb9-0007wN-6O; Fri, 09 Dec 2022 17:12:03 -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 1p3lb8-0007wE-N7 for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2022 17:12:02 -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 1p3lb8-0006tx-CL for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2022 17:12:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p3lb8-0006W2-1k for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2022 17:12: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: Fri, 09 Dec 2022 22:12: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.167062386725022 (code B ref 59633); Fri, 09 Dec 2022 22:12:02 +0000 Original-Received: (at 59633) by debbugs.gnu.org; 9 Dec 2022 22:11:07 +0000 Original-Received: from localhost ([127.0.0.1]:38815 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3laE-0006VW-JD for submit@debbugs.gnu.org; Fri, 09 Dec 2022 17:11:06 -0500 Original-Received: from mail-pj1-f41.google.com ([209.85.216.41]:38895) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3laC-0006V7-1Q for 59633@debbugs.gnu.org; Fri, 09 Dec 2022 17:11:05 -0500 Original-Received: by mail-pj1-f41.google.com with SMTP id z8-20020a17090abd8800b00219ed30ce47so9581909pjr.3 for <59633@debbugs.gnu.org>; Fri, 09 Dec 2022 14:11:04 -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=LaHap0siDG0tWX5+xDUGs7kr7UDkrKS/2ssEHwHpw48=; b=dZlr5UGBlieyEm+PHWmsLN+W43plcXaw3AmEfKudgfB39hUDBzpvQJZWgz1GnAjpKj Ak4+HxD0ki+ubacX0cq096a2yI1SwNhDFP6uK+7UBCC5Qnke038R7O2i68Ojsy8XCgSO S5SYsyVrrXuNhyPAtKomC8TUOqdbzIPVF1yjQfyLYXSJdqqbvyvGToIzb/gaIHHKCHIy sKYEPBB7AwWUS+CmU6/8esejzPvIOpOGld3NTZhuaetj0Q9MzfjAa6rbnohoiG1ovjLp RWh8QELJDoTjPR71R5tiNnDod4UOSZSvcdfQCLedIygHZDMmuAECvWhwi52X9ARZZBna PzaQ== 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=LaHap0siDG0tWX5+xDUGs7kr7UDkrKS/2ssEHwHpw48=; b=aOxM0xYk1HSTOoL8FvmMToZdV6BAg1Wh8vBPLEOfRHuzqNDWa78ULnsof9/QzJ9F2a f2+7BQPW3Nk2nF33RdzlJiM3q9oF5+/S58FvKyGPNG4kKCUdxqry9hE3ptLocz6VHanM A+LnpcYB9g58I/PSjgTGZO8286Ke5LxuQ4O23BjKTrnkKUvd7ccIGU4H3LZdkWrq7sWQ rO6Nvk7P5WBhlZKbSnap2MLP1QQkO/wD5jf6bDg+VnWA2Pki6m6p+/bhVQQjmr9O9R3N fhTQ8ha0UIzCKG95g6Y0xG7pin/fsTJrm9jmAyPE7V/vX4Vl4E4lov/Kea8kPb4wxpKB NLfA== X-Gm-Message-State: ANoB5pmeFeNpSkGjXbiNUsiQDjHvBBdoIcFRSalnpQ8quxpkA5ggKzuy du1uclt8Mn6FwmB/vofh1920ia7wf9txlg== X-Google-Smtp-Source: AA0mqf608K1ZYW7oHaAFYhrxvlqJrn8RBE42gici+6t9KXySbetcRmIG8tLMoox6I9KFdiUuQMvlLA== X-Received: by 2002:a05:6300:8107:b0:a7:8ad5:4346 with SMTP id bs7-20020a056300810700b000a78ad54346mr7905151pzc.62.1670623858141; Fri, 09 Dec 2022 14:10:58 -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 l7-20020a635707000000b004788780dd8esm1372761pgb.63.2022.12.09.14.10.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Dec 2022 14:10:57 -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:250471 Archived-At: 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. Yuan