unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: "João Távora" <joaotavora@gmail.com>
Cc: Pengji Zhang <kunhtkun@gmail.com>, Eli Zaretskii <eliz@gnu.org>,
	67463@debbugs.gnu.org
Subject: bug#67463: 30.0.50; Eglot may manage js-json-mode buffers with wrong server
Date: Sat, 06 Jan 2024 11:01:52 -0500	[thread overview]
Message-ID: <jwv7ckm1mkx.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CALDnm50zUJOu9iBCJyCQRkBLUPcRQp7iy+N4Mo-GHNTM8Zuk1Q@mail.gmail.com> ("João Távora"'s message of "Sat, 16 Dec 2023 12:01:57 +0000")

>> So should we now close this bug?  Or is there something left to do
>> here?
> The problem is not solved and the workaround is tedious. There is something
> to be fixed, but outside Eglot.

Agreed.  I can see two solutions:

- Add a tool like `derived-mode-remove-parent`.
- Fix the definition of `js-json-mode` so it doesn't appear as a child
  of `js-mode`.

I think the second solution is best.
A quick&dirty way to do that could be the patch below.


        Stefan


diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 0115feb0e97..ac99c96166c 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3924,7 +3924,8 @@ js-ts--syntax-propertize
         (put-text-property (1- ne) ne 'syntax-table syntax)))))
 
 ;;;###autoload
-(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).
   (setq-local js-enabled-frameworks nil)
   ;; Speed up `syntax-ppss': JSON files can be big but can't hold
   ;; regexp matchers nor #! thingies (and `js-enabled-frameworks' is nil).






  reply	other threads:[~2024-01-06 16:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-26 21:15 bug#67463: 30.0.50; Eglot may manage js-json-mode buffers with wrong server Pengji Zhang
2023-12-02 12:51 ` Eli Zaretskii
2023-12-03 18:14   ` João Távora
2023-12-03 20:51     ` João Távora
2023-12-07  1:32       ` Pengji Zhang
2023-12-16  9:30         ` Eli Zaretskii
2023-12-16 12:01           ` João Távora
2024-01-06 16:01             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-01-06 18:04               ` Dmitry Gutov
2024-01-07  1:57                 ` João Távora
2024-01-07  5:20                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-08  0:20                     ` João Távora
2024-01-08  3:21                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-15  3:17                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv7ckm1mkx.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=67463@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=kunhtkun@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).