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


Message #154 received at 59662 <at> debbugs.gnu.org (full text, mbox):

From: Theodor Thornhill <theo <at> thornhill.no>
To: Eli Zaretskii <eliz <at> gnu.org>, Dmitry Gutov <dgutov <at> yandex.ru>, Stefan
 Monnier <monnier <at> iro.umontreal.ca>, Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: casouri <at> gmail.com, 59662 <at> debbugs.gnu.org, casouri <at> gmail.org
Subject: Re: bug#59662: 29.0.50; [PATCH] Add treesit--indent-defun
Date: Thu, 08 Dec 2022 09:11:28 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Date: Thu, 8 Dec 2022 03:37:54 +0200
>> Cc: theo <at> thornhill.no, casouri <at> gmail.com, 59662 <at> debbugs.gnu.org,
>>  casouri <at> gmail.org
>> From: Dmitry Gutov <dgutov <at> yandex.ru>
>> 
>> >> 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




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.