From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <83fs0k938h.fsf@gnu.org> <834jgio5os.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28208"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Pengji Zhang , Eli Zaretskii , 67463@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 06 17:03:20 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rM98q-00072n-95 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Jan 2024 17:03:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rM98U-0004Vq-NX; Sat, 06 Jan 2024 11:02:58 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rM98T-0004VC-Aw for bug-gnu-emacs@gnu.org; Sat, 06 Jan 2024 11:02:57 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rM98T-00056z-2x for bug-gnu-emacs@gnu.org; Sat, 06 Jan 2024 11:02:57 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rM98Y-0007Rn-2l for bug-gnu-emacs@gnu.org; Sat, 06 Jan 2024 11:03:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Jan 2024 16:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67463 X-GNU-PR-Package: emacs Original-Received: via spool by 67463-submit@debbugs.gnu.org id=B67463.170455692728566 (code B ref 67463); Sat, 06 Jan 2024 16:03:02 +0000 Original-Received: (at 67463) by debbugs.gnu.org; 6 Jan 2024 16:02:07 +0000 Original-Received: from localhost ([127.0.0.1]:60191 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rM97e-0007Qg-RZ for submit@debbugs.gnu.org; Sat, 06 Jan 2024 11:02:07 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:48336) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rM97d-0007QC-C0 for 67463@debbugs.gnu.org; Sat, 06 Jan 2024 11:02:05 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id E2A5C44171E; Sat, 6 Jan 2024 11:01:54 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1704556913; bh=iXrLflWLm6Kl0Junk3wePiMB8QBuKnUk9H+LJJSk31I=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ZBj1PJLL6xPqZPmCXUDjZMxVYZl9ZPk1EstuqhcK2CWhRDIHU6ytN45kS9EEMqc3r veuLPFVTmZ9dvMZyiOSd68xYs11pqiueH3jlPYsA8vzGSRjrULzZ7FJyw0JiDsjuhw DWUm/l7MwZPxJ4hJm1pfqNFQh3DeY1ARxjhVB7tc8L7cWpvP1DAy4rjutWgxbBdFAe rYW/20OrKbD6NbrP8/Y3wES1/4lYy9+/5axqYy1/V8/uIUUU1kYe89ItvRvGN614PM JVWZSgAA/T2xjUIDBvdWfaSxW+Jl+eJrCkd02+VbVcToDQ9OHifwpRCisUJVHg+vg8 LNpdPYdVY50uA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 96F9C44171F; Sat, 6 Jan 2024 11:01:53 -0500 (EST) Original-Received: from milanesa (65-110-221-238.cpe.pppoe.ca [65.110.221.238]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 5FFF31204DC; Sat, 6 Jan 2024 11:01:53 -0500 (EST) In-Reply-To: ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Sat, 16 Dec 2023 12:01:57 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:277469 Archived-At: >> 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).