GNU bug report logs -
#59662
29.0.50; [PATCH] Add treesit--indent-defun
Previous Next
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
Yuan Fu <casouri <at> gmail.com> writes:
> Theodor Thornhill <theo <at> thornhill.no> writes:
>
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>>
>>>> Cc: eliz <at> gnu.org, casouri <at> gmail.org
>>>> From: Theodor Thornhill <theo <at> thornhill.no>
>>>> 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’t we
> make treesit--indent-defun a command and bind it in C-c C-q in major modes?
> Filling is not indent IMO. If you fill a list in elisp code it wraps long lines
> instead of indent (IIRC).
>
> Also, this is really not tree-sitter specific, it doesn’t 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
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.