GNU bug report logs - #59662
29.0.50; [PATCH] Add treesit--indent-defun

Previous Next

Package: emacs;

Reported by: Theodor Thornhill <theo <at> thornhill.no>

Date: Mon, 28 Nov 2022 19:33:01 UTC

Severity: wishlist

Tags: patch

Found in version 29.0.50

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: casouri <at> gmail.com, 59662 <at> debbugs.gnu.org, theo <at> thornhill.no, casouri <at> gmail.org
Subject: bug#59662: 29.0.50; [PATCH] Add treesit--indent-defun
Date: Thu, 8 Dec 2022 03:37:54 +0200
[Message part 1 (text/plain, inline)]
On 03/12/2022 19:54, Eli Zaretskii wrote:
>> paredit-reindent-defun, like I described, does all that too. But when
>> outside strings and comments, it reindents the current defun.
> So maybe paredit-reindent-defun doesn't need any fixes, but using it as a
> role model for the C-like languages is not TRT, since in C these are two
> separate commands with two different key bindings.

It's not a given that the current state of things must automatically be 
optimal. But of course I can't vouch whether this behavior is optimal 
for every language.

And major modes will continue to be able to rebind these key sequences.

>> 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.
[prog-reindent-defun.diff (text/x-patch, attachment)]

This bug report was last modified 2 years and 158 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.