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: Sun, 04 Dec 2022 13:33:35 +0100 Message-ID: <87o7sjcpr4.fsf@thornhill.no> References: <5B538888-E454-4F75-B3B8-AB20E10B3E89@gmail.com> <83o7sniokt.fsf@gnu.org> <56840149-5EB9-4C22-841F-45F410BFC885@thornhill.no> <83edtjimyo.fsf@gnu.org> <875yet975l.fsf@thornhill.no> <87y1rp7dw2.fsf@thornhill.no> 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="35730"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59662@debbugs.gnu.org, casouri@gmail.com, eliz@gnu.org To: Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 04 13:34:29 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 1p1oCS-00090n-Cg for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 04 Dec 2022 13:34:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p1oC5-0005zW-0T; Sun, 04 Dec 2022 07:34:05 -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 1p1oC2-0005x7-1z for bug-gnu-emacs@gnu.org; Sun, 04 Dec 2022 07:34:02 -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 1p1oC1-0003IE-OC for bug-gnu-emacs@gnu.org; Sun, 04 Dec 2022 07:34:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p1oC1-0007QY-Jt for bug-gnu-emacs@gnu.org; Sun, 04 Dec 2022 07:34: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: Sun, 04 Dec 2022 12:34: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 X-Debbugs-Original-Cc: "Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors" , 59662@debbugs.gnu.org, casouri@gmail.com, Eli Zaretskii Original-Received: via spool by submit@debbugs.gnu.org id=B.167015723828544 (code B ref -1); Sun, 04 Dec 2022 12:34:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 Dec 2022 12:33:58 +0000 Original-Received: from localhost ([127.0.0.1]:57328 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1oBx-0007QK-Vp for submit@debbugs.gnu.org; Sun, 04 Dec 2022 07:33:58 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:59856) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1oBu-0007QE-EV for submit@debbugs.gnu.org; Sun, 04 Dec 2022 07:33:55 -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 1p1oBq-0005py-5w for bug-gnu-emacs@gnu.org; Sun, 04 Dec 2022 07:33:50 -0500 Original-Received: from out2.migadu.com ([188.165.223.204]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p1oBo-00038V-1i; Sun, 04 Dec 2022 07:33:49 -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=1670157217; 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=8Y2KcLM72joUzalOY734G4HTv314B5zeO52/6q+X1fI=; b=f8QsyuUrpMzN8yV/ohHSIaNQxwj8JKBulg1duYivwQtTMYXO1mHEB+j7xrD4OhIzAIIDHG JPksUEM0U8Uyq9H75oY5zr+SnfvvD5BTVT9X8wCl7CQbDb2eRy4+HxlS944khFf641FStT Bx7WwAOfyMShh44PZ1rRlPZUeu6eTIk2vaFhi97B8nawSKJMMDaxS6XDCVJ1f9EuD6sO8W 5Ss+Fe+f04SU6V83CJSNVW+RedGLtWFLY3OIYR/AeuM8NDpujlAClf9kYEANOECneFfQhT J9ZfgG0vBVll+2r8gwIlI2MZvreWXEshYh4S0BFd66Jzp4GKLV7+OyPVDSRpfQ== In-Reply-To: X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=188.165.223.204; envelope-from=theo@thornhill.no; helo=out2.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:249928 Archived-At: Theodor Thornhill writes: > On 2 December 2022 22:09:55 CET, "Daniel Mart=C3=ADn" wrote: >>Theodor Thornhill writes: >> >>> Right - thanks. However, this makes me wonder - should we really be >>> setting mark here? I see that c-indent-defun does not, and it feels >>> weird that indenting adds to the mark ring. What do you think? My >>> first patch used >>> >>> (indent-region >>> (treesit-node-start node) >>> (treesit-node-end node)) >>> >>> Which behaves similarly to c-indent-defun. >>> >>> See attached patch. >> >>I don't have a strong opinion, but if we can indent without setting the >>mark, I think it'd be a cleaner command. Specially if c-indent-defun >>doesn't set the mark either. > > Yeah, we don't need to set the mark. Thanks for the feedback :) > Theo Eli, do you have any opinion on this matter? Should we implement this function without using marks? That will make the function a smidge bigger, but would not mess up the mark-ring. I think that's desirable, at least. Theo