unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Dmitry Gutov <dmitry@gutov.dev>
Cc: Pengji Zhang <kunhtkun@gmail.com>, Eli Zaretskii <eliz@gnu.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	67463@debbugs.gnu.org
Subject: bug#67463: 30.0.50; Eglot may manage js-json-mode buffers with wrong server
Date: Sun, 7 Jan 2024 01:57:59 +0000	[thread overview]
Message-ID: <CALDnm506xc2tNizomodzVFGb0zX8cDLYCh=_W7nzwdz42dZaMA@mail.gmail.com> (raw)
In-Reply-To: <2eeff48a-942a-463b-999c-4a615f67d052@gutov.dev>

On Sat, Jan 6, 2024 at 6:04 PM Dmitry Gutov <dmitry@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





  reply	other threads:[~2024-01-07  1:57 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
2024-01-06 18:04               ` Dmitry Gutov
2024-01-07  1:57                 ` João Távora [this message]
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='CALDnm506xc2tNizomodzVFGb0zX8cDLYCh=_W7nzwdz42dZaMA@mail.gmail.com' \
    --to=joaotavora@gmail.com \
    --cc=67463@debbugs.gnu.org \
    --cc=dmitry@gutov.dev \
    --cc=eliz@gnu.org \
    --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).