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, 01 Dec 2022 07:10:14 +0100 Message-ID: <87y1rrzmbd.fsf@thornhill.no> References: <5B538888-E454-4F75-B3B8-AB20E10B3E89@gmail.com> Reply-To: Theodor Thornhill Mime-Version: 1.0 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="2461"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 59662@debbugs.gnu.org, casouri@gmail.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 01 07:11:24 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 1p0cn5-0000UZ-1c for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 01 Dec 2022 07:11:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p0cmq-0005A9-4E; Thu, 01 Dec 2022 01:11:08 -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 1p0cmo-00059M-0j for bug-gnu-emacs@gnu.org; Thu, 01 Dec 2022 01:11:06 -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 1p0cmn-0005LH-Cl for bug-gnu-emacs@gnu.org; Thu, 01 Dec 2022 01:11:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p0cmk-0004wE-7u for bug-gnu-emacs@gnu.org; Thu, 01 Dec 2022 01:11: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, 01 Dec 2022 06:11: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.166987502018970 (code B ref 59662); Thu, 01 Dec 2022 06:11:02 +0000 Original-Received: (at 59662) by debbugs.gnu.org; 1 Dec 2022 06:10:20 +0000 Original-Received: from localhost ([127.0.0.1]:37560 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0cm3-0004vu-Oz for submit@debbugs.gnu.org; Thu, 01 Dec 2022 01:10:20 -0500 Original-Received: from out2.migadu.com ([188.165.223.204]:28211) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0cm0-0004vo-OU for 59662@debbugs.gnu.org; Thu, 01 Dec 2022 01:10:17 -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=1669875015; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eLLNHgSsg7TNj3LSmK5WuA+5dUVzArW6HRkJv9zmgrA=; b=NbEVQlF43BV9LP565SxnDo7ta65P6QNrQqMSbfvz/n146Wk/tzTmYonRB1tpOMCMll0wd2 X6YsfG0tF9+/ZrRJurhYHITdUf+yKCUHmCQF5Ty9/XJPp99ZeouT2unvwuRlROfDZFaBrX GzhFTbj25B8I/fLQB7N5WHCEnqPU/4FTweIflJtqsIaVWP5CPvve7OiKsYMIQAfIeZR4ZF f2GwsEUovI1Sn4mX2sbA8pvn6zwEwDght+WKZyRKPIsHSwp2daXmvOr/pqtGqWrpb1n0dA MrCZq3aoFW1PTU6xQlbHYQMUVsQwHSPT0O4x/Bc/Kf4F/4uBt+GoqI1gnqypDQ== In-Reply-To: <5B538888-E454-4F75-B3B8-AB20E10B3E89@gmail.com> 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:249596 Archived-At: Yuan Fu writes: > Theodor Thornhill writes: > >> Eli Zaretskii writes: >> >>>> Cc: eliz@gnu.org, casouri@gmail.org >>>> From: Theodor Thornhill >>>> Date: Mon, 28 Nov 2022 20:32:01 +0100 [...] >> >>>> An alternative could be to add a 'treesit-mode-map' where we can >>>> auto-enable such constructs. >>> >>> I think this is less desirable. >>> >>> Yuan, WDYT? >>> > I see, so you want to implement C-c C-q in c-mode. But why don=E2=80=99t = we > make treesit--indent-defun a command and bind it in C-c C-q in major mode= s?=20 > Filling is not indent IMO. If you fill a list in elisp code it wraps long= lines=20 > instead of indent (IIRC). > > Also, this is really not tree-sitter specific, it doesn=E2=80=99t require= any > tree-sitter feature to accomplish: indent-defun only needs mark-defun > and indent-region, both are supported by practically any major mode. > > Normally this kind of thing goes into lisp.el, alongside commands like > fill-paragraph, indent-region, beginning-of-defun, etc, and claim a > global keybinding. But maybe we only want it to live under C-c prefix, > in that case I guess we can bind it in prog-mode-map, under C-c C-q? > Yeah, that's smart - thanks for the tip! Perhaps adding it to prog-mode is a bit premature, but maybe Eli has an opinion here? My guess is that a change in lisp.el is a little too big for the release branch? So we could let this live in treesit.el if it's too big a change? Theo