GNU bug report logs - #67463
30.0.50; Eglot may manage js-json-mode buffers with wrong server

Previous Next

Package: emacs;

Reported by: Pengji Zhang <kunhtkun <at> gmail.com>

Date: Sun, 26 Nov 2023 21:17:02 UTC

Severity: normal

Found in version 30.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: João Távora <joaotavora <at> gmail.com>
Cc: Dmitry Gutov <dmitry <at> gutov.dev>, Eli Zaretskii <eliz <at> gnu.org>, 67463 <at> debbugs.gnu.org, Pengji Zhang <kunhtkun <at> gmail.com>
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
>> 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





This bug report was last modified 1 year and 126 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.