[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#67463: 30.0.50; Eglot may manage js-json-mode buffers with wrong ser
From: |
Stefan Monnier |
Subject: |
bug#67463: 30.0.50; Eglot may manage js-json-mode buffers with wrong server |
Date: |
Sun, 07 Jan 2024 00:20:43 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
>> On 06/01/2024 18:01, Stefan Monnier via Bug reports for GNU Emacs, the
>> Swiss army knife of text editors wrote:
>> > -(define-derived-mode js-json-mode js-mode "JSON"
>> > +(define-derived-mode js-json-mode prog-mode "JSON"
>> > + (js-mode) ;; For expediency, reuse js-mode, but not as parent
>> > (bug#67463).
>>
>> Nice.
>
> I agree. If this works, I think it's quick, but not necessarily
> dirty.
It's dirty because it means `kill-all-local-variables` is called twice.
And there might be other bad side effects.
I suggest the patch below instead, which also "quick" but much less dirty.
>> Add a tool like `derived-mode-remove-parent`.
> Also agree, but the things we're doing in that symbol-plist
> seem to have gotten rather complicated lately, so I wouldn't
> be surpsied this is buggy in some edge case.
We'd first have to decide what is the behavior we want from it.
Note that `derived-mode-add-parents` doesn't really "add", it just sets
(i.e. overwrites) the list of extra-parents, so a corresponding behavior
would be for `derived-mode-remove-parent` to set a new property
`derived-mode-muted-parents`.
This said, I'm not at all sure we want/need that. It seems that its
only use-cases would be to fix erroneous inheritance as we have here in
`js-json-mode`, which are better fixed at the source.
If users wants to work around the problem before it's fixed at its
source, they can already do something like
(put 'js-json-mode 'derived-mode-parent nil)
-- Stefan