From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#59662: 29.0.50; [PATCH] Add treesit--indent-defun Date: Thu, 8 Dec 2022 16:18:17 +0200 Message-ID: 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> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="626"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Cc: larsi@gnus.org, 59662@debbugs.gnu.org, monnier@iro.umontreal.ca, casouri@gmail.org To: Theodor Thornhill , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 08 15:19:26 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 1p3HkD-000ASj-NK for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 08 Dec 2022 15:19:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p3Hjx-0002pw-1Z; Thu, 08 Dec 2022 09:19:09 -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 1p3Hjr-0002nH-4X for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 09:19: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 1p3Hjq-0006Lo-Nb for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 09:19:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p3Hjq-0003Ui-HS for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 09:19:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Dec 2022 14:19:02 +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.167050910813419 (code B ref 59662); Thu, 08 Dec 2022 14:19:02 +0000 Original-Received: (at 59662) by debbugs.gnu.org; 8 Dec 2022 14:18:28 +0000 Original-Received: from localhost ([127.0.0.1]:57065 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3HjH-0003UN-Sq for submit@debbugs.gnu.org; Thu, 08 Dec 2022 09:18:28 -0500 Original-Received: from mail-wr1-f48.google.com ([209.85.221.48]:46861) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3HjG-0003UH-7H for 59662@debbugs.gnu.org; Thu, 08 Dec 2022 09:18:26 -0500 Original-Received: by mail-wr1-f48.google.com with SMTP id h11so1750872wrw.13 for <59662@debbugs.gnu.org>; Thu, 08 Dec 2022 06:18:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=md3AoaFZWUIlkeTlVfvjIICvUSZOAtlGdQg0MYgohAQ=; b=I5grnAcqaM5Cpl2H4wlhkyzAMo+MJdmz/Jaomytn870xB9PIwJUzKzLEFPj6v95Am0 SiSa23BkJTNo3dRRbeF8V4Q6kSpBcd2LE+29OWCjjsviJaP1F9TNicABKDRNgwVfMn7Z M9PyvWbIv0mmjZM8zWBXdkX0KTvGR/Qg2tYil69MyRJblqFY3XhE+iu3AZ13eplu6IHa xF2y3jwKx3a5Dd9uLlcZwoU61bciWyXQxyJAQbGYgIpBytdp4njdIuhdYEICv1YhOTET WWpOV1GGSUcVl1ayM/8G+iuMcvfzelxGDVzZreY+m0acgZfximE266Ono9bmW/U9BvS6 K5UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=md3AoaFZWUIlkeTlVfvjIICvUSZOAtlGdQg0MYgohAQ=; b=1DfLysRuHcBaL9ktMIyw7FdAGgqXF3MMCl/gA93+iDFoTBFkv56v+k7OhTZ5Q7TZrq z51+Bvbe3mCQukw97JHmcPmz5e6dG7FlIK99qj/fe+HzYgJc4VkG9BxI3UJAYJvSRpHQ Zv6900GC58IF8yDjyahhLiKfAWncWF8CAc779/nf/z6igN1K0zzY0zxqildyTTz7Y1et BgnXb0HMC2XjOp9Cn9X4Wv1unUxvQIegycq61Gseyx2Y6kKGuKhVjSmFjcpkwpc8BM+u aDaCqgpIglwAcI82/D0YY3wZHHMAFcu/IUODDUjKksiBhSx8lMcFbUJPETPw2ERU0gXu DTkQ== X-Gm-Message-State: ANoB5pkzfP+6SYSWXSZrO5CCmhocZGWj6BMlh5yHReP6QakSZv4sKfvg hFW0wOpqX5xRSzNBgi/HrLI= X-Google-Smtp-Source: AA0mqf7wrdasQuMfPUGG8w1hBH9X2sTpos6v07dlhrZJaOr+JNF56hX52cuxq9DGofaTzh3QnCqZHQ== X-Received: by 2002:a05:6000:83:b0:242:fd7:285f with SMTP id m3-20020a056000008300b002420fd7285fmr1528674wrx.45.1670509100137; Thu, 08 Dec 2022 06:18:20 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id a16-20020a5d4570000000b00242109cf587sm22488613wrc.28.2022.12.08.06.18.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Dec 2022 06:18:19 -0800 (PST) Content-Language: en-US In-Reply-To: <87zgbyxohf.fsf@thornhill.no> 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:250292 Archived-At: 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. Or that we'd add similar helpers which would dispatch to either syntax-ppss or tree-sitter, depending on whether the latter is enabled and working. The first approach will be more compatible for third-party code to use right now; the second will probably be more powerful. We might even do both. As a result, a lot of functions won't have to reimplement the quoted part. Inside, and (more importantly) outside Emacs core. 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.