GNU bug report logs -
#67463
30.0.50; Eglot may manage js-json-mode buffers with wrong server
Previous Next
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
Message #26 received at 67463 <at> debbugs.gnu.org (full text, mbox):
>> 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).
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.