[Top][All Lists]

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

Re: c-ts-mode

From: João Távora
Subject: Re: c-ts-mode
Date: Fri, 08 Sep 2023 08:25:50 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

>> IMHO making c-ts-mode--indent-styles a public CL-style
>> generic function would be a good possibility.
> Sorry, I don't understand: since we already allow
> c-ts-mode-indent-style to be a function, why do we need any other
> function-based feature?

Not all functions are the same, and my idea is fundamentally different
than the current mechanism.  The current variable offered which can be
indeed a function has no concept of the "base set of rules" that you can
extend, modify, or splice your lists into them and neither does it
formalized way of when to do these things.

So in the current interface, the user has to specifically know where and
how to get the bae set, (which includes )exposing implementation

In my proposed interface, she doesn't.  She just codes the delta and the
conditions for overridding if she so wishe.

> If the only reason is that the function form of c-ts-mode-indent-style
> looks ugly to you, then I think this is in the eyes of the beholder;
> it doesn't look ugly to me, FWIW.

You may be confusing my proposal with one of a non-generic "normal"
function that you modify with add-function.  That's more-or-less the
same as a generic funtion (with :around, :before, :after, etc...)

So if you don't like CL stuff that has a more emacsy feel (but is
generally the same).  And of course a hook has an even more emacsy feel.

The advantage of my approach is the specialization in the arguments.

>> A defcustom-style thing for customize lovers can also be added,
>> later for people that don't like defgeneric.  Seems like a pretty
>> large DSL to code up in customize, though.
> What I had in mind was a simple alist, like CC Mode uses, with an
> infrastructure function to install it.  Patches are welcome.

It would certainly work for me, at least for my very simple case, and I
would be happy for this.  Not sure it is half as powerful, for example
how would you make that simple alist express cases where you want to add
the rules _after_ the base set?

Two alists?  I don't know if that is useful, but I seem to have read
somewhere in ts code that ordering is important.

Anyway, looking forward to see those patches, for the moment I've
supplied one.


reply via email to

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