From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#59662: 29.0.50; [PATCH] Add treesit--indent-defun Date: Thu, 08 Dec 2022 09:11:28 +0100 Message-ID: <875yemz55b.fsf@thornhill.no> 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> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12151"; mail-complaints-to="usenet@ciao.gmane.io" Cc: casouri@gmail.com, 59662@debbugs.gnu.org, casouri@gmail.org To: Eli Zaretskii , Dmitry Gutov , Stefan Monnier , Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 08 09:12:22 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 1p3C0z-0002tq-23 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 08 Dec 2022 09:12:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p3C0p-0000W3-1g; Thu, 08 Dec 2022 03:12:11 -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 1p3C0g-0000U4-Qa for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 03:12: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 1p3C0g-0002q6-99 for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 03:12:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p3C0g-0005Vf-47 for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 03:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Dec 2022 08:12: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.167048709721168 (code B ref 59662); Thu, 08 Dec 2022 08:12:02 +0000 Original-Received: (at 59662) by debbugs.gnu.org; 8 Dec 2022 08:11:37 +0000 Original-Received: from localhost ([127.0.0.1]:55166 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3C0G-0005VM-I1 for submit@debbugs.gnu.org; Thu, 08 Dec 2022 03:11:37 -0500 Original-Received: from out2.migadu.com ([188.165.223.204]:26112) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3C0D-0005VF-Dv for 59662@debbugs.gnu.org; Thu, 08 Dec 2022 03:11:34 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1670487090; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=kYerDy25dc21u7i0UClgGNcAGqxWNcKQyDAt5UJTuJQ=; b=0Cq78XBZJNU7AU4obCbsaGd3+8xbXV8HSAm6lr7FVn6U0TmgcAvrmTn3E/0rbQBJ6cW+z2 Gl19oGQ6m3ToDKRVXBKYgNsKCo0eqy2iyaSA7MZqYvG5ynUXNXStWlcvAZGdLAyVcZ4Q1G kLHkFn3NGKri1GSyd3tiBQXMgakzdax2KCUPt0xZGW5M2zL1pofwqJbiO4jSpaNo1m3jOK 5jWNfofOdCky35u63ey1htoTrEhdv6TdGXLuJPIINKfZIT1fJDmof1jrA0UXdrJYYZE4tQ cURZqbjwl+av43pUloae+sz0KO8ek3KFkKYkM1arDx9v206cvM82MJJ6qQnFCw== In-Reply-To: <83y1ri2wnj.fsf@gnu.org> X-Migadu-Flow: FLOW_OUT 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:250249 Archived-At: Eli Zaretskii writes: >> Date: Thu, 8 Dec 2022 03:37:54 +0200 >> Cc: theo@thornhill.no, casouri@gmail.com, 59662@debbugs.gnu.org, >> casouri@gmail.org >> From: Dmitry Gutov >> >> >> AFAICT, these behaviors are quite compatible. But paredit's binding >> >> seems to be useful in more contexts. >> > I'm fine with trying something like that on master, to see whether users >> > like this conflation, but not on the release branch. >> >> Here's a patch that people can try. From my brief testing, seems useful >> enough. I suppose some might dislike it, though, in some codebases where >> the methods/functions are consistently longer than a screenful. I do >> like this binding in Emacs Lisp too, though. > > Stefan, Lars: any comments? > > I'm okay with installing this on master, but please rename the new > function to something like prog-fill-reindent; the "fill" part should > appear in the name, to explain why we have both prog-indent and this > function. > > Also, a NEWS entry and some addition to the "Multi-line Indent" node > of the Emacs user manual would be nice. > > Bonus points for adding something that could use treesit.el > capabilities, when those are available, instead of syntax-ppss, to > determine when we are in a comment or in a string. Or maybe Theo or > Yuan could suggest such an addition. > This works perfectly as is in *-ts-modes. At least for modes where syntax-table is set correctly. I don't think there's a reason to enable treesit.el capabilities, unless there's a case where this doesn't work. If this ends up in master, should I backport some similar feature for the *ts-modes? Theo