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

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

bug#68246: 30.0.50; Add non-TS mode as extra parent of TS modes


From: Yuan Fu
Subject: bug#68246: 30.0.50; Add non-TS mode as extra parent of TS modes
Date: Fri, 5 Jan 2024 19:19:46 -0800

I certainly welcome base-mode, I’m the one that added them in the first place. 
But I also want to point out that they are only a partial solution. For one, 
adding the base mode needs cooperation from all the major mode authors. For 
built-in modes, that’s not a (big) problem; for countless third-party modes out 
there, I don’t have high hopes for it.

The good thing about derived-mode-add-parents is that it doesn’t need major 
mode author’s cooperation. Even a normal user can do it themselves.

Then there is the problem Eli pointed out, base-mode hooks runs before child 
major mode body does. It’s probably fine for most of the things, but if you 
want to change some buffer local variable that the major mode sets, base-mode 
hook can’t help. (Arguable a niche use-case, but my point is base-mode hooks 
have their limits.)

Obviously derived-mode-add-parents can’t help with hooks. But adding the config 
to two hooks doesn’t seem to be too bad. Plus I haven’t come up with good 
solution. So I’m not too eager to solve that inconvenience. 


As for adding xxx-mode to xxx-ts-mode’s parent, I think it’s fine? Like others 
in the thread, I couldn’t think of a scenarios where this will be problematic. 
I thought about adding xxx-lang as the parent of both xxx-mode and xxx-ts-mode, 
but that’s probably not very helpful, since the goal is to make things work for 
ts-mode without needing to change the existing code, and using xxx-lang still 
requires modifying existing code.

Yuan




reply via email to

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