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
View this message in rfc822 format
On Sat, Jan 6, 2024 at 6:04 PM Dmitry Gutov <dmitry <at> gutov.dev> wrote:
>
> 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.
On 06/01/2024 18:01, Stefan Monnier
> 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.
(require 'cl-lib)
(defun derived-mode-remove-parent (mode parent)
(cl-macrolet ((allp (m) `(plist-get (symbol-plist ,m)
'derived-mode--all-parents))
(dmp (m) `(plist-get (symbol-plist ,m) 'derived-mode-parent)))
(setf (allp mode) (delq parent (allp mode)))
(when (eq (dmp mode) parent)
(setf (dmp mode) (dmp parent)))))
but Pengji can try to use it to do the following in the meantime:
(derived-mode-remove-parent 'js-json-mode 'js-mode)
(derived-mode-remove-parent 'js-json-mode 'js-base-mode)
thought the second one shouldn't strictly be needed at the moment.
João
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.