From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#59662: 29.0.50; [PATCH] Add treesit--indent-defun Date: Thu, 08 Dec 2022 16:53:54 +0200 Message-ID: <837cz22bgd.fsf@gnu.org> References: <5B538888-E454-4F75-B3B8-AB20E10B3E89@gmail.com> <83o7sniokt.fsf@gnu.org> <4D5A1640-4F0F-4C21-8ED6-770B88A870EA@thornhill.no> <83r0xhdluq.fsf@gnu.org> <3e25eadb-3f2b-f92d-8b18-bf1daca91b64@yandex.ru> <83wn78cqz4.fsf@gnu.org> <4d605e69-7df9-6480-c1c5-dcb22abd3bde@yandex.ru> <83y1ri2wnj.fsf@gnu.org> <875yemz55b.fsf@thornhill.no> <83r0xa2tc4.fsf@gnu.org> <87zgbyxohf.fsf@thornhill.no> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34808"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, 59662@debbugs.gnu.org, theo@thornhill.no, monnier@iro.umontreal.ca, casouri@gmail.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 08 15:56: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 1p3IJo-0008qK-Pt for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 08 Dec 2022 15:56:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p3IJ3-0000oK-Ft; Thu, 08 Dec 2022 09:55:25 -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 1p3IIj-0000cl-9A for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 09:55:07 -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 1p3IIg-0006Op-J5 for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 09:55:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p3IIf-0003nN-U7 for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 09:55:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Dec 2022 14:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59662 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 59662-submit@debbugs.gnu.org id=B59662.167051125614558 (code B ref 59662); Thu, 08 Dec 2022 14:55:01 +0000 Original-Received: (at 59662) by debbugs.gnu.org; 8 Dec 2022 14:54:16 +0000 Original-Received: from localhost ([127.0.0.1]:57241 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3IHv-0003mk-GB for submit@debbugs.gnu.org; Thu, 08 Dec 2022 09:54:15 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:52992) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3IHt-0003me-H4 for 59662@debbugs.gnu.org; Thu, 08 Dec 2022 09:54:14 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3IHn-0005q2-Fk; Thu, 08 Dec 2022 09:54:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=0SbQ3ZNH3C1+HMCikcgC1di1agCu/19k0iaBI/zzCjI=; b=CohnO3AsqTc+ jqWR72KvAj5+vdCufw53KMxLsezqXsIsW14PuI3JkWdfQnWm7X8sFFJORcLdRmKIRYwx1rPDw/ZZ0 80NBedr8SaaDDG2dQCtzYUZCZ0b14pzUIIXP9yFjg0ZwQ0NXTTw7LRMP130FIj1o3EV4HdRvYinYD 7sWVpBZSWvMEIwc75N5gO0tiwXrpVbG4q4kLCDAEyKr+A/gIobTsctJxuHjyckmEJF74/rKoKeR3c b7CNXto0ZLUMFbMo8R5SoTTiXfGVeNE/egtyddweetLVIszLmUW80ApCh7rPtMaXlPVnKSa1024bm wuqanjUISixTz6b/wuJeCg==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3IHj-0005iM-JU; Thu, 08 Dec 2022 09:54:07 -0500 In-Reply-To: (message from Dmitry Gutov on Thu, 8 Dec 2022 16:18:17 +0200) 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:250299 Archived-At: > 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 > > 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.