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#68824: treesitter support for outline-minor-mode Date: Sun, 4 Feb 2024 20:34:24 -0800 Message-ID: References: <86le8667u7.fsf@mail.linkov.net> <865xza39vp.fsf@gnu.org> <86y1c6q7oh.fsf@mail.linkov.net> <868r44ryzb.fsf@mail.linkov.net> <3D859057-3DE9-470A-80A4-E0F734A0A622@gmail.com> <86r0hsxiaf.fsf@mail.linkov.net> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) 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="2340"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68824@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 05 05:35:00 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 1rWqh9-0000Sv-VV for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 05 Feb 2024 05:34:59 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rWqh2-0006xD-L2; Sun, 04 Feb 2024 23:34:52 -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 1rWqh0-0006wo-Gt for bug-gnu-emacs@gnu.org; Sun, 04 Feb 2024 23:34:50 -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 1rWqh0-0005qu-90 for bug-gnu-emacs@gnu.org; Sun, 04 Feb 2024 23:34:50 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rWqhB-0001JC-UD for bug-gnu-emacs@gnu.org; Sun, 04 Feb 2024 23:35:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 05 Feb 2024 04:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68824 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 68824-submit@debbugs.gnu.org id=B68824.17071076995018 (code B ref 68824); Mon, 05 Feb 2024 04:35:01 +0000 Original-Received: (at 68824) by debbugs.gnu.org; 5 Feb 2024 04:34:59 +0000 Original-Received: from localhost ([127.0.0.1]:50362 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWqh9-0001Is-3v for submit@debbugs.gnu.org; Sun, 04 Feb 2024 23:34:59 -0500 Original-Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:59706) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWqh4-0001IZ-Ux for 68824@debbugs.gnu.org; Sun, 04 Feb 2024 23:34:57 -0500 Original-Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-296a79e6295so86200a91.3 for <68824@debbugs.gnu.org>; Sun, 04 Feb 2024 20:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707107677; x=1707712477; 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=5D36VZBecw6YKKQDBq+rU8JJN/CfQW4tyQ4akXbNBgo=; b=IkSJal7NDL6WVdcjLJdTgdrwv9H1i0+ND5rl+q8/FMPoiwij+xrHD1xqLZ/IztMn6s LCKB8NGde5fm6XbpmGvM0S1x0+Yu28Cg8x3E0UjE5kjVFPrti0RroGLmxbdfXxxmCk5W dnUbmA8irONP/gtko8xE6QPY9hwKr/Iqj84QOAt0/qAUz3PvbXIqOPFYJmB7Ww4JepF6 ygzj7436yRcOslCtFBgzmVQz6li4E3wKfCXAxG4VpolAIIU1D9gtpZfcw8mEvwFNWg45 iQxKWJTQCJ9cLWV7WPxNfAWGvk2NlfL2fkGDAShezX9Eq5hyOOcTrittCuKFxmTlSQYs +WgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707107677; x=1707712477; 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=5D36VZBecw6YKKQDBq+rU8JJN/CfQW4tyQ4akXbNBgo=; b=V7AdUUk+4d36W2ZhkP1rO0FjTgnPz41lY/Wq9M+Q3BJl0TmcKOa5/Fp7f73NKgze3B +WsZZ8tkp3EpGF2pWWbb+yhpjVtKsv1KJviLwnnpZcVAoPbPIMpHxaPNKB9OfyFu0X0I D8IYgFkT6mHzfeMZzoMS3G4MS1zIkH5a9qsFcvxftmeSVxAT9dputFBEbcsqvI/rG/Wc YZg7gbgPQPe+rJOuVPoObzofSAGN/fHx/XLW/FSJfHeVeaC7AjWDB3PosIZgdpAxNA+j MVACHLYkTI1d2rdxZnVQUZcqsFUklw2LDwarycfhXuZyTC3ff0D3+prqAmgv8t9aT5rl O7/Q== X-Gm-Message-State: AOJu0YxPftMDNPfCSkoqxNvxbH/QIhuCehVWCBbCMzSbxgbJXFRWx4aI Kn9RulkXBjt+4rpn21ua0A+cmkaoBvI5VWn1yS7j5NJucQKUX3Yv X-Google-Smtp-Source: AGHT+IGOpIomYXwAIUC5LPjopGvp/FQGqAU39X4ONLA/DnVw4YhDQhZK80QZPWxILaUPhaWzAjP4QA== X-Received: by 2002:a17:90a:ff11:b0:296:a1ba:99e2 with SMTP id ce17-20020a17090aff1100b00296a1ba99e2mr1154657pjb.9.1707107676592; Sun, 04 Feb 2024 20:34:36 -0800 (PST) Original-Received: from smtpclient.apple (172-117-161-177.res.spectrum.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id pw9-20020a17090b278900b00296a425cde2sm549052pjb.12.2024.02.04.20.34.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Feb 2024 20:34:35 -0800 (PST) In-Reply-To: <86r0hsxiaf.fsf@mail.linkov.net> X-Mailer: Apple Mail (2.3731.700.6) 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:279435 Archived-At: > On Feb 4, 2024, at 9:15 AM, Juri Linkov wrote: >=20 >> Instead of using treesit-search-forward, can you use >> treesit-beginning-of-thing or treesit--navigate-thing to do what you = want? >> They handle the =E2=80=9Cchild before parent=E2=80=9D problem for = you, and handles some >> other edge cases. >=20 > Thanks, I tried and it works. >=20 > Probably treesit--navigate-thing is not internal anymore. > Also the patch below uses treesit--thing-at that doesn't look > internal either. So maybe two dashes could be removed from names. Yeah, it=E2=80=99s more of a =E2=80=9CEmacs internal=E2=80=9D than = =E2=80=9Ctreesit.el internal=E2=80=9D. I wanted to give myself some = freedom to change the api, and they=E2=80=99ve indeed went through big = changes since created. I can covert them to single dash. >=20 > Also a remaining question: why treesit-parent-until simply calls > =E2=80=98(funcall pred node)=E2=80=99 instead of supporting the = standard format > that includes a regexp by using treesit-node-match-p? >=20 > This causes such an inconvenience that for treesit-outline-level > that uses treesit-parent-until there is a need to wrap a regexp > in a lambda such as for html-ts-mode below. Nothing other than my oversight :-) I pushed a change to master that = fixes this. As for the patch, I think treesit-outline-predicate could be set to a = named function rather than a lambda generated on the fly, but I don=E2=80=99= t have strong opinions about it (and maybe you have some reason to use a = lambda?) Otherwise LGTM. Yuan=