bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59662: 29.0.50; [PATCH] Add treesit--indent-defun


From: Eli Zaretskii
Subject: bug#59662: 29.0.50; [PATCH] Add treesit--indent-defun
Date: Thu, 08 Dec 2022 16:53:54 +0200

> Date: Thu, 8 Dec 2022 16:18:17 +0200
> Cc: monnier@iro.umontreal.ca, larsi@gnus.org, 59662@debbugs.gnu.org,
>  casouri@gmail.org
> From: Dmitry Gutov <dgutov@yandex.ru>
> 
> On 08/12/2022 10:56, Theodor Thornhill wrote:
> >      (if (or (and (treesit-available-p)
> >                   (treesit-ready-p (treesit-language-at (point)))
> >                   (string-match-p
> >                    treesit-comment-type-regexp
> >                    (treesit-node-type (treesit-node-at (point)))))
> 
> I was kind of hoping that sometime in the near future our tree-sitter 
> code would somehow plug into syntax-ppss (maybe via advice or etc) to 
> provide the same results faster.

It is too early to consider practical code along these lines, we don't
have enough experience with tree-sitter.  I'm not even sure it can be
easily factored into the same categories as syntax-ppss uses.

IMO, the way to move to a unified handling is to use tree-sitter
wherever we can, originally as special-cased code, and later refactor
that into generalized APIs, when we know more about how to define and
use them.

> So my preference would be to check in the implementation as-is (if 
> everybody agrees with the behavior), and then migrate it to new helpers 
> (in case plugging into syntax-ppss won't be automatic).
> 
> But I don't really mind the code you posted, if somebody (e.g. Eli) is 
> going to insist on it. It just doesn't seem critical from the 
> performance POV, and the variable treesit-comment-type-regexp seems to 
> be a little out of place. But then again, if the helpers will be put in 
> prog-mode.el, the var will be there as well.

I don't insist, but it sounds like the logical thing to do.  So unless
you feel strongly against that, I'd say let's add that part.  This is,
after all, an experiment, so let's experiment.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]