GNU bug report logs -
#59617
29.0.50; Add indent styles to all tree-sitter modes
Previous Next
Reported by: Theodor Thornhill <theo <at> thornhill.no>
Date: Sat, 26 Nov 2022 19:00:02 UTC
Severity: normal
Found in version 29.0.50
Done: Yuan Fu <casouri <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 59617 in the body.
You can then email your comments to 59617 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
casouri <at> gmail.com, bug-gnu-emacs <at> gnu.org
:
bug#59617
; Package
emacs
.
(Sat, 26 Nov 2022 19:00:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Theodor Thornhill <theo <at> thornhill.no>
:
New bug report received and forwarded. Copy sent to
casouri <at> gmail.com, bug-gnu-emacs <at> gnu.org
.
(Sat, 26 Nov 2022 19:00:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Yuan and others!
I've added in the ability for users to set their own indentation style
should that be needed.
I just followed what I already did in c-ts-mode and c++-ts-mode, so I
believe this shouldn't be too controversial :-)
Theo
[0001-Add-indent-styles-to-all-tree-sitter-modes.patch (text/x-diff, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59617
; Package
emacs
.
(Sun, 27 Nov 2022 11:51:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 59617 <at> debbugs.gnu.org (full text, mbox):
Hi Eli and Lars :-)
I have some other ideas and improvements I'm planning in the tree-sitter
modes, and it would be really nice to be able to do this myself. I know
we've discussed this already, but do you still think it's premature
giving me write access? Building commits on top of eachother, then
splitting up and so on is a hassle while waiting for things to be
committed for me. And it causes extra work for you guys.
If you still think so that's ok, but I'd like to still get some more
stuff in before the split!
Theo
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59617
; Package
emacs
.
(Sun, 27 Nov 2022 23:39:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 59617 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Fixed a typo - see this patch:
Theo
[0001-Add-indent-styles-to-all-tree-sitter-modes.patch (text/x-diff, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59617
; Package
emacs
.
(Mon, 28 Nov 2022 07:00:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 59617 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Theodor Thornhill <theo <at> thornhill.no> writes:
> Fixed a typo - see this patch:
>
Rebased the patch on top of origin/master:
What do you think, Yuan?
[0001-Add-indent-styles-to-all-tree-sitter-modes.patch (text/x-diff, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59617
; Package
emacs
.
(Mon, 28 Nov 2022 12:27:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 59617 <at> debbugs.gnu.org (full text, mbox):
> Cc: Yuan Fu <casouri <at> gmail.com>
> Date: Mon, 28 Nov 2022 07:59:10 +0100
> From: Theodor Thornhill via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
> Theodor Thornhill <theo <at> thornhill.no> writes:
>
> > Fixed a typo - see this patch:
> >
>
> Rebased the patch on top of origin/master:
>
> What do you think, Yuan?
FWIW, I consider user options that require functions as values not a good
UI. Many users, especially newbies, will not be able to use such options,
because they cannot come up with functions that do what they want.
It is okay to have a function value as one of N alternatives, where N > 5,
say, so that such users could still choose from "simpler" values, where the
"function" was pre-arranged by us for them. But having just the default and
a function is definitely not good enough IMO.
Cannot we come up with a couple of popular styles for each language, and
have those styles ready to be selected by simple atom values in the
defcustom?
Thanks.
P.S. Btw, what about other indentation-related facilities, like "C-c C-q" in
CC Mode?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59617
; Package
emacs
.
(Mon, 28 Nov 2022 12:39:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 59617 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> Cc: Yuan Fu <casouri <at> gmail.com>
>> Date: Mon, 28 Nov 2022 07:59:10 +0100
>> From: Theodor Thornhill via "Bug reports for GNU Emacs,
>> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>>
>> Theodor Thornhill <theo <at> thornhill.no> writes:
>>
>> > Fixed a typo - see this patch:
>> >
>>
>> Rebased the patch on top of origin/master:
>>
>> What do you think, Yuan?
>
> FWIW, I consider user options that require functions as values not a good
> UI. Many users, especially newbies, will not be able to use such options,
> because they cannot come up with functions that do what they want.
>
> It is okay to have a function value as one of N alternatives, where N > 5,
> say, so that such users could still choose from "simpler" values, where the
> "function" was pre-arranged by us for them. But having just the default and
> a function is definitely not good enough IMO.
>
> Cannot we come up with a couple of popular styles for each language, and
> have those styles ready to be selected by simple atom values in the
> defcustom?
>
I guess we could, but most other languages provided here have a pretty
standard coding style, IIRC. Not saying it's not any variations. This
is meant mostly as an escape hatch if needed, so that a user _can_
provide their own indentation style should they need it.
>
> P.S. Btw, what about other indentation-related facilities, like "C-c C-q" in
> CC Mode?
I'm planning on making those, yes
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59617
; Package
emacs
.
(Mon, 28 Nov 2022 13:26:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 59617 <at> debbugs.gnu.org (full text, mbox):
> From: Theodor Thornhill <theo <at> thornhill.no>
> Cc: 59617 <at> debbugs.gnu.org, casouri <at> gmail.com
> Date: Mon, 28 Nov 2022 13:38:30 +0100
>
> > Cannot we come up with a couple of popular styles for each language, and
> > have those styles ready to be selected by simple atom values in the
> > defcustom?
> >
>
> I guess we could, but most other languages provided here have a pretty
> standard coding style, IIRC.
Only one standard style? I'm surprised. Even if the variations are much
less popular, they still deserve to be supported OOTB, IMO.
> Not saying it's not any variations. This is meant mostly as an escape
> hatch if needed, so that a user _can_ provide their own indentation style
> should they need it.
If we don't expect anyone reasonable to try that, fine. But if we do (and
a defcustom seems to say we do), then I'd provide a couple of other styles,
even if they are used much more rarely.
> > P.S. Btw, what about other indentation-related facilities, like "C-c C-q" in
> > CC Mode?
>
> I'm planning on making those, yes
Thanks!
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59617
; Package
emacs
.
(Mon, 28 Nov 2022 13:43:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 59617 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Theodor Thornhill <theo <at> thornhill.no>
>> Cc: 59617 <at> debbugs.gnu.org, casouri <at> gmail.com
>> Date: Mon, 28 Nov 2022 13:38:30 +0100
>>
>> > Cannot we come up with a couple of popular styles for each language, and
>> > have those styles ready to be selected by simple atom values in the
>> > defcustom?
>> >
>>
>> I guess we could, but most other languages provided here have a pretty
>> standard coding style, IIRC.
>
> Only one standard style? I'm surprised. Even if the variations are much
> less popular, they still deserve to be supported OOTB, IMO.
>
>> Not saying it's not any variations. This is meant mostly as an escape
>> hatch if needed, so that a user _can_ provide their own indentation style
>> should they need it.
>
> If we don't expect anyone reasonable to try that, fine. But if we do (and
> a defcustom seems to say we do), then I'd provide a couple of other styles,
> even if they are used much more rarely.
>
Ok, I can supply some more styles. This bug or a subsequent bug?
>> > P.S. Btw, what about other indentation-related facilities, like "C-c C-q" in
>> > CC Mode?
>>
>> I'm planning on making those, yes
>
> Thanks!
No problem.
Theo
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59617
; Package
emacs
.
(Mon, 28 Nov 2022 13:45:01 GMT)
Full text and
rfc822 format available.
Message #29 received at 59617 <at> debbugs.gnu.org (full text, mbox):
> From: Theodor Thornhill <theo <at> thornhill.no>
> Cc: 59617 <at> debbugs.gnu.org, casouri <at> gmail.com
> Date: Mon, 28 Nov 2022 14:41:57 +0100
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > If we don't expect anyone reasonable to try that, fine. But if we do (and
> > a defcustom seems to say we do), then I'd provide a couple of other styles,
> > even if they are used much more rarely.
> >
>
> Ok, I can supply some more styles. This bug or a subsequent bug?
This one, I think. It's the same issue.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59617
; Package
emacs
.
(Mon, 28 Nov 2022 15:02:01 GMT)
Full text and
rfc822 format available.
Message #32 received at 59617 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Theodor Thornhill <theo <at> thornhill.no>
>> Cc: 59617 <at> debbugs.gnu.org, casouri <at> gmail.com
>> Date: Mon, 28 Nov 2022 14:41:57 +0100
>>
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>>
>> > If we don't expect anyone reasonable to try that, fine. But if we do (and
>> > a defcustom seems to say we do), then I'd provide a couple of other styles,
>> > even if they are used much more rarely.
>> >
>>
>> Ok, I can supply some more styles. This bug or a subsequent bug?
>
> This one, I think. It's the same issue.
Hmm, I really cannot seem to find any very specific, recognized styles
for any of the languages. I think either we go with this like it is
now, or wait until later altogether. My reasoning was that _if_ some
people have very specific needs we can accomodate that, but IMO it's a
little too time-consuming looking all around after styles that noone
uses :-) I'd rather focus on improving what we have.
Should we just close this? I'm fine either way.
Theo
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59617
; Package
emacs
.
(Mon, 28 Nov 2022 15:05:02 GMT)
Full text and
rfc822 format available.
Message #35 received at 59617 <at> debbugs.gnu.org (full text, mbox):
> From: Theodor Thornhill <theo <at> thornhill.no>
> Cc: 59617 <at> debbugs.gnu.org, casouri <at> gmail.com
> Date: Mon, 28 Nov 2022 16:00:58 +0100
>
> Hmm, I really cannot seem to find any very specific, recognized styles
> for any of the languages. I think either we go with this like it is
> now, or wait until later altogether. My reasoning was that _if_ some
> people have very specific needs we can accomodate that, but IMO it's a
> little too time-consuming looking all around after styles that noone
> uses :-) I'd rather focus on improving what we have.
>
> Should we just close this?
Feel free.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59617
; Package
emacs
.
(Mon, 28 Nov 2022 15:09:02 GMT)
Full text and
rfc822 format available.
Message #38 received at 59617 <at> debbugs.gnu.org (full text, mbox):
> Cc: casouri <at> gmail.com, 59617 <at> debbugs.gnu.org
> Date: Mon, 28 Nov 2022 17:05:07 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
>
> > From: Theodor Thornhill <theo <at> thornhill.no>
> > Cc: 59617 <at> debbugs.gnu.org, casouri <at> gmail.com
> > Date: Mon, 28 Nov 2022 16:00:58 +0100
> >
> > Hmm, I really cannot seem to find any very specific, recognized styles
> > for any of the languages. I think either we go with this like it is
> > now, or wait until later altogether. My reasoning was that _if_ some
> > people have very specific needs we can accomodate that, but IMO it's a
> > little too time-consuming looking all around after styles that noone
> > uses :-) I'd rather focus on improving what we have.
> >
> > Should we just close this?
>
> Feel free.
But please say in the doc string that the custom function is called with no
arguments.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59617
; Package
emacs
.
(Mon, 28 Nov 2022 16:31:01 GMT)
Full text and
rfc822 format available.
Message #41 received at 59617 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:
>> Cc: casouri <at> gmail.com, 59617 <at> debbugs.gnu.org
>> Date: Mon, 28 Nov 2022 17:05:07 +0200
>> From: Eli Zaretskii <eliz <at> gnu.org>
>>
>> > From: Theodor Thornhill <theo <at> thornhill.no>
>> > Cc: 59617 <at> debbugs.gnu.org, casouri <at> gmail.com
>> > Date: Mon, 28 Nov 2022 16:00:58 +0100
>> >
>> > Hmm, I really cannot seem to find any very specific, recognized styles
>> > for any of the languages. I think either we go with this like it is
>> > now, or wait until later altogether. My reasoning was that _if_ some
>> > people have very specific needs we can accomodate that, but IMO it's a
>> > little too time-consuming looking all around after styles that noone
>> > uses :-) I'd rather focus on improving what we have.
>> >
>> > Should we just close this?
>>
>> Feel free.
>
> But please say in the doc string that the custom function is called with no
> arguments.
Ok, added in this patch. Thanks!
Theo
[0001-Add-indent-styles-to-all-tree-sitter-modes.patch (text/x-diff, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59617
; Package
emacs
.
(Tue, 29 Nov 2022 06:12:02 GMT)
Full text and
rfc822 format available.
Message #44 received at 59617 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Rebased on emacs-29.
Theo
[0001-Add-indent-styles-to-all-tree-sitter-modes.patch (text/x-diff, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59617
; Package
emacs
.
(Tue, 29 Nov 2022 15:20:02 GMT)
Full text and
rfc822 format available.
Message #47 received at 59617 <at> debbugs.gnu.org (full text, mbox):
Theodor Thornhill <theo <at> thornhill.no> writes:
> Rebased on emacs-29.
>
Is this good to go or should I change something here?
Theo
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59617
; Package
emacs
.
(Tue, 29 Nov 2022 15:44:01 GMT)
Full text and
rfc822 format available.
Message #50 received at 59617 <at> debbugs.gnu.org (full text, mbox):
> From: Theodor Thornhill <theo <at> thornhill.no>
> Cc: casouri <at> gmail.com, 59617 <at> debbugs.gnu.org
> Date: Tue, 29 Nov 2022 16:19:26 +0100
>
> Theodor Thornhill <theo <at> thornhill.no> writes:
>
> > Rebased on emacs-29.
> >
>
> Is this good to go or should I change something here?
Good to go from my POV, but I wanted also to hear from Yuan.
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59617
; Package
emacs
.
(Wed, 30 Nov 2022 21:45:02 GMT)
Full text and
rfc822 format available.
Message #53 received at 59617 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Theodor Thornhill <theo <at> thornhill.no>
>> Cc: casouri <at> gmail.com, 59617 <at> debbugs.gnu.org
>> Date: Tue, 29 Nov 2022 16:19:26 +0100
>>
>> Theodor Thornhill <theo <at> thornhill.no> writes:
>>
>> > Rebased on emacs-29.
>> >
>>
>> Is this good to go or should I change something here?
>
> Good to go from my POV, but I wanted also to hear from Yuan.
>
> Thanks.
Hey sorry, I was busy with some other things. I’ve looked at the patch,
it seems adding a hook that sets treesit-simple-indent-rules would have
the same effect, no? (Ie, user already can set a custom indent style)
Like instead of
(defvar my-personal-csharp-mode-indent-rules (...))
(setq csharp-ts-mode-indent-style
(lambda () my-personal-csharp-mode-indent-rules))
you can just do
(defvar my-personal-csharp-mode-indent-rules (...))
(add-hook 'csharp-mode-hook
(lambda ()
(setq treesit-simple-indent-rules
my-personal-csharp-mode-indent-rules)))
This way there is no need to define a custom option and a function for
each mode. And users can use the same variable
treesit-simple-indent-rules, just in different major mode hooks.
Yuan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59617
; Package
emacs
.
(Wed, 30 Nov 2022 22:25:02 GMT)
Full text and
rfc822 format available.
Message #56 received at 59617 <at> debbugs.gnu.org (full text, mbox):
On 30 November 2022 22:44:39 CET, Yuan Fu <casouri <at> gmail.com> wrote:
>
>Eli Zaretskii <eliz <at> gnu.org> writes:
>
>>> From: Theodor Thornhill <theo <at> thornhill.no>
>>> Cc: casouri <at> gmail.com, 59617 <at> debbugs.gnu.org
>>> Date: Tue, 29 Nov 2022 16:19:26 +0100
>>>
>>> Theodor Thornhill <theo <at> thornhill.no> writes:
>>>
>>> > Rebased on emacs-29.
>>> >
>>>
>>> Is this good to go or should I change something here?
>>
>> Good to go from my POV, but I wanted also to hear from Yuan.
>>
>> Thanks.
>
>Hey sorry, I was busy with some other things. I’ve looked at the patch,
>it seems adding a hook that sets treesit-simple-indent-rules would have
>the same effect, no? (Ie, user already can set a custom indent style)
>Like instead of
>
>(defvar my-personal-csharp-mode-indent-rules (...))
>
>(setq csharp-ts-mode-indent-style
> (lambda () my-personal-csharp-mode-indent-rules))
>
>you can just do
>
>(defvar my-personal-csharp-mode-indent-rules (...))
>
>(add-hook 'csharp-mode-hook
> (lambda ()
> (setq treesit-simple-indent-rules
> my-personal-csharp-mode-indent-rules)))
>
>This way there is no need to define a custom option and a function for
>each mode. And users can use the same variable
>treesit-simple-indent-rules, just in different major mode hooks.
>
>Yuan
Hmm I think you're right, and I think I agree :)
Theo
Reply sent
to
Yuan Fu <casouri <at> gmail.com>
:
You have taken responsibility.
(Fri, 02 Dec 2022 05:27:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Theodor Thornhill <theo <at> thornhill.no>
:
bug acknowledged by developer.
(Fri, 02 Dec 2022 05:27:01 GMT)
Full text and
rfc822 format available.
Message #61 received at 59617-done <at> debbugs.gnu.org (full text, mbox):
Theodor Thornhill <theo <at> thornhill.no> writes:
> On 30 November 2022 22:44:39 CET, Yuan Fu <casouri <at> gmail.com> wrote:
>>
>>Eli Zaretskii <eliz <at> gnu.org> writes:
>>
>>>> From: Theodor Thornhill <theo <at> thornhill.no>
>>>> Cc: casouri <at> gmail.com, 59617 <at> debbugs.gnu.org
>>>> Date: Tue, 29 Nov 2022 16:19:26 +0100
>>>>
>>>> Theodor Thornhill <theo <at> thornhill.no> writes:
>>>>
>>>> > Rebased on emacs-29.
>>>> >
>>>>
>>>> Is this good to go or should I change something here?
>>>
>>> Good to go from my POV, but I wanted also to hear from Yuan.
>>>
>>> Thanks.
>>
>>Hey sorry, I was busy with some other things. I’ve looked at the patch,
>>it seems adding a hook that sets treesit-simple-indent-rules would have
>>the same effect, no? (Ie, user already can set a custom indent style)
>>Like instead of
>>
>>(defvar my-personal-csharp-mode-indent-rules (...))
>>
>>(setq csharp-ts-mode-indent-style
>> (lambda () my-personal-csharp-mode-indent-rules))
>>
>>you can just do
>>
>>(defvar my-personal-csharp-mode-indent-rules (...))
>>
>>(add-hook 'csharp-mode-hook
>> (lambda ()
>> (setq treesit-simple-indent-rules
>> my-personal-csharp-mode-indent-rules)))
>>
>>This way there is no need to define a custom option and a function for
>>each mode. And users can use the same variable
>>treesit-simple-indent-rules, just in different major mode hooks.
>>
>>Yuan
>
> Hmm I think you're right, and I think I agree :)
>
> Theo
Cool :-) I’m closing this then.
Yuan
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 30 Dec 2022 12:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 209 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.