From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Wilhelm H Kirschbaum Newsgroups: gmane.emacs.bugs Subject: bug#60355: 29.0.60; Tree sitter incorrectly handles of PRED for treesit-defun-type-regexp Date: Wed, 28 Dec 2022 08:31:32 +0200 Organization: Personal Message-ID: <87sfh0ujet.fsf@gmail.com> References: <1E7949EC-7420-4848-9F45-88A20BAAE1D8@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24882"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.9.3; emacs 29.0.60 Cc: 60355@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 28 07:34:42 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 1pAQ1R-0006GP-G8 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 28 Dec 2022 07:34:41 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pAQ0r-0000of-1B; Wed, 28 Dec 2022 01:34:05 -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 1pAQ0p-0000oF-IG for bug-gnu-emacs@gnu.org; Wed, 28 Dec 2022 01:34:03 -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 1pAQ0o-0006G4-Un for bug-gnu-emacs@gnu.org; Wed, 28 Dec 2022 01:34:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pAQ0o-0005eL-Qv for bug-gnu-emacs@gnu.org; Wed, 28 Dec 2022 01:34:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Wilhelm H Kirschbaum Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 28 Dec 2022 06:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60355 X-GNU-PR-Package: emacs Original-Received: via spool by 60355-submit@debbugs.gnu.org id=B60355.167220922221637 (code B ref 60355); Wed, 28 Dec 2022 06:34:02 +0000 Original-Received: (at 60355) by debbugs.gnu.org; 28 Dec 2022 06:33:42 +0000 Original-Received: from localhost ([127.0.0.1]:56973 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAQ0U-0005cv-8j for submit@debbugs.gnu.org; Wed, 28 Dec 2022 01:33:42 -0500 Original-Received: from mail-wm1-f54.google.com ([209.85.128.54]:34585) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAQ0S-0005ci-FN for 60355@debbugs.gnu.org; Wed, 28 Dec 2022 01:33:40 -0500 Original-Received: by mail-wm1-f54.google.com with SMTP id bi26-20020a05600c3d9a00b003d3404a89faso9588281wmb.1 for <60355@debbugs.gnu.org>; Tue, 27 Dec 2022 22:33:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:in-reply-to :organization:date:subject:cc:to:from:user-agent:references:from:to :cc:subject:date:message-id:reply-to; bh=Bh6P7czEhSBykS+u6V+GIyp5JjeYh8RotQQ540cTSoM=; b=SFgxAj+RuRMI++7oe9iO5FuPGrvwQ1Lr0f9VGV2/d+jOvdES7cRhgGH88dJ2GyRUWx U566JVVE/IZvtOjUcrFX8tw5JA3mmDsgO7Kev/HpvRXP9vL7csSBhAoVdhTsKir1gJTL YCPKK10s+rK+7m/Qpn9ZTxhLYn9qcnkqOuWKEbtf9Xl7ycIw/2uKpuAPWiGpLeW3pIpn ntvVB2lP70p1HXNTnU6P5sSpa6puci5w4h8vM9P6ODDa2JhFcb220UOGB4kavD72OgPJ juTyd1xa1HwT0zTqLfbCydf7Y85EyoHDkLNA5Vv/H/RQ6ZDI98vaTiYSoZBCXIdFm/CT SjGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:in-reply-to :organization:date:subject:cc:to:from:user-agent:references :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Bh6P7czEhSBykS+u6V+GIyp5JjeYh8RotQQ540cTSoM=; b=zowfEI+UeKJuRB7j7iy6MuC/PELKUVU/k5R47dcYXqMcfHPaA5TmEiy9hMIGeVILid psLEyayDkFRKV8L42P/fLiYjaDGky5cRXn+0hZRxEcqs1kMp+a9+REx8G31nUsD9kk2T 6lENWHdExSQ5IDm4+ky0wrBJT1PZApZHbe2yWsfFB6viB4qTgEb7aG25kxy6DRACanSU PoVEdOgVgUzSqWwxYR0W7MVFJBeJ639evSX5J6duRlmlUT8YQDpkC4j1+oNwc+PNs2Ad Wi5sCBdFoMcQNkVBCs/cLIdCv6/0DqijbjIAs7CeA9GRfmB9BPNckSFZaCMsSJkZwbFt PQsw== X-Gm-Message-State: AFqh2kr9VLnHTGHVu81/ka+PGdv6QiDnxkrF7KBwqIlspUS44U282ey0 FQy1QfZ2/aGcJIPV8JGrxpx5HlQ1R5zarg== X-Google-Smtp-Source: AMrXdXte/gWNV8NC2r7XUCiUTrfeRkkss22dug0ulviPTapzGG7b+U1yyeZNPDUNOd1Ozdh9xt0QpA== X-Received: by 2002:a05:600c:1c27:b0:3cf:a83c:184a with SMTP id j39-20020a05600c1c2700b003cfa83c184amr17129639wms.24.1672209214282; Tue, 27 Dec 2022 22:33:34 -0800 (PST) Original-Received: from melissa.local ([2c0f:ef18:1431:0:b09:9616:db04:c248]) by smtp.gmail.com with ESMTPSA id d9-20020a05600c3ac900b003d973d4fb28sm13851678wms.4.2022.12.27.22.33.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Dec 2022 22:33:33 -0800 (PST) In-reply-to: <1E7949EC-7420-4848-9F45-88A20BAAE1D8@gmail.com> 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:251976 Archived-At: Thanks Yuan, just checked and both the fix and your suggestion=20 works. I see there is a typo in your last change: @@ -310,7 +310,7 @@ java-ts-mode ;; Imenu. (setq-local treesit-simple-imenu-settings '(("Class" "\\`class_declaration\\'" nil nil) - ("Interface "\\`interface_declaration\\'" nil=20 nil) + ("Interface" "\\`interface_declaration\\'" nil=20 nil) ("Enum" "\\`record_declaration\\'" nil nil) ("Method" "\\`method_declaration\\'" nil nil))) (treesit-major-mode-setup)) Yuan Fu writes: > Wilhelm H Kirschbaum writes: > >> When `treesit-defun-type-regexp` is set with a cons cell=20 >> (regexp . >> some-pred) >> the following case does not get handled as expected when=20 >> calling >> (end-of-defun): >> >> ```elixir >> defmodule Example do >> def foo() do ; regexp match, pred match >> end >> >> ;; >> @impl true ; regexp match, pred does not match >> def bar() do ; regexp match, pred match >> end >> ;; >> >> def baz() do >> end >> end >> ;; >> ``` > > Thank you very much! The root cause is actually another problem,=20 > but > anyway it is fixed now. > > May I also suggest you to use this function for the predicate: > > (defun elixir-ts-mode--capture-defun (node) > ;; NODE should be a =E2=80=98call=E2=80=99 node. > (member (treesit-node-text > (treesit-node-child-by-field-name node "target")) > elixir-ts-mode--definition-keywords)) > > This should be more accurate than the current one, and is IMO=20 > simpler > too. > > Yuan