[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: |
Sat, 06 Jan 2024 11:01:52 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
>> 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).
- bug#67463: 30.0.50; Eglot may manage js-json-mode buffers with wrong server,
Stefan Monnier <=