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 08:22:45 +0100 Message-ID: <56840149-5EB9-4C22-841F-45F410BFC885@thornhill.no> References: <5B538888-E454-4F75-B3B8-AB20E10B3E89@gmail.com> <83o7sniokt.fsf@gnu.org> 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="40825"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59662@debbugs.gnu.org, casouri@gmail.org To: Eli Zaretskii , Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 01 08:24:28 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 1p0dvl-000AN1-1r for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 01 Dec 2022 08:24:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p0dvW-0001se-4K; Thu, 01 Dec 2022 02:24:10 -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 1p0dvO-0001nd-Od for bug-gnu-emacs@gnu.org; Thu, 01 Dec 2022 02:24: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 1p0dvN-0003mJ-M4 for bug-gnu-emacs@gnu.org; Thu, 01 Dec 2022 02:24:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p0dvN-0005gk-H6 for bug-gnu-emacs@gnu.org; Thu, 01 Dec 2022 02:24:01 -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 07:24: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.166987940421853 (code B ref 59662); Thu, 01 Dec 2022 07:24:01 +0000 Original-Received: (at 59662) by debbugs.gnu.org; 1 Dec 2022 07:23:24 +0000 Original-Received: from localhost ([127.0.0.1]:37917 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0dul-0005gP-UJ for submit@debbugs.gnu.org; Thu, 01 Dec 2022 02:23:24 -0500 Original-Received: from out2.migadu.com ([188.165.223.204]:45531) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0dui-0005gI-Dd for 59662@debbugs.gnu.org; Thu, 01 Dec 2022 02:23:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1669879398; 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=eLX5E59kd2S6XTQP5BqtoW2hfl/PZRh+eCdvJEe4YIg=; b=EC5BYysd5V7dViBAwdZtdigtFx0HqUm+KVntspwOq7a6LOYSefGYtidDsIRW2yyJyP8tmU EbKYrTPBCQ7dvB4o/+yXni2x0pVrzbjt4L3bmlgJhBmZQzjgOCUXeTPHDLTFZv8RCfxnhy mb4eIZpZrhcesbJl8Cp2cbrz9QqbSH2FMh6yCZpTinmk8EMmLa/IHfbc6EJ6Ia88vgWKuY Zkx0yVx51kOKTKDwLXYzRl1wjUQjKkPYip74fp0R4pGMsep//G2l86oNvnJZRyaDSYkjrp cuUJ/pNrVVxWehPqgg528ko2qaCNTm9FF4K7qvFyLxDyoFXrYdAQw3GYr0z8eA== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-Reply-To: <83o7sniokt.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:249601 Archived-At: On 1 December 2022 08:13:22 CET, Eli Zaretskii wrote: >> From: Yuan Fu >> Date: Wed, 30 Nov 2022 15:23:17 -0800 >> Cc: Eli Zaretskii , >> 59662@debbugs=2Egnu=2Eorg, >> casouri@gmail=2Eorg >>=20 >> Also, this is really not tree-sitter specific, it doesn=E2=80=99t requi= re any >> tree-sitter feature to accomplish: indent-defun only needs mark-defun >> and indent-region, both are supported by practically any major mode=2E >>=20 >> Normally this kind of thing goes into lisp=2Eel, alongside commands lik= e >> fill-paragraph, indent-region, beginning-of-defun, etc, and claim a >> global keybinding=2E 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? >>=20 >> I=E2=80=99m thinking something like >>=20 >> (defun prog-mode-indent-defun () >> (interactive) >> (mark-defun) >> (indent-region (region-beginning) (region-end))) >>=20 >> (defvar prog-mode-map >> (=2E=2E=2E >> (define-key map (kbd "C-c C-q") #'prog-mode-indent-defun))) > >SGTM, but I'd begin by doing this only in c-ts-mode=2Eel (and maybe also = in >csharp-ts-mode)=2E After all, until now this functionality and the "C-c = C-q" >binding was only in CC Mode=2E (My original question about this was due = to >lack of enthusiasm to add the "C Indent" node of the Emacs manual text th= at >explains this feature is only available in CC Mode, not in the tree-sitte= r >based C/C++ modes=2E) So you'd like the change in lisp=2Eel, but bound only in the modes you men= tion, or have something similar to the original patch in treesit, but still= bound only to the same modes? Theo