bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59662: 29.0.50; [PATCH] Add treesit--indent-defun


From: Theodor Thornhill
Subject: bug#59662: 29.0.50; [PATCH] Add treesit--indent-defun
Date: Thu, 01 Dec 2022 07:10:14 +0100

Yuan Fu <casouri@gmail.com> writes:

> Theodor Thornhill <theo@thornhill.no> writes:
>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>>>> Cc: eliz@gnu.org, casouri@gmail.org
>>>> From: Theodor Thornhill <theo@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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]