From unknown Thu Jun 19 14:06:37 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#67463 <67463@debbugs.gnu.org> To: bug#67463 <67463@debbugs.gnu.org> Subject: Status: 30.0.50; Eglot may manage js-json-mode buffers with wrong server Reply-To: bug#67463 <67463@debbugs.gnu.org> Date: Thu, 19 Jun 2025 21:06:37 +0000 retitle 67463 30.0.50; Eglot may manage js-json-mode buffers with wrong ser= ver reassign 67463 emacs submitter 67463 Pengji Zhang severity 67463 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 26 16:16:31 2023 Received: (at submit) by debbugs.gnu.org; 26 Nov 2023 21:16:31 +0000 Received: from localhost ([127.0.0.1]:42781 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7MUQ-0003W8-KH for submit@debbugs.gnu.org; Sun, 26 Nov 2023 16:16:31 -0500 Received: from lists.gnu.org ([2001:470:142::17]:44278) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7MUL-0003Vr-Ua for submit@debbugs.gnu.org; Sun, 26 Nov 2023 16:16:29 -0500 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 1r7MU9-0005sC-JD for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2023 16:16:13 -0500 Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r7MU6-0004iu-HB for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2023 16:16:13 -0500 Received: by mail-qv1-xf2e.google.com with SMTP id 6a1803df08f44-67a3fabcee3so3499886d6.0 for ; Sun, 26 Nov 2023 13:16:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701033365; x=1701638165; darn=gnu.org; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=c3R6CuWqnY5ygK5goPE9QMf6dRLvEXqT8X4Qdu7kPmU=; b=UZUMfRSSC8qGf0tVVFHso8edv+lSN78sXtHfEa3/32eM2iZmiNjhZbS2Ln3G6VdP1z jK/AX3UdHvUMNUqlolQvmUtjnPY3IS+qJPMf4EOPJFfVPSua+/6BcsutXZfrZ1lGgEoC ZQ1wjX5PRrGHaJzDNTbyvoryUTBra02LfBaekxfyLKMpiho9gIzjDvu3NApzKycdiSjY RiArIMUP5DIPE03vqPqLnlaqUvMI8QZDIhuCzyP73r+9tLZXNIAHPEKVJtOJbZ7mfDrh 8XFYNEldlDE0PjuNrYpQzX8+MwosyrLtJYUe4y16Y5cqHpa9p1p/iF5RhENEOyBTsUDK aI/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701033365; x=1701638165; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=c3R6CuWqnY5ygK5goPE9QMf6dRLvEXqT8X4Qdu7kPmU=; b=s+3q2P66mlPZByocEEGE18LdNxWTOt8AE6jOB69EZGvmpNtm+KW9lTl7yUV9QmqqQm CguhTST6GfKjqNbzMtJHf3imKBztoWHGadkenMaxY6ayxSErD8+HBmdr5C6kgd8NkZ3E 1fWEjwcGhXOImcxXkPG9TkXwCMlOuyNWPSS3Hz4r7vnlBRvcCmjez6jLdyLNLrsDjew9 6+e1w0FAhseU2/a9GuChNao1eydEmi3bbgGhczGi/Xyx3lKz/8zs4nwn6BPP2uDoTlnS VClCmRZmI603kpWt+pIKAHPolrrGBTA6w+kKt5Rs12tdQ8Yhjf5f6XPEHRKwuZcyVxIB 8rLA== X-Gm-Message-State: AOJu0YyargK61Ev31tj496hELEXIBeUC4XQSrd2ry7vv4dl73PtPIK1Z dcEW3T48pFPJrb9xF88Pc7yeMJezZSLyVMq6VcnT4ywyaqQ= X-Google-Smtp-Source: AGHT+IHAAQAhmvsp60J2L7RN8JgQoSAgblIvgcr1dSyMUzt4bP1yxIm34gZ8T9beKVHMJ8gP/2hJXXIpRxTc9xgNqDE= X-Received: by 2002:a05:6214:1c86:b0:670:b327:c86f with SMTP id ib6-20020a0562141c8600b00670b327c86fmr15485113qvb.17.1701033364697; Sun, 26 Nov 2023 13:16:04 -0800 (PST) MIME-Version: 1.0 From: Pengji Zhang Date: Sun, 26 Nov 2023 16:15:54 -0500 Message-ID: Subject: 30.0.50; Eglot may manage js-json-mode buffers with wrong server To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::f2e; envelope-from=kunhtkun@gmail.com; helo=mail-qv1-xf2e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) It seems that buffers in `js-json-mode', the default mode for JSON files, could be wrongly managed by JavaScript language servers of Eglot, perhaps because: - `js-json-mode' is derived from `js-mode'; - Eglot uses `provided-mode-derived-p' to determine whether a buffer should be managed by a server. Here is a recipe to reproduce the problem I encountered: 1. Install Node.js[0] and NPM[1]. (Sorry, but I could not find an easier way to set up the environment. They may be installable with your system's package manager.) 2. mkdir /tmp/repro && cd /tmp/repro 3. npm install typescript typescript-language-server (This will install the language server locally in the directory.) 4. emacs -Q 5. C-x C-f main.js RET 6. C-u M-x eglot; enter "npx typescript-language-server --stdio" 7. C-x C-f package.json RET (This file is automatically created by `npm install'.) I expect that the 'package.json' buffer is not managed by Eglot, but it is actually managed by typescript-language-server, which does not really understand JSON and is reporting some invalid errors. Thanks! [0] https://nodejs.org/en [1] https://docs.npmjs.com/downloading-and-installing-node-js-and-npm ----- Auxiliary information: - Emacs version: 30.0.50 (commit ea4c5fcd77257d7a7c050714b809b1507d93a6ef) - Eglot version: 1.15 (comes with the Emacs repository of the commit above) - Contents of `eglot-events-buffer': [internal] Sun Nov 26 15:24:00 2023: (:message "Running language server: npx typescript-language-server --stdio") [client-request] (id:1) Sun Nov 26 15:24:00 2023: (:jsonrpc "2.0" :id 1 :method "initialize" :params (:processId 26705 :clientInfo (:name "Eglot" :version "1.15") :rootPath "/tmp/eglot-bug/" :rootUri "file:///tmp/eglot-bug" :initializationOptions #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data ()) :capabilities (:workspace (:applyEdit t :executeCommand (:dynamicRegistration :json-false) :workspaceEdit (:documentChanges t) :didChangeWatchedFiles (:dynamicRegistration t) :symbol (:dynamicRegistration :json-false) :configuration t :workspaceFolders t) :textDocument (:synchronization (:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t) :completion (:dynamicRegistration :json-false :completionItem (:snippetSupport :json-false :deprecatedSupport t :resolveSupport (:properties ["documentation" "details" "additionalTextEdits"]) :tagSupport (:valueSet [1])) :contextSupport t) :hover (:dynamicRegistration :json-false :contentFormat ["plaintext"]) :signatureHelp (:dynamicRegistration :json-false :signatureInformation (:parameterInformation (:labelOffsetSupport t) :documentationFormat ["plaintext"] :activeParameterSupport t)) :references (:dynamicRegistration :json-false) :definition (:dynamicRegistration :json-false :linkSupport t) :declaration (:dynamicRegistration :json-false :linkSupport t) :implementation (:dynamicRegistration :json-false :linkSupport t) :typeDefinition (:dynamicRegistration :json-false :linkSupport t) :documentSymbol (:dynamicRegistration :json-false :hierarchicalDocumentSymbolSupport t :symbolKind (:valueSet [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26])) :documentHighlight (:dynamicRegistration :json-false) :codeAction (:dynamicRegistration :json-false :resolveSupport (:properties ["edit" "command"]) :dataSupport t :codeActionLiteralSupport (:codeActionKind (:valueSet ["quickfix" "refactor" "refactor.extract" "refactor.inline" "refactor.rewrite" "source" "source.organizeImports"])) :isPreferredSupport t) :formatting (:dynamicRegistration :json-false) :rangeFormatting (:dynamicRegistration :json-false) :rename (:dynamicRegistration :json-false) :inlayHint (:dynamicRegistration :json-false) :publishDiagnostics (:relatedInformation :json-false :codeDescriptionSupport :json-false :tagSupport (:valueSet [1 2]))) :window (:showDocument (:support t) :workDoneProgress t) :general (:positionEncodings ["utf-32" "utf-8" "utf-16"]) :experimental #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data ())) :workspaceFolders [(:uri "file:///tmp/eglot-bug" :name "/tmp/eglot-bug/")])) [server-notification] Sun Nov 26 15:24:01 2023: (:jsonrpc "2.0" :method "window/logMessage" :params (:type 3 :message "Using Typescript version (workspace) 5.3.2 from path \"/tmp/eglot-bug/node_modules/typescript/lib/tsserver.js\"")) [server-request] (id:0) Sun Nov 26 15:24:01 2023: (:jsonrpc "2.0" :id 0 :method "window/workDoneProgress/create" :params (:token "3a0c42cc-0696-45e3-b763-564b150099bb")) [client-reply] (id:0) Sun Nov 26 15:24:01 2023: (:jsonrpc "2.0" :id 0 :result nil) [server-reply] (id:1) Sun Nov 26 15:24:01 2023: (:jsonrpc "2.0" :id 1 :result (:capabilities (:textDocumentSync 2 :completionProvider (:triggerCharacters ["." "\"" "'" "/" "@" "<"] :resolveProvider t) :codeActionProvider (:codeActionKinds ["source.fixAll.ts" "source.removeUnused.ts" "source.addMissingImports.ts" "source.organizeImports.ts" "source.removeUnusedImports.ts" "source.sortImports.ts" "quickfix" "refactor"]) :codeLensProvider (:resolveProvider t) :definitionProvider t :documentFormattingProvider t :documentRangeFormattingProvider t :documentHighlightProvider t :documentSymbolProvider t :executeCommandProvider (:commands ["_typescript.applyWorkspaceEdit" "_typescript.applyCodeAction" "_typescript.applyRefactoring" "_typescript.configurePlugin" "_typescript.organizeImports" "_typescript.applyRenameFile" "_typescript.goToSourceDefinition"]) :hoverProvider t :inlayHintProvider t :linkedEditingRangeProvider :json-false :renameProvider t :referencesProvider t :selectionRangeProvider t :signatureHelpProvider (:triggerCharacters ["(" "," "<"] :retriggerCharacters [")"]) :workspaceSymbolProvider t :implementationProvider t :typeDefinitionProvider t :foldingRangeProvider t :semanticTokensProvider (:documentSelector nil :legend (:tokenTypes ["class" "enum" "interface" "namespace" "typeParameter" "type" "parameter" "variable" "enumMember" "property" "function" "member"] :tokenModifiers ["declaration" "static" "async" "readonly" "defaultLibrary" "local"]) :full t :range t) :workspace (:fileOperations (:willRename (:filters [(:scheme "file" :pattern (:glob "**/*.{ts,js,jsx,tsx,mjs,mts,cjs,cts}" :matches "file"))])))))) [client-notification] Sun Nov 26 15:24:01 2023: (:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data ())) [client-notification] Sun Nov 26 15:24:01 2023: (:jsonrpc "2.0" :method "textDocument/didOpen" :params (:textDocument (:uri "file:///tmp/eglot-bug/main.js" :version 0 :languageId "javascript" :text ""))) [client-notification] Sun Nov 26 15:24:01 2023: (:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params (:settings #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data ()))) [server-notification] Sun Nov 26 15:24:01 2023: (:jsonrpc "2.0" :method "$/progress" :params (:token "3a0c42cc-0696-45e3-b763-564b150099bb" :value (:kind "begin" :title "Initializing JS/TS language features=C3=A2=E2=82=AC=C2=A6"))) [server-notification] Sun Nov 26 15:24:01 2023: (:jsonrpc "2.0" :method "$/typescriptVersion" :params (:version "5.3.2" :source "workspace")) [client-request] (id:2) Sun Nov 26 15:24:01 2023: (:jsonrpc "2.0" :id 2 :method "textDocument/hover" :params (:textDocument (:uri "file:///tmp/eglot-bug/main.js") :position (:line 0 :character 0))) [client-request] (id:3) Sun Nov 26 15:24:01 2023: (:jsonrpc "2.0" :id 3 :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///tmp/eglot-bug/main.js") :position (:line 0 :character 0))) [client-request] (id:4) Sun Nov 26 15:24:01 2023: (:jsonrpc "2.0" :id 4 :method "textDocument/signatureHelp" :params (:textDocument (:uri "file:///tmp/eglot-bug/main.js") :position (:line 0 :character 0))) [server-reply] (id:3) Sun Nov 26 15:24:02 2023: (:jsonrpc "2.0" :id 3 :result []) [server-reply] (id:4) Sun Nov 26 15:24:02 2023: (:jsonrpc "2.0" :id 4 :result nil) [server-reply] (id:2) Sun Nov 26 15:24:02 2023: (:jsonrpc "2.0" :id 2 :result nil) [server-notification] Sun Nov 26 15:24:02 2023: (:jsonrpc "2.0" :method "$/progress" :params (:token "3a0c42cc-0696-45e3-b763-564b150099bb" :value (:kind "end"))) [server-notification] Sun Nov 26 15:24:02 2023: (:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params (:uri "file:///tmp/eglot-bug/main.js" :diagnostics [])) [server-notification] Sun Nov 26 15:24:05 2023: (:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params (:uri "file:///tmp/eglot-bug/main.js" :diagnostics [])) [server-notification] Sun Nov 26 15:24:05 2023: (:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params (:uri "file:///tmp/eglot-bug/main.js" :diagnostics [])) [client-notification] Sun Nov 26 15:24:19 2023: (:jsonrpc "2.0" :method "textDocument/didOpen" :params (:textDocument (:uri "file:///tmp/eglot-bug/package.json" :version 0 :languageId "javascript" :text "{\n \"dependencies\": {\n \"typescript\": \"^5.3.2\",\n \"typescript-language-server\": \"^4.1.2\"\n }\n}\n"))) [client-request] (id:5) Sun Nov 26 15:24:19 2023: (:jsonrpc "2.0" :id 5 :method "textDocument/inlayHint" :params (:textDocument (:uri "file:///tmp/eglot-bug/package.json") :range (:start (:line 0 :character 0) :end (:line 6 :character 0)))) [server-reply] (id:5) Sun Nov 26 15:24:19 2023: (:jsonrpc "2.0" :id 5 :result []) [server-notification] Sun Nov 26 15:24:19 2023: (:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params (:uri "file:///tmp/eglot-bug/package.json" :diagnostics [(:range (:start (:line 1 :character 16) :end (:line 1 :character 17)) :message "';' expected." :severity 1 :code 1005 :source "typescript" :tags []) (:range (:start (:line 2 :character 16) :end (:line 2 :character 17)) :message "';' expected." :severity 1 :code 1005 :source "typescript" :tags []) (:range (:start (:line 3 :character 32) :end (:line 3 :character 33)) :message "';' expected." :severity 1 :code 1005 :source "typescript" :tags [])])) In GNU Emacs 30.0.50 (build 11, x86_64-pc-linux-gnu) Repository revision: ea4c5fcd77257d7a7c050714b809b1507d93a6ef Repository branch: master Configured using: 'configure --prefix=3D/home/pengji/.local --without-x --program-transform-name=3Ds/^ctags/ctags.emacs/ --disable-build-details PKG_CONFIG_PATH=3D/home/pengji/.local/share/pkgconfig:/home/pengji/.local/= lib/pkgconfig:/home/pengji/.local/share/pkgconfig:/home/pengji/.local/lib/p= kgconfig:' Configured features: GNUTLS LIBXML2 MODULES NOTIFY INOTIFY PDUMPER SOUND SQLITE3 THREADS TREE_SITTER ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Info Minor modes in effect: mouse-wheel-mode: t tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t menu-bar-mode: t file-name-shadow-mode: t isearch-fold-quotes-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t buffer-read-only: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dnd dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils mule-util info time-date cl-extra eglot external-completion jsonrpc xref flymake mwheel thingatpt project diff diff-mode easy-mmode ert pp ewoc debug backtrace help-mode find-func filenotify warnings icons compile text-property-search tool-bar pcase url-util url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache url-vars sh-script rx smie executable files-x shell pcomplete comint ansi-osc ansi-color ring js c-ts-common treesit json subr-x map imenu cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs regexp-opt cl-loaddefs cl-lib term/tmux term/xterm xterm byte-opt gv bytecomp byte-compile rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode touch-screen tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads inotify multi-tty make-network-process emacs) Memory information: ((conses 16 134366 14563) (symbols 48 13684 0) (strings 32 42470 2356) (string-bytes 1 1456015) (vectors 16 24965) (vector-slots 8 306626 12688) (floats 8 58 9041) (intervals 56 548 1368) (buffers 992 20) (heap 1024 7552 769)) From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 02 07:52:01 2023 Received: (at 67463) by debbugs.gnu.org; 2 Dec 2023 12:52:01 +0000 Received: from localhost ([127.0.0.1]:56862 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r9PTU-0006Ia-KR for submit@debbugs.gnu.org; Sat, 02 Dec 2023 07:52:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41930) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r9PTR-0006IM-R8 for 67463@debbugs.gnu.org; Sat, 02 Dec 2023 07:51:58 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r9PTD-0005A9-6T; Sat, 02 Dec 2023 07:51:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=gVIpdo/d94uveq3UwqacRs+HckyPQpI5dXRiGrCpQn0=; b=FsI0DA/basBV7KkT93pM 97i6EVsTSjtagTYEIsmzpTfr/upHevBY4CkRxYksD5oIiGgbatvZRRZQ2uoEwUrEvH/ft6Hnxvkvq i/6R4T8tz2rAW7N0+4ToewG9ZSoXk03EBo6mmbzVvVikTWHzAiRSDb3AdUSfenCnkWgsvFx4SqlO1 TZq8sseaBvfjUalJNkDEHNRrws1ndimOvGVdpyYtLTTOZDFeU79MgBe9s4JadmQ0w1K/XlA4I2JpU IbiBeDLLthsneLzMZgobxaHDVayFFOjfaN5JSaOn/NtvTqmvsO/1+26Ft2yz03TQIscjgpfd6T5FJ 81waur5YfFg1Tw==; Date: Sat, 02 Dec 2023 14:51:42 +0200 Message-Id: <83fs0k938h.fsf@gnu.org> From: Eli Zaretskii To: Pengji Zhang , =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= In-Reply-To: (message from Pengji Zhang on Sun, 26 Nov 2023 16:15:54 -0500) Subject: Re: bug#67463: 30.0.50; Eglot may manage js-json-mode buffers with wrong server References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67463 Cc: 67463@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Pengji Zhang > Date: Sun, 26 Nov 2023 16:15:54 -0500 > > It seems that buffers in `js-json-mode', the default mode for JSON > files, could be wrongly managed by JavaScript language servers of Eglot, > perhaps because: > > - `js-json-mode' is derived from `js-mode'; > - Eglot uses `provided-mode-derived-p' to determine whether a buffer > should be managed by a server. > > Here is a recipe to reproduce the problem I encountered: > > 1. Install Node.js[0] and NPM[1]. (Sorry, but I could not find an > easier way to set up the environment. They may be installable with > your system's package manager.) > 2. mkdir /tmp/repro && cd /tmp/repro > 3. npm install typescript typescript-language-server (This will install > the language server locally in the directory.) > 4. emacs -Q > 5. C-x C-f main.js RET > 6. C-u M-x eglot; enter "npx typescript-language-server --stdio" > 7. C-x C-f package.json RET (This file is automatically created by > `npm install'.) > > I expect that the 'package.json' buffer is not managed by Eglot, but it > is actually managed by typescript-language-server, which does not really > understand JSON and is reporting some invalid errors. > > Thanks! > > [0] https://nodejs.org/en > [1] https://docs.npmjs.com/downloading-and-installing-node-js-and-npm João, any suggestions? From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 03 13:15:02 2023 Received: (at 67463) by debbugs.gnu.org; 3 Dec 2023 18:15:02 +0000 Received: from localhost ([127.0.0.1]:60836 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r9qze-0008OK-3a for submit@debbugs.gnu.org; Sun, 03 Dec 2023 13:15:02 -0500 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]:46398) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r9qzZ-0008Ne-UY for 67463@debbugs.gnu.org; Sun, 03 Dec 2023 13:15:00 -0500 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-50bf898c43cso73577e87.1 for <67463@debbugs.gnu.org>; Sun, 03 Dec 2023 10:14:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701627282; x=1702232082; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=rLpKYEZTHQxnJbvB705QuFDSed4wiAdtpzTavOGyY38=; b=NwibEeKbY04OH9kM9mSP/UVLTC8lkbBeD4sE3BaTKkySqsOIWeandOi/dLPGKPy/qn DD3nHY2qq1/bpL6eRYYSNvzm2jYbMcwpv4gOwuUlOd/qvgQcMOmPksSh/XvouQIyErRx 4xZXmku8YNHJmM8jqbH+/hC4UXrnZ0HHaA8rKIZMepJGiXuvk+cqn7RCuiPwgGTeeHMI T2Qa87D42QoqU5w+/A11QjK1G23F5h257dyVWSAQPFPENyGkjBXRyX2YIaGPP4JF6eXu 98dwFesMdR+zT6kuvXUG9OXXrik9R5H/TKa4WpbF3moQewBoZkEeWAUM82K7Ug1vuqvs NyfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701627282; x=1702232082; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rLpKYEZTHQxnJbvB705QuFDSed4wiAdtpzTavOGyY38=; b=Vc+vs8g8HfbPIwlzaYquZ6fCQgqTWyVFOK5GBIMAJvA3bdkhPgZYFsAJJw7MSVnGA4 G05cFPI5ozqI6KkIb4rvy8ckbKUHjXlgYyBt+82DTLPLj/rynNkfQtQR33UeX5+Am2hr uQpDTk2USjZjgi5XFO7Y6PjyZaFGYt2J8UuV8xhUmMRnQobqu7164M9igSXxowA+8/so /9nCX17jpTL+LWv8/hm18sfqZCb625ORMYSW7KATbpSWxS0gVPNuMyVcAL3gqWIGBAOf /NLG2b0PjZZhyus/SNGfJJYCklp+Ake5/gUXc4nupuHXVL/ka9Il4x5fieMLxrhbSGqK w4Pw== X-Gm-Message-State: AOJu0YzS8NKob/zSivDIP4+lXLiRUW4qYB4uJ/mHi07db5uXo7Y4Nv1k eb9DWsbGMGcsoFKvOfUVCWlhgATgXmYxD4sY7J4= X-Google-Smtp-Source: AGHT+IEdqPDztLzHuHG/iZSRUuXJC6pAhk6CBkZeG1jns+mvOcQBQuEXyf3BVhikkT7Bdy0Bf2WUq/7sSUMV3zaTf5w= X-Received: by 2002:a19:760e:0:b0:50b:f817:9351 with SMTP id c14-20020a19760e000000b0050bf8179351mr69014lff.174.1701627281466; Sun, 03 Dec 2023 10:14:41 -0800 (PST) MIME-Version: 1.0 References: <83fs0k938h.fsf@gnu.org> In-Reply-To: <83fs0k938h.fsf@gnu.org> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Date: Sun, 3 Dec 2023 18:14:30 +0000 Message-ID: Subject: Re: bug#67463: 30.0.50; Eglot may manage js-json-mode buffers with wrong server To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 67463 Cc: Pengji Zhang , 67463@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Sat, Dec 2, 2023 at 12:51=E2=80=AFPM Eli Zaretskii wrote: > > > From: Pengji Zhang > > Date: Sun, 26 Nov 2023 16:15:54 -0500 > > > > It seems that buffers in `js-json-mode', the default mode for JSON > > files, could be wrongly managed by JavaScript language servers of Eglot= , > > perhaps because: > > > > - `js-json-mode' is derived from `js-mode'; > > - Eglot uses `provided-mode-derived-p' to determine whether a buffer > > should be managed by a server. > > > > Here is a recipe to reproduce the problem I encountered: > > > > 1. Install Node.js[0] and NPM[1]. (Sorry, but I could not find an > > easier way to set up the environment. They may be installable with > > your system's package manager.) > > 2. mkdir /tmp/repro && cd /tmp/repro > > 3. npm install typescript typescript-language-server (This will insta= ll > > the language server locally in the directory.) > > 4. emacs -Q > > 5. C-x C-f main.js RET > > 6. C-u M-x eglot; enter "npx typescript-language-server --stdio" > > 7. C-x C-f package.json RET (This file is automatically created by > > `npm install'.) > > > > I expect that the 'package.json' buffer is not managed by Eglot, but it > > is actually managed by typescript-language-server, which does not reall= y > > understand JSON and is reporting some invalid errors. > > > > Thanks! > > > > [0] https://nodejs.org/en > > [1] https://docs.npmjs.com/downloading-and-installing-node-js-and-npm > > Jo=C3=A3o, any suggestions? Thanks Eli. Yes, some notes: 1. JSON is technically Javascript (but only really technically, in actual programming practice it's not much use editing JSON as Javascript) 2. For the above reason the derivation of `json-json-mode` from `js-mode` is technically correct. When looking at a JSON file you are technically looking at some minimalistic Javascript code. 3. It wouldn't be a bad idea for Emacs to do whatever behaviour-reuse it is doing for 'js-json-mode' with inheritance from 'js-mode' with some other mechanism like composition. This would immediately solve Pengji's problem. But it is not trivial to do so. 4. It follows from 1 and 2 that this problem can be viewed as a bug in typescript-language-server. It's complaining we're not giving it a Javascript file, but it has no reason to complain: we are! Not sure if it's worth arguing with the server devs like so. Maybe. 5. A more promising change that can be tried today is to make use of Eglot's :language-id feature, which is already in place for this family of modes. The current one looks like this: (((js-mode :language-id "javascript") (js-ts-mode :language-id "javascript") (tsx-ts-mode :language-id "typescriptreact") (typescript-ts-mode :language-id "typescript") (typescript-mode :language-id "typescript")) . ("typescript-language-server" "--stdio")) Which means that any Javascript file is reported as javascript. Maybe just adding (js-json-mode :language-id "json") there would work. In other words, this patch: --- ./lisp/progmodes/eglot.el +++ # @@ -222,6 +222,7 @@ ("vscode-json-languageserver" "--stdio") ("json-languageserver" "--stdio")))) (((js-mode :language-id "javascript") + (js-json-mode :language-id "json") (js-ts-mode :language-id "javascript") (tsx-ts-mode :language-id "typescriptrea= ct") (typescript-ts-mode :language-id "typescript") From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 03 15:51:35 2023 Received: (at 67463) by debbugs.gnu.org; 3 Dec 2023 20:51:35 +0000 Received: from localhost ([127.0.0.1]:32851 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r9tR8-0007BE-Ks for submit@debbugs.gnu.org; Sun, 03 Dec 2023 15:51:35 -0500 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]:54273) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r9tR4-0007As-1G for 67463@debbugs.gnu.org; Sun, 03 Dec 2023 15:51:33 -0500 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-50bc21821a1so5207957e87.0 for <67463@debbugs.gnu.org>; Sun, 03 Dec 2023 12:51:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701636674; x=1702241474; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=7ZevwNdAhqxx5JqlOisszy5Q4SnSwyBdHCZWX5sckHE=; b=fkHJa3ktSIcaPch1chSmdCSMNQmJm7crZ+u/z9bnWdJ15mLUHYMlc6AW+D8vhNd0Cn 3qrO4Xb0AS65GJ+aX1kRbkBXFVOsFwTPVYHY7Tlw+L11L+UyXqMfxCCmACqRPoNDkA8T Nq5reqne8BLUj+XQM+bAGYXiL1ILUEq9l74fcp3QVHN+ggr/JetB+0qrfjDNL6OyTIlM l3xmvrbFJg1ssQ+hXTbxmR9c1qer2/dgHvd6Tkg2dsAaZ+kFg6uiMOb8F9cH3biEQWlZ KMABq+6kKn/L+2aweOfQDXO20LUyNtrwHaqDCiwr/qdgJhFbZ+xGPT9DR2wXAf6UV0Kt b62Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701636674; x=1702241474; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7ZevwNdAhqxx5JqlOisszy5Q4SnSwyBdHCZWX5sckHE=; b=L832yA7D8dMxWZBNnLrGEQsyZKu7J+h1uIu62dXlia6lzmIN8TfxMWQqnO3S3htAR/ hinzXlsjRbX5kuedMEuzJ7JMHuIfMN0UwYRmsO7cCyUrpFuJ4P//xld8YDqzKTKN1jVT fyCgztiNASs/uCZpOT2iJc68qSM8r1HxBpRa9NxDysyLcYIaF6OksPpnfTEq6Eme0v1E jodmvOiU5AvWkDcNlgDQRwdkUiZV0raUFw11zvZ5HkG8x2n1IlktOFt8hLHqiYDdBkJV Fm2G5rdM5iUPX9ZPbW4BJhLAyo1xHYmtlECKvk2YL1nyA1ldbcQ6c0oDfqBa/2SkI7xD AIiA== X-Gm-Message-State: AOJu0YwDG2xgyRuSO0BIogqrUo5KqHdUZKFKCUw9YLcnXsjXiQbjyd7/ RqjE104UJMUFCJP2mimM5m9Ut0VeYXjEd7mKVFA= X-Google-Smtp-Source: AGHT+IFDJnQE+inpscPzP0pMRrrBfIDRIqTnFTk/IyNzOoDQBOiaXUwB6MsCKMVYlFpoKkzeXD5GzpI8rJUYFL7Gt4U= X-Received: by 2002:ac2:4e84:0:b0:50b:ee1e:376b with SMTP id o4-20020ac24e84000000b0050bee1e376bmr691152lfr.113.1701636673519; Sun, 03 Dec 2023 12:51:13 -0800 (PST) MIME-Version: 1.0 References: <83fs0k938h.fsf@gnu.org> In-Reply-To: From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Date: Sun, 3 Dec 2023 20:51:02 +0000 Message-ID: Subject: Re: bug#67463: 30.0.50; Eglot may manage js-json-mode buffers with wrong server To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 67463 Cc: Pengji Zhang , 67463@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Sun, Dec 3, 2023 at 6:14=E2=80=AFPM Jo=C3=A3o T=C3=A1vora wrote: > > On Sat, Dec 2, 2023 at 12:51=E2=80=AFPM Eli Zaretskii wrot= e: > > > > > From: Pengji Zhang > > > Date: Sun, 26 Nov 2023 16:15:54 -0500 > > > > > > It seems that buffers in `js-json-mode', the default mode for JSON > > > files, could be wrongly managed by JavaScript language servers of Egl= ot, > > > perhaps because: > > > > > > - `js-json-mode' is derived from `js-mode'; > > > - Eglot uses `provided-mode-derived-p' to determine whether a buffe= r > > > should be managed by a server. > > > > > > Here is a recipe to reproduce the problem I encountered: > > > > > > 1. Install Node.js[0] and NPM[1]. (Sorry, but I could not find an > > > easier way to set up the environment. They may be installable wi= th > > > your system's package manager.) > > > 2. mkdir /tmp/repro && cd /tmp/repro > > > 3. npm install typescript typescript-language-server (This will ins= tall > > > the language server locally in the directory.) > > > 4. emacs -Q > > > 5. C-x C-f main.js RET > > > 6. C-u M-x eglot; enter "npx typescript-language-server --stdio" > > > 7. C-x C-f package.json RET (This file is automatically created by > > > `npm install'.) > > > > > > I expect that the 'package.json' buffer is not managed by Eglot, but = it > > > is actually managed by typescript-language-server, which does not rea= lly > > > understand JSON and is reporting some invalid errors. > > > > > > Thanks! > > > > > > [0] https://nodejs.org/en > > > [1] https://docs.npmjs.com/downloading-and-installing-node-js-and-npm > > > > Jo=C3=A3o, any suggestions? > > > Thanks Eli. Yes, some notes: > > 1. JSON is technically Javascript (but only really technically, in actual > programming practice it's not much use editing JSON as Javascript) > > 2. For the above reason the derivation of `json-json-mode` from `js-mode` > is technically correct. When looking at a JSON file you are technical= ly > looking at some minimalistic Javascript code. > > 3. It wouldn't be a bad idea for Emacs to do whatever behaviour-reuse it > is doing for 'js-json-mode' with inheritance from 'js-mode' with some > other mechanism like composition. This would immediately solve Pengji= 's > problem. But it is not trivial to do so. > > 4. It follows from 1 and 2 that this problem can be viewed as a bug in > typescript-language-server. It's complaining we're not giving it > a Javascript file, but it has no reason to complain: we are! Not sure > if it's worth arguing with the server devs like so. Maybe. > > 5. A more promising change that can be tried today is to make use > of Eglot's :language-id feature, which is already in place for this > family of modes. The current one looks like this: > > (((js-mode :language-id "javascript") > (js-ts-mode :language-id "javascript") > (tsx-ts-mode :language-id "typescriptreact") > (typescript-ts-mode :language-id "typescript") > (typescript-mode :language-id "typescript")) > . ("typescript-language-server" "--stdio")) > > Which means that any Javascript file is reported as javascript. > Maybe just adding > > (js-json-mode :language-id "json") > > there would work. Nope this doesn't work. Even the slightly more involved patch after my sig doesn't work, and it correctly reports the :languageId as "json" So I think the best courses of action are 3 and 4, in that order. Another workaround is to first start M-x eglot in some json file in your project. If you have one of: . ,(eglot-alternatives '(("vscode-json-language-server" "--stdio") ("vscode-json-languageserver" "--stdio") ("json-languageserver" "--stdio")))) installed, then these json-specific servers should start to manage js-json-mode files in your project. If afterwards you start M-x eglot in a plain js file, that server won't be (erroneously) used to manage JSON files. Jo=C3=A3o diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index d410367f902..5cfd5baa225 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -222,6 +222,7 @@ eglot-server-programs ("vscode-json-languageserver" "--stdio") ("json-languageserver" "--stdio")))) (((js-mode :language-id "javascript") + (js-json-mode :language-id "json") ;; bug#67463 (js-ts-mode :language-id "javascript") (tsx-ts-mode :language-id "typescriptrea= ct") (typescript-ts-mode :language-id "typescript") @@ -2493,10 +2494,12 @@ eglot--languageId "Compute LSP \\=3D'languageId\\=3D' string for current buffer. Doubles as an predicate telling if SERVER can manage current buffer." - (cl-loop for (mode . languageid) in - (eglot--languages server) - when (provided-mode-derived-p major-mode mode) - return languageid)) + ;; bug#67463 + (cl-loop for pred in (list #'equal #'provided-mode-derived-p) + thereis (cl-loop for (mode . languageid) in + (eglot--languages server) + when (funcall pred major-mode mode) + return languageid))) (defun eglot--TextDocumentItem () "Compute TextDocumentItem object for current buffer." From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 06 20:33:11 2023 Received: (at 67463) by debbugs.gnu.org; 7 Dec 2023 01:33:11 +0000 Received: from localhost ([127.0.0.1]:40737 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rB3GJ-0003Dj-Bs for submit@debbugs.gnu.org; Wed, 06 Dec 2023 20:33:11 -0500 Received: from mail-qv1-xf2a.google.com ([2607:f8b0:4864:20::f2a]:51317) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rB3GH-0003DW-29 for 67463@debbugs.gnu.org; Wed, 06 Dec 2023 20:33:10 -0500 Received: by mail-qv1-xf2a.google.com with SMTP id 6a1803df08f44-67adac40221so2952906d6.2 for <67463@debbugs.gnu.org>; Wed, 06 Dec 2023 17:32:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701912771; x=1702517571; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=cLDUqF7qLhoDuhdL/Phav1pMizH5TC3pK/v4/jUnMok=; b=XqKt+UcmJcHNI67Y2eNxcH2JT0iGV/EZUiymQ6nnifndrcWc64Lb0eY1gfB+plX/2P 6LG3R69Hxy2DCDYm23XMHZhe4wAN59f8uoqYvEpbX8BXk0wq97evT9kj47YKlyWG73Vi X+R5R9j5kvIgZCzFSaQmf4RIf7ykUTz9Doxtwj9HF966xtFDRQhw5tGcvlkaO0fouTdo zm4nD9B3SD97RC/VdeDnXBBGvSz1kzkqLmioOEouCtCOXle5euD5sp6hJqvXDZRC2FiQ JWjiCMbAVOp5WobhYAm1OxE+UqGDDxkshsnXJ7vsFkc5ENx2HUjmq2iK6XvmpPvM4GJW uUOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701912771; x=1702517571; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cLDUqF7qLhoDuhdL/Phav1pMizH5TC3pK/v4/jUnMok=; b=uj3NN9vic7QiIMeWiEpoXEXlP0Qn38MCDsPJiGbl32D/XNRicgtp7Ldp7FTuYsfL5o WdJkMVxX1diNEJKykmCcz8zw5XVnKn3f4wC9zwtTs6MvVGluTtifQ2kRMwSia2om6G2e r8COR9nGZPI8giEU4sAcBv2STTDekslKXwpwIpmmTMXPCtV9P/Ngg1jQGYyMlVpBteDX /xHBvIm/kRXHSdowBN0T94K4zV68f9FprQBKNXFFXRW0m0yXyKgPJHm5S/2K7fJuygP8 paEK7BlrL03yXfqCzEXpFeSvzay+pRhstzuzeEegfTWVSkNRX1gmi18r+s72wlLAPHyB 1J8A== X-Gm-Message-State: AOJu0YwRjQ4t0S189/MeTZwDniNfWyCftEDiiVTgGcQoBnZoQfYxK0tr gKw6yQZ0vs/q7ElbKRNEB3HEyEPpCNb/LlEUsew= X-Google-Smtp-Source: AGHT+IEPTaanZlYEENxm70CGBO1lwd/2znvxA0IxA1LOow+O7GivYTukU3t1d/+l2mFwQPVH78GEcWJKNS18MYFhnio= X-Received: by 2002:a05:6214:5011:b0:66d:28b3:798 with SMTP id jo17-20020a056214501100b0066d28b30798mr2368115qvb.10.1701912771329; Wed, 06 Dec 2023 17:32:51 -0800 (PST) MIME-Version: 1.0 References: <83fs0k938h.fsf@gnu.org> In-Reply-To: From: Pengji Zhang Date: Wed, 6 Dec 2023 20:32:39 -0500 Message-ID: Subject: Re: bug#67463: 30.0.50; Eglot may manage js-json-mode buffers with wrong server To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 67463 Cc: 67463@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Jo=C3=A3o, On Sun, Dec 3, 2023 at 3:51=E2=80=AFPM Jo=C3=A3o T=C3=A1vora wrote: > > Nope this doesn't work. Even the slightly more involved patch after > my sig doesn't work, and it correctly reports the :languageId as "json" > > So I think the best courses of action are 3 and 4, in that order. > I also think option 3 could be the best. JSON is indeed a subset of JavaScript but that does not mean valid JSON files are also valid JavaScript files. For instance, a bare object literal '{"a": 10}' is not accepted by perhaps all JavaScript runtimes because it is parsed as a block of statements. That is also why we get those invalid errors in the example. > Another workaround is to first start M-x eglot in some json file > in your project. If you have one of: > > . ,(eglot-alternatives '(("vscode-json-language-server" "--stdio") > ("vscode-json-languageserver" "--stdio") > ("json-languageserver" "--stdio")))) > > installed, then these json-specific servers should start to manage > js-json-mode files in your project. If afterwards you start M-x > eglot in a plain js file, that server won't be (erroneously) used > to manage JSON files. > Thanks! This workaround indeed works, even though it is a bit tedious (and I honestly do not quite need a language server for JSON). Pengji From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 16 04:30:56 2023 Received: (at 67463) by debbugs.gnu.org; 16 Dec 2023 09:30:56 +0000 Received: from localhost ([127.0.0.1]:53955 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rER0a-0000SE-2G for submit@debbugs.gnu.org; Sat, 16 Dec 2023 04:30:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51088) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rER0X-0000CT-VP for 67463@debbugs.gnu.org; Sat, 16 Dec 2023 04:30:54 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rER0R-00022y-Mf; Sat, 16 Dec 2023 04:30:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=qTwiA1oDOE7Qtg7ddlD7eO6bRqChDyjRmGKkupqvCq4=; b=mXySfHSPD8A3K/U2kKyB b1ul3jxn6qDuqqu3zzRZqXASMZyCgQ/1Ne7r2XP5HynrM5gW+RY3f+0gUnnLyvs8cgob7Z5PebzJ0 7Nf4sXw7IwE4S+8jmMhCRwvy7LTpr0ZDP64dODxYOJF1RWOu2q9PxDmWlhp2r+gBy1InEy7aPh2k3 8LeDE37Hu7F5L16TG0YKQqdrjxbS8pSY/+hrtVsxDyCoAwET5GvUw1RrhuFg0jQwskFvrbKwzi6bT 2NN9rl0zThxGwbnhuJCe7eqZBP3PVwZQkD0mG0p+PoTdmuikPufMdMzujOSBFNo6s5Av+kCfHF1BW j3olIEAOHnZoOQ==; Date: Sat, 16 Dec 2023 11:30:27 +0200 Message-Id: <834jgio5os.fsf@gnu.org> From: Eli Zaretskii To: Pengji Zhang In-Reply-To: (message from Pengji Zhang on Wed, 6 Dec 2023 20:32:39 -0500) Subject: Re: bug#67463: 30.0.50; Eglot may manage js-json-mode buffers with wrong server References: <83fs0k938h.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67463 Cc: 67463@debbugs.gnu.org, joaotavora@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Pengji Zhang > Date: Wed, 6 Dec 2023 20:32:39 -0500 > Cc: 67463@debbugs.gnu.org, Eli Zaretskii > > Hi João, > > On Sun, Dec 3, 2023 at 3:51 PM João Távora wrote: > > > > Nope this doesn't work. Even the slightly more involved patch after > > my sig doesn't work, and it correctly reports the :languageId as "json" > > > > So I think the best courses of action are 3 and 4, in that order. > > > > I also think option 3 could be the best. JSON is indeed a subset of > JavaScript but that does not mean valid JSON files are also valid > JavaScript files. For instance, a bare object literal '{"a": 10}' is > not accepted by perhaps all JavaScript runtimes because it is parsed > as a block of statements. That is also why we get those invalid errors > in the example. > > > Another workaround is to first start M-x eglot in some json file > > in your project. If you have one of: > > > > . ,(eglot-alternatives '(("vscode-json-language-server" "--stdio") > > ("vscode-json-languageserver" "--stdio") > > ("json-languageserver" "--stdio")))) > > > > installed, then these json-specific servers should start to manage > > js-json-mode files in your project. If afterwards you start M-x > > eglot in a plain js file, that server won't be (erroneously) used > > to manage JSON files. > > > > Thanks! This workaround indeed works, even though it is a bit tedious > (and I honestly do not quite need a language server for JSON). So should we now close this bug? Or is there something left to do here? From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 16 07:02:17 2023 Received: (at 67463) by debbugs.gnu.org; 16 Dec 2023 12:02:18 +0000 Received: from localhost ([127.0.0.1]:54093 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rETN3-0006US-C4 for submit@debbugs.gnu.org; Sat, 16 Dec 2023 07:02:17 -0500 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]:42244) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rETN2-0006U6-3M for 67463@debbugs.gnu.org; Sat, 16 Dec 2023 07:02:16 -0500 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2ca04b1cc37so14230451fa.1 for <67463@debbugs.gnu.org>; Sat, 16 Dec 2023 04:02:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702728129; x=1703332929; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=izSkNB7UBXBBMCi0hpucSd8lFVYKHwGJKT8rWBNaO5k=; b=LVu40n4qov4qD4Z+V4xw2VMoZgVJ6r1mAaiNFcTkwiCCkFOwnT4f1YuCWppludjBj4 RLQhLDzCDoewd0xeg1GK+9WM8bA4+np4CwFYwyvT86VSDFQZfeF3ls+c5bfnEG7XFvMH ZE3fnxfFgLIv/4VjX1/UqFMHYb4wF//YSzExtwTluN/3tagLNPKW67okyvWgN4aaceo5 PbP/LAV1hGklvd1ZB9KJ5POc/YBiFDk/8Ak51brtl0X8pmnegymAyQZYng4BF0yUoH+b /bqHlG4t0o5zy2joj6mRNesfM2FxIup+Ul9cEr8TignmfROAwrcd/dLFpTJHP+4hGTdu 7b1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702728129; x=1703332929; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=izSkNB7UBXBBMCi0hpucSd8lFVYKHwGJKT8rWBNaO5k=; b=Gv3kXjbEB30KEvunQtngjCkSbGMwQs41mCa8uzr8qlDD6g00pWovEOQaFUp4Yn12RR urSp7SNcsdWklCihkdrY9/2qs3TIssgZ3StNXIy53iJ6bsCGbLOG1k7nhXIaOw1T5Jy6 rOXN4mrP81LZG2+x/MRnnKq51aI0mxNEScEK5CQYS7HB2unQpIKO1oK0MJowpEGaYfBZ 6v2KSzXyfWyKaK4yIx6o9RlzJKL9XU5EuEEl3nP6fVWPdaGujwxR4suBCijjYxAjTFxW rD8QRD5Z5/jc47samOJrhnj4NN3WSVPbdEXUr2qiuToHhvxqEGFfj/DWn2hRsKxxllpU UO1Q== X-Gm-Message-State: AOJu0YwuFeUCGUxNESU6dn+ZHLODx2xkrFhOCoFKfpZN7Twq3xUltwtn FbasDQEDWeVqKgD7mb2mG6qWQVuwdEBIiLJrGgc= X-Google-Smtp-Source: AGHT+IFHi9f8gWv3KoCoUJPbXWluWTduIHRxnwPVkmXqrtxgEFBqfDrphwg5ga2HOX3A4uYQoQPVc+gVl8yayyjXhhY= X-Received: by 2002:a2e:924f:0:b0:2cc:5ebd:9da5 with SMTP id v15-20020a2e924f000000b002cc5ebd9da5mr426771ljg.22.1702728129413; Sat, 16 Dec 2023 04:02:09 -0800 (PST) MIME-Version: 1.0 References: <83fs0k938h.fsf@gnu.org> <834jgio5os.fsf@gnu.org> In-Reply-To: <834jgio5os.fsf@gnu.org> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Date: Sat, 16 Dec 2023 12:01:57 +0000 Message-ID: Subject: Re: bug#67463: 30.0.50; Eglot may manage js-json-mode buffers with wrong server To: Eli Zaretskii Content-Type: multipart/alternative; boundary="0000000000004d895d060c9f4937" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 67463 Cc: Pengji Zhang , 67463@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000004d895d060c9f4937 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Dec 16, 2023, 09:30 Eli Zaretskii wrote: > > From: Pengji Zhang > > Date: Wed, 6 Dec 2023 20:32:39 -0500 > > Cc: 67463@debbugs.gnu.org, Eli Zaretskii > > > > Hi Jo=C3=A3o, > > > > On Sun, Dec 3, 2023 at 3:51=E2=80=AFPM Jo=C3=A3o T=C3=A1vora wrote: > > > > > > Nope this doesn't work. Even the slightly more involved patch after > > > my sig doesn't work, and it correctly reports the :languageId as > "json" > > > > > > So I think the best courses of action are 3 and 4, in that order. > > > > > > > I also think option 3 could be the best. JSON is indeed a subset of > > JavaScript but that does not mean valid JSON files are also valid > > JavaScript files. For instance, a bare object literal '{"a": 10}' is > > not accepted by perhaps all JavaScript runtimes because it is parsed > > as a block of statements. That is also why we get those invalid errors > > in the example. > > > > > Another workaround is to first start M-x eglot in some json file > > > in your project. If you have one of: > > > > > > . ,(eglot-alternatives '(("vscode-json-language-server" "--stdio") > > > ("vscode-json-languageserver" "--stdio") > > > ("json-languageserver" "--stdio")))) > > > > > > installed, then these json-specific servers should start to manage > > > js-json-mode files in your project. If afterwards you start M-x > > > eglot in a plain js file, that server won't be (erroneously) used > > > to manage JSON files. > > > > > > > Thanks! This workaround indeed works, even though it is a bit tedious > > (and I honestly do not quite need a language server for JSON). > > 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. I think the fix should be (3) breaking the inheritance between js-json-mode and js-mode, using instead composition to achieve the same code reuse. As Pengji noted, JSON is not JS in any practical (or even theoretical) sense. Jo=C3=A3o > --0000000000004d895d060c9f4937 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sat, Dec 16, 2023, 09:30 Eli Zaretskii <eliz@gnu.or= g> wrote:
> From: Pengji = Zhang <kunhtkun@gmail.com>
> Date: Wed, 6 Dec 2023 20:32:39 -0500
> Cc: 67463@debbugs.gnu.org, Eli Zaretskii = <eliz@gnu.org>
>
> Hi Jo=C3=A3o,
>
> On Sun, Dec 3, 2023 at 3:51=E2=80=AFPM Jo=C3=A3o T=C3=A1vora <joaotavora@gmail.com> wrote:
> >
> > Nope this doesn't work.=C2=A0 Even the slightly more involved= patch after
> > my sig=C2=A0 doesn't work, and it correctly reports the :lang= uageId as "json"
> >
> > So I think the best courses of action are 3 and 4, in that order.=
> >
>
> I also think option 3 could be the best. JSON is indeed a subset of > JavaScript but that does not mean valid JSON files are also valid
> JavaScript files. For instance, a bare object literal '{"a&qu= ot;: 10}' is
> not accepted by perhaps all JavaScript runtimes because it is parsed > as a block of statements. That is also why we get those invalid errors=
> in the example.
>
> > Another workaround is to first start M-x eglot in some json file<= br> > > in your project.=C2=A0 If you have one of:
> >
> > . ,(eglot-alternatives '(("vscode-json-language-server&q= uot; "--stdio")
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 ("vscode-json-languageserver" "--st= dio")
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 ("json-languageserver" "--stdio&quo= t;))))
> >
> > installed, then these json-specific servers should start to manag= e
> > js-json-mode files in your project.=C2=A0 If afterwards you start= M-x
> > eglot in a plain js file, that server won't be (erroneously) = used
> > to manage JSON files.
> >
>
> Thanks! This workaround indeed works, even though it is a bit tedious<= br> > (and I honestly do not quite need a language server for JSON).

So should we now close this bug?=C2=A0 Or is there something left to do
here?

The problem is not solved and the workaround is tedious. There is some= thing to be fixed, but outside Eglot.

I think the fix should be (3) breaking the inheritance betwee= n js-json-mode and js-mode, using instead composition to achieve the same c= ode reuse.=C2=A0 As Pengji noted, JSON is not JS in any practical (or even = theoretical) sense.

Jo= =C3=A3o
--0000000000004d895d060c9f4937-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 06 11:02:07 2024 Received: (at 67463) by debbugs.gnu.org; 6 Jan 2024 16:02:07 +0000 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 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 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== 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) 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) From: Stefan Monnier To: =?windows-1252?B?Sm/jbyBU4XZvcmE=?= Subject: Re: bug#67463: 30.0.50; Eglot may manage js-json-mode buffers with wrong server In-Reply-To: (=?windows-1252?Q?=22Jo=E3o_T=E1vora=22's?= message of "Sat, 16 Dec 2023 12:01:57 +0000") Message-ID: References: <83fs0k938h.fsf@gnu.org> <834jgio5os.fsf@gnu.org> Date: Sat, 06 Jan 2024 11:01:52 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.138 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67463 Cc: Pengji Zhang , Eli Zaretskii , 67463@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> 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). From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 06 13:04:28 2024 Received: (at 67463) by debbugs.gnu.org; 6 Jan 2024 18:04:28 +0000 Received: from localhost ([127.0.0.1]:60276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMB24-000688-Bn for submit@debbugs.gnu.org; Sat, 06 Jan 2024 13:04:28 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:39205) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMB22-00067u-38 for 67463@debbugs.gnu.org; Sat, 06 Jan 2024 13:04:26 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id DAA855C00B0; Sat, 6 Jan 2024 13:04:15 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sat, 06 Jan 2024 13:04:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1704564255; x=1704650655; bh=IJa9XklOw2dtkox5xxkRJySw/hEfNYJm7VIgSWiRjfw=; b= iONAhhOSz03raPxAxKZJjRKrP2TArLKb8xbfOr0SKdj4ICcyq8D36jUhlnZ6nhiR +WkCNAgp/PfZwNoKd2myALMM8tCIIegZ64/VnWvsXG6jmOekT7UTjFSlBLvy1X9E pbvp82zYn1gjB65fgLXO2tBeIKZoSbulffRVIJNLZgslGL22vxsS6OhN8/NxLSGg Vopd6L9Y1yP2/UAM6ulrLHSXd83DYodIWIYbvJsD2b5NP/XAdQsK7ktB/mh4NNqF fNbhUd6KBEGwUj/flfUL+OAntckQvO0M2nEx77i4O875EFl6H3uwqYUuDDCzgGB5 XdtT3VrFj9jR9MNhYe7TuA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1704564255; x= 1704650655; bh=IJa9XklOw2dtkox5xxkRJySw/hEfNYJm7VIgSWiRjfw=; b=g 3wj3x8uQo0C8/3t7uhX2lScP7jJMO1nqlyH1mWD0qE0uJ9mwvbSrnbsZrJFFyy9/ 7R09eXoPBDbkHmR6zncvVrnEfnZyLRrgnqtpxloxjjILhPj/5I3aN/TVEvc5OhH+ S70B+Za8Vvi3vLJT4dTU5IhMO13RFMJT/M1Z8joDxQuIEf7OUqtlEj4pXYnyZzUZ 0cBGvq2IdcnzWaGY01dO1ofPNtFQwroeTLVptQNaspgqA7KKRTHGfjarOQRVYkCl z9bXJbwFT/Pxqlr4RALQ5PS1fAk+b6HItyXsU660I05KwQIb0MmBFGEdTDjxOIfo mbm7mSsPC9Q+MPCus39+Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdehuddguddtiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddvjeenucfhrhhomhepffhm ihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrg htthgvrhhnpeetudeljeegheetgfehgeejkeeuhedvveeikeeufedtvddtveefhfdvveeg udejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe gumhhithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 6 Jan 2024 13:04:13 -0500 (EST) Message-ID: <2eeff48a-942a-463b-999c-4a615f67d052@gutov.dev> Date: Sat, 6 Jan 2024 20:04:09 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#67463: 30.0.50; Eglot may manage js-json-mode buffers with wrong server To: Stefan Monnier , =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= References: <83fs0k938h.fsf@gnu.org> <834jgio5os.fsf@gnu.org> Content-Language: en-US From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 67463 Cc: Pengji Zhang , Eli Zaretskii , 67463@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) 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. From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 06 20:58:25 2024 Received: (at 67463) by debbugs.gnu.org; 7 Jan 2024 01:58:25 +0000 Received: from localhost ([127.0.0.1]:60467 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMIQj-00064U-8U for submit@debbugs.gnu.org; Sat, 06 Jan 2024 20:58:25 -0500 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]:55390) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMIQg-00064E-OI for 67463@debbugs.gnu.org; Sat, 06 Jan 2024 20:58:23 -0500 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2cd0c151cdcso7831721fa.2 for <67463@debbugs.gnu.org>; Sat, 06 Jan 2024 17:58:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704592691; x=1705197491; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=X/MGxzKy8nThG0mPKk8TUOrNTy4Syc58SJJYhlFQ2hM=; b=Zdp7tK/yYD3/TMq4LBKLZyykJyPgn7LzMrzym35JT8B13K27Dc5LFKQ+8xBfMULkWH f2QCVTltQPcXdeecrB5NOAHPvo5eLMxlldhSgdP118S0CP8cForLhe6F7yLrgyz6U7BN 8lnpcNGZL2qQusFyqODftBTaJwZkwi5T34jDghM6lsn+uFHQ/6liAqIOjW+Rv+MGPk1C E3zjQsgBORlyJqYjhyBzgpYwreBRbQCQREgfGW80+crTLBCi5L5LuoWG5SB7m/9U+0vX IgB0ZTKceSZ45w9CZUzTW1oDv2grLnHJJWXs1XJF3V1XVO/eeB/Ll3DCPRYSL12/ti6A 71Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704592691; x=1705197491; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=X/MGxzKy8nThG0mPKk8TUOrNTy4Syc58SJJYhlFQ2hM=; b=I0LKc/tml2gJyYLTVPzGx/P8LKDdiWSRAXqRsmN+Xw1wajuGZRL4rnJKMK33XSJTmT Icpi67SSG0NHzs62RpegOtWhDBUqrnMcq09hl73oijol2+rUQVBfnxPNcCmGNiGhXwPG QnF7tXYVW5ZITvvlvt/k/aFqXr0xMmEoJx66q/0+iQp8tSkOvc9N+YxUBGIT2VRjMDNV bot9H6Lo+zJ8Yb6MAkSign4wXrVbkj+5uz0BztdIqK0uP70Z1Vulsd9zI+bczfflTWnZ 5U2dfW7Ksojh6eUZniCi2FaLTWHLVmDTN+qm7Yg/GI6er60Vvq0xe18xShUD+iE+8bp2 0nzw== X-Gm-Message-State: AOJu0YwubhTYKIgMbvAnRRb17lTLsj3fXiHzFdKAosum9dQQGcu6h9TA DPboe9H4kg3LreLySSydVWSOEeZ8sDy91e9wTPs= X-Google-Smtp-Source: AGHT+IGGpvdNGVOdmsDxWMjgmHRryz9dc1j5r7ynrgqSL5Fbxzl6wUGvlSC7N38KcvzSbl4+lQHISWkUs+jHXY0qYVU= X-Received: by 2002:a2e:b450:0:b0:2cc:794d:f68b with SMTP id o16-20020a2eb450000000b002cc794df68bmr578484ljm.29.1704592691148; Sat, 06 Jan 2024 17:58:11 -0800 (PST) MIME-Version: 1.0 References: <83fs0k938h.fsf@gnu.org> <834jgio5os.fsf@gnu.org> <2eeff48a-942a-463b-999c-4a615f67d052@gutov.dev> In-Reply-To: <2eeff48a-942a-463b-999c-4a615f67d052@gutov.dev> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Date: Sun, 7 Jan 2024 01:57:59 +0000 Message-ID: Subject: Re: bug#67463: 30.0.50; Eglot may manage js-json-mode buffers with wrong server To: Dmitry Gutov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 67463 Cc: Pengji Zhang , Eli Zaretskii , Stefan Monnier , 67463@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Sat, Jan 6, 2024 at 6:04=E2=80=AFPM Dmitry Gutov wrot= e: > > 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#6= 7463). > > 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=C3=A3o From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 07 00:20:58 2024 Received: (at 67463) by debbugs.gnu.org; 7 Jan 2024 05:20:58 +0000 Received: from localhost ([127.0.0.1]:60559 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMLak-0005aK-8L for submit@debbugs.gnu.org; Sun, 07 Jan 2024 00:20:58 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:5136) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMLai-0005a7-Ic for 67463@debbugs.gnu.org; Sun, 07 Jan 2024 00:20:57 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 983BF10009E; Sun, 7 Jan 2024 00:20:45 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1704604844; bh=xHJlcOwooGu+RmvBCHoFEytU0B6fHcJFqpBnPiAXpbI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=jWgObi0T3pKRartwRaxD0rNfCyzx1xQro0uz1AbRR1d0mSWkikwY6NdiMnCR2ITuF YV3CVvEckwg2dQKjvc125JMB9Axq9KIof9J6hWog7cCqbnWyWsYj+DSlu3CsyGLtJ3 joDin8enUvPj53onWnth40/nDc9BxgbRXJDxfsAYeOz7eXk1zgE8Yof5fmTDfZpA9L r+LQLsX9ZzBwueqr2WNTeOt6aaivAYSwomupQV68oMw67NF411MraGjATHrn3qR1Ba CvOmKES3qLDbQaFDXSFxX33fgnSMBiNHQa/lYQGdSdWvJvP/d+VgwcQtx7y3VtFaLo 8VqbIqggsTJfg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 99D0010004C; Sun, 7 Jan 2024 00:20:44 -0500 (EST) Received: from pastel (65-110-221-238.cpe.pppoe.ca [65.110.221.238]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 621DE120B70; Sun, 7 Jan 2024 00:20:44 -0500 (EST) From: Stefan Monnier To: =?windows-1252?B?Sm/jbyBU4XZvcmE=?= Subject: Re: bug#67463: 30.0.50; Eglot may manage js-json-mode buffers with wrong server In-Reply-To: (=?windows-1252?Q?=22Jo=E3o_T=E1vora=22's?= message of "Sun, 7 Jan 2024 01:57:59 +0000") Message-ID: References: <83fs0k938h.fsf@gnu.org> <834jgio5os.fsf@gnu.org> <2eeff48a-942a-463b-999c-4a615f67d052@gutov.dev> Date: Sun, 07 Jan 2024 00:20:43 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.250 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67463 Cc: Dmitry Gutov , Eli Zaretskii , 67463@debbugs.gnu.org, Pengji Zhang X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> 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. It's dirty because it means `kill-all-local-variables` is called twice. And there might be other bad side effects. I suggest the patch below instead, which also "quick" but much less dirty. >> 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. We'd first have to decide what is the behavior we want from it. Note that `derived-mode-add-parents` doesn't really "add", it just sets (i.e. overwrites) the list of extra-parents, so a corresponding behavior would be for `derived-mode-remove-parent` to set a new property `derived-mode-muted-parents`. This said, I'm not at all sure we want/need that. It seems that its only use-cases would be to fix erroneous inheritance as we have here in `js-json-mode`, which are better fixed at the source. If users wants to work around the problem before it's fixed at its source, they can already do something like (put 'js-json-mode 'derived-mode-parent nil) -- Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 07 19:20:26 2024 Received: (at 67463) by debbugs.gnu.org; 8 Jan 2024 00:20:26 +0000 Received: from localhost ([127.0.0.1]:34091 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMdNR-00072d-Oz for submit@debbugs.gnu.org; Sun, 07 Jan 2024 19:20:26 -0500 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]:58729) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMdNP-00072P-O3 for 67463@debbugs.gnu.org; Sun, 07 Jan 2024 19:20:24 -0500 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2cd46e7ae8fso9743291fa.1 for <67463@debbugs.gnu.org>; Sun, 07 Jan 2024 16:20:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704673212; x=1705278012; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=7ge8IadZSqYtyyrS5TXDWrQXQ7ZXh+9cfpf0IBezggw=; b=arrvt1DsuW3IlVZyjjgKtvbf2+PzK4k4QtxFqz8/pbuCzbmzoKIwzg2rR0YcX3Wak6 WyILozng5+6xYqX54ypNxMoKXFaj7YztdzEsAAGfjzQ9plEUejNI4PnzLD2dbHLAhhgP GATCkeOWAOn1kvhHOgxd/CdvIcfUmM/7SLNyQyL415PkJH0l7rso6QdzKVMGfdYRvNBp r5zJIy5+qlNrRawkwiIIXLy2Gc3PMXYiUcH4nyF6B/I5GDStPkpGldXCozT2ejgL1ZOU tnE0WnrB5Rta3v9tWyAdWVLfs5M4KUIzNkXleLEIudomW+GqxW8O7Yqx6HMzP143bVwr okdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704673212; x=1705278012; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7ge8IadZSqYtyyrS5TXDWrQXQ7ZXh+9cfpf0IBezggw=; b=EzN2NKgGl+RATPjLydpnZP5Z+LjgYrhRkpB2+reSCLUFtqpyqumsbSAMYK2dvzDF53 z6cEHkPK9HtIoxzUHT8sPidC0YTJO8yQntFppYSq27BA41IKAYI8ah5sHSV60w39e5oz Z2prXHn38OTPiSFxtHn/NCJiNm2lhjDfoYP6XKO++jWhEOYOkBBmG8KXFRbDRjbEJHl2 majQbPlR/kJNXXH7u7fopYu034J5Cq/UPHUWaeQt6vi2WLpRJ1B7iL3ukeKomrwfLFFi BG9PvTxN1fYmxjFWLf3h8uYw38WITEBAwLhe4ghoziVkZJdFUoEL0qiAPqP0Pum+PMua Bi4A== X-Gm-Message-State: AOJu0Yx8dBcMTZKDkYeOL5HqnzlTYR6ju3jfZTq0pjX63VNHkhOlk00q qiskne/vOM4wdqqhJdNklbDDE7bcZuzn6rUSgj4= X-Google-Smtp-Source: AGHT+IEw23ZZZfYuEtotB8g6RfcCirEaIsCSuXzTHlABveCMKNQT5oIS5ST/s1ts3NgF859ZXa8n32hFvFWb6vbf9aY= X-Received: by 2002:a2e:9542:0:b0:2cc:c895:7140 with SMTP id t2-20020a2e9542000000b002ccc8957140mr492892ljh.73.1704673211537; Sun, 07 Jan 2024 16:20:11 -0800 (PST) MIME-Version: 1.0 References: <83fs0k938h.fsf@gnu.org> <834jgio5os.fsf@gnu.org> <2eeff48a-942a-463b-999c-4a615f67d052@gutov.dev> In-Reply-To: From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Date: Mon, 8 Jan 2024 00:20:00 +0000 Message-ID: Subject: Re: bug#67463: 30.0.50; Eglot may manage js-json-mode buffers with wrong server To: Stefan Monnier Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 67463 Cc: Dmitry Gutov , Eli Zaretskii , 67463@debbugs.gnu.org, Pengji Zhang X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Sun, Jan 7, 2024 at 5:20=E2=80=AFAM Stefan Monnier wrote: effects. > I suggest the patch below instead, which also "quick" but much less dirty= . I didn't see it, did you attach it? > We'd first have to decide what is the behavior we want from it. > Note that `derived-mode-add-parents` doesn't really "add" I'd think for every "add" it should be reasonably easy to envision a "remove", but that complicates things indeed. > (i.e. overwrites) the list of extra-parents, so a corresponding behavior > would be for `derived-mode-remove-parent` to set a new property > `derived-mode-muted-parents`. Extra parents, muted parents, siblings become parents, definitely some good 90's sitcom material :-) Jo=C3=A3o From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 07 22:21:54 2024 Received: (at 67463) by debbugs.gnu.org; 8 Jan 2024 03:21:55 +0000 Received: from localhost ([127.0.0.1]:34794 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMgD4-0001R6-Jf for submit@debbugs.gnu.org; Sun, 07 Jan 2024 22:21:54 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:53067) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMgD2-0001Qu-MS for 67463@debbugs.gnu.org; Sun, 07 Jan 2024 22:21:53 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 59D3680B1F; Sun, 7 Jan 2024 22:21:41 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1704684100; bh=Kh5HN5KPvun6oaPEukpEADDKYf4dBiFqIKTMuqYBilk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Bz3JrOtzZY3/LRmGoSepO7XToe/1Lbsr5bjcouHaDE+mpyXmgIUQPHrw89zIV6BdS D4mWI8UiO2yLAobFOuIyN9tSnw0m52g0wBijlkEZwJzPpVROiBpnS5hBC4nGja2/o2 dPbO0/9Wj35Urza5LpHWZ3U+G7+dTI00TsGAhtkS+fbp8M1Ewhf6DnFV4nY214PvdZ d5Hbhq8gbgLJPuGXswona6A5qhfwZ0E/eZHCzJC7xHz5BiVVBLPcIvMnJT9BkDs1nz GUKmSIuQtv5VGjZMM7YvbD01sZT/cKDfhSXn1u7zY3HwCPjrx0U7p6vThcpLqvavvr Ct+fs88AysYcw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 40B4E80426; Sun, 7 Jan 2024 22:21:40 -0500 (EST) Received: from pastel (65-110-221-238.cpe.pppoe.ca [65.110.221.238]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 062CE12078A; Sun, 7 Jan 2024 22:21:39 -0500 (EST) From: Stefan Monnier To: =?windows-1252?B?Sm/jbyBU4XZvcmE=?= Subject: Re: bug#67463: 30.0.50; Eglot may manage js-json-mode buffers with wrong server In-Reply-To: (=?windows-1252?Q?=22Jo=E3o_T=E1vora=22's?= message of "Mon, 8 Jan 2024 00:20:00 +0000") Message-ID: References: <83fs0k938h.fsf@gnu.org> <834jgio5os.fsf@gnu.org> <2eeff48a-942a-463b-999c-4a615f67d052@gutov.dev> Date: Sun, 07 Jan 2024 22:21:39 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.001 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67463 Cc: Dmitry Gutov , Eli Zaretskii , 67463@debbugs.gnu.org, Pengji Zhang X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain >> I suggest the patch below instead, which also "quick" but much less dirty. > I didn't see it, did you attach it? See second try below. > Extra parents, muted parents, siblings become parents, > definitely some good 90's sitcom material :-) can't wait to see your script, Stefan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=js-json.patch diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 0115feb0e97..f042774431d 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3702,6 +3702,9 @@ js-base-mode (define-derived-mode js-mode js-base-mode "JavaScript" "Major mode for editing JavaScript." :group 'js + (js--mode-setup)) + +(defun js--mode-setup () ;; Ensure all CC Mode "lang variables" are set to valid values. (c-init-language-vars js-mode) (setq-local indent-line-function #'js-indent-line) @@ -3924,7 +3927,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-setup) ;Reuse most of `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). --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 14 22:18:07 2024 Received: (at 67463-done) by debbugs.gnu.org; 15 Jan 2024 03:18:07 +0000 Received: from localhost ([127.0.0.1]:44442 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rPDUF-0002ye-2e for submit@debbugs.gnu.org; Sun, 14 Jan 2024 22:18:07 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:5660) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rPDUD-0002yA-4Q for 67463-done@debbugs.gnu.org; Sun, 14 Jan 2024 22:18:05 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 1A1994419AA; Sun, 14 Jan 2024 22:17:59 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1705288678; bh=dzAqijsBy+iidYcKlkogBTC8glDXNLdp4SKi7FnT65c=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=AQL3LvX335N9IyGcNfh4MvW9OZVJ2a3Q0yEA2JRf4V4SEaUln+TolVP4u4gTJZHL/ UBsCIg1yDEGMQaLFEQLElWIX8CdnO0vulPY/wsm6nZ6+cOdfUC1reRuJdRhSQGkKHU QSFpmOgWeXAlASgJ1+svucxehU8iYHjLZ+DtPoTmsYzPRrm1cFMFLkX+teGJ3KCfiS Wo37Zo4f12qNgTAkYWH+0rLhRY0aKbzLeZOTzFeJFjfgmHszrG9M3JTRKDUy06DPCu Ze4M/k9EQ3rDPL4/9itzb2woyZKVDsEz2kTWFdwsB5YiIWcpIX/lGBjOpA6EHNTQe4 kKcRRZjdVhJ1A== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id EF51144197D; Sun, 14 Jan 2024 22:17:57 -0500 (EST) Received: from milanesa (65-110-221-238.cpe.pppoe.ca [65.110.221.238]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 99792120BBF; Sun, 14 Jan 2024 22:17:57 -0500 (EST) From: Stefan Monnier To: =?windows-1252?B?Sm/jbyBU4XZvcmE=?= Subject: Re: bug#67463: 30.0.50; Eglot may manage js-json-mode buffers with wrong server In-Reply-To: (Stefan Monnier's message of "Sun, 07 Jan 2024 22:21:39 -0500") Message-ID: References: <83fs0k938h.fsf@gnu.org> <834jgio5os.fsf@gnu.org> <2eeff48a-942a-463b-999c-4a615f67d052@gutov.dev> Date: Sun, 14 Jan 2024 22:17:56 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.014 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67463-done Cc: Dmitry Gutov , Eli Zaretskii , 67463-done@debbugs.gnu.org, Pengji Zhang X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >>> I suggest the patch below instead, which also "quick" but much less dirty. >> I didn't see it, did you attach it? > See second try below. Pushed to `master`. Stefan From unknown Thu Jun 19 14:06:37 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 12 Feb 2024 12:24:12 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator