From unknown Thu Sep 11 02:37:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#63463: 29.0.90; Using python-ts-mode for single buffer should not alter global auto-mode-alist settings Resent-From: Yikai Zhao Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 May 2023 12:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 63463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 63463@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.168389554422335 (code B ref -1); Fri, 12 May 2023 12:46:01 +0000 Received: (at submit) by debbugs.gnu.org; 12 May 2023 12:45:44 +0000 Received: from localhost ([127.0.0.1]:54386 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pxS9X-0005o9-KJ for submit@debbugs.gnu.org; Fri, 12 May 2023 08:45:44 -0400 Received: from lists.gnu.org ([209.51.188.17]:37506) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pxS9W-0005o2-6E for submit@debbugs.gnu.org; Fri, 12 May 2023 08:45:42 -0400 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 1pxS9U-0001tn-Mb for bug-gnu-emacs@gnu.org; Fri, 12 May 2023 08:45:41 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pxS9S-00083n-PR for bug-gnu-emacs@gnu.org; Fri, 12 May 2023 08:45:40 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3f41dceb9c9so50172135e9.3 for ; Fri, 12 May 2023 05:45:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=z1k.dev; s=google; t=1683895529; x=1686487529; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=LLQN13wJCGPrRRdWi3JX08Uq/SZqO58keBe+uv7/ztY=; b=FI8zp/Qqf5XLxPIFSdQoJI3ncXTZDXCudY0LJelbxVpfucxC4TMEK9+JYk/qieVgPT rY8qCVloN5loA2kqSI1cA1J2lp0xuCTno+PfjrvNqc3F9gCS+eOMj2jENU7ombhjCtqH CUDdJ48SyXrwhVbXBIJ6jfWAmYNSZfu1s6r8uuVN1X6ZFE/jFYd+HMAe+PkTbGG2SVKg n/IqTscMxumOirjPpgSkaNcYU3cvHo53RfwrxDzNIeh/N0b+MPj7vXGNB41bIQgqi8I0 j93/LBuN3G5FYSACQ9B1y1e/vxXs1ad2ayNLNK7fzZfpaosz2l4ksD75+V/6hA/v5jTf 1WAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683895529; x=1686487529; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=LLQN13wJCGPrRRdWi3JX08Uq/SZqO58keBe+uv7/ztY=; b=SZBJsiG5+/I3QjghuO0MM5yLqPNkp9yyqBodJDMKeaMvDnXUnAgKQfwBQ7LwFaEvvH Mvd9s7yvUebOMJUVOG+HULvVrczc7eXPDVXs56gN7OKYI9h8iCoX8adnFALGClJFCGo8 Xu4Lu3XpIUFXNt2XC6DjKF1+ezd+eAt7l7DzNqAJdu+OaAELqjzg6tFfnpGta6gXGFQz ed2b02wkcwXFZywdcnimenxpz9FSJJ2esO/ne3dw+/oYDL/6M0eYXjyekROeFBEukY21 oY3j6QJ8CCu19wrKD77TZezsLzGb3M4nH8PDYJTni9DhPPT/nUuV/ozqmU8Z0Y4US9Mw T/Aw== X-Gm-Message-State: AC+VfDx8Z6MF30soZEdQvl2n5I2KyIhw3Pfs8QzKHuWQ9/ad4jnYH17v blz42RFYUS0syslSzhvM+J+t5O2x4B9J6qF/KT8UEKzZWbMNKMWnwFjWZtVF X-Google-Smtp-Source: ACHHUZ6cjFCL098QiiEGDyeLLfL34S1XJgSqQyBvhsKn5QM3tU7vwE9rYffzZqdU3tDO8EzWjXhQ/EHc3hxYE8VuxJM= X-Received: by 2002:a1c:7308:0:b0:3ef:6819:b2ad with SMTP id d8-20020a1c7308000000b003ef6819b2admr17100967wmb.37.1683895529187; Fri, 12 May 2023 05:45:29 -0700 (PDT) MIME-Version: 1.0 From: Yikai Zhao Date: Fri, 12 May 2023 20:45:18 +0800 Message-ID: Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=i@blahgeek.com; helo=mail-wm1-x335.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.1 (-) 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: -2.1 (--) Hi emacs devs, So today, out of nowhere, I noticed that some of the *.py buffers I opened are using `python-ts-mode` instead of the default `python-mode`, also some of my configs are not working correctly because of this (due to different hooks etc.). I was sure I didn't enable or configure anything related to `python-ts-mode` so that's very strange. After some debugging, it turns out that `markdown-mode` used `python-ts-mode` when fontifying a python code block (https://github.com/jrblevin/markdown-mode/commit/44ac8e4f96f03149f60cb182f8b3f1503f66f6d0), and during that, `python-ts-mode` modified the global `auto-mode-alist` settings so that all future *.py buffers I opened use that instead. I believe this is a bug in emacs: using some treesit-based major mode for single buffer should not automatically alter the global settings. I don't think previously there's any other major modes doing that. I understand that some may argue this behavior to be reasonable based on the thought that, "if the user chose to use treesit for one file, then it would be good to use treesit automatically for all future files". This MAY be true, but in my case, I didn't choose to use it by my own. It's some lisp code down the rabbit hole that loads it without me even realized. I fear that this kind of issue would become more common when: 1. more distros build emacs with treesit support by default and ship with treesit language libraries, 2. more emacs packages tries to use treesit-based major modes internally (I also submitted a bug report to `markdown-mode`: https://github.com/jrblevin/markdown-mode/issues/761) --- In GNU Emacs 29.0.90 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars) Repository revision: emacs-29.0.90 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12013000 System Description: Ubuntu 20.04.5 LTS Configured using: 'configure --prefix=/nix/store/4mgq52v87wxra7nqhvsspn3klp8c731m-emacs-unstable-29.0.90 --disable-build-details --with-modules --with-x-toolkit=lucid --with-xft --with-cairo --with-native-compilation' From unknown Thu Sep 11 02:37:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#63463: 29.0.90; Using python-ts-mode for single buffer should not alter global auto-mode-alist settings Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 May 2023 13:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Yikai Zhao Cc: 63463@debbugs.gnu.org Received: via spool by 63463-submit@debbugs.gnu.org id=B63463.168389799027159 (code B ref 63463); Fri, 12 May 2023 13:27:02 +0000 Received: (at 63463) by debbugs.gnu.org; 12 May 2023 13:26:30 +0000 Received: from localhost ([127.0.0.1]:54463 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pxSmz-00073y-TC for submit@debbugs.gnu.org; Fri, 12 May 2023 09:26:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44754) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pxSmy-00073f-2F; Fri, 12 May 2023 09:26:28 -0400 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 1pxSms-0008He-Lt; Fri, 12 May 2023 09:26:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=UG0jw8XuAlkAOA849nMM3wr/kSzR5pJrT962Fj/42qk=; b=JPndUghHc8EE w1KehyWd/8mjgk5oIlXLTuWdHR16lN3RCnC/CK50PzN0stJeh0qZh1WYWnIIZj6iW0FeMotsgQ3Od 6pEsmKc7Ol79Ebqh+QCUmGVa7zROSe1kXaAONVmBOMW92HRe+XnsQF/wmueH0W8woZub+G2Kutdgs 0jdm8fI8jqAyg4BTjCt6xcgJRDrn2wjlb7tKCN+NjNEtIbayxxYIVsPUUufzOZ9Xgmei3qX4lA0DE puojcmiwLYM0N9e5pslvbFHv6LJMmIeZ3VM4lKC9Y+N8ojB0nYC8NwVO6bTCT4PxTEQqoEGIuhXz1 ZU1F6N/+Qi7PVDWMW7xhNg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pxSmg-0000J3-Od; Fri, 12 May 2023 09:26:22 -0400 Date: Fri, 12 May 2023 16:26:08 +0300 Message-Id: <831qjld6kv.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Yikai Zhao on Fri, 12 May 2023 20:45:18 +0800) References: X-Spam-Score: -2.3 (--) 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 (---) tags 63463 notabug wontfix thanks > From: Yikai Zhao > Date: Fri, 12 May 2023 20:45:18 +0800 > > So today, out of nowhere, I noticed that some of the *.py > buffers I opened are using `python-ts-mode` instead of the default > `python-mode`, also some of my configs are not working correctly because > of this (due to different hooks etc.). I was sure I didn't enable or configure > anything related to `python-ts-mode` so that's very strange. > > After some debugging, it turns out that `markdown-mode` used > `python-ts-mode` when fontifying a python code block > (https://github.com/jrblevin/markdown-mode/commit/44ac8e4f96f03149f60cb182f8b3f1503f66f6d0), > and during that, `python-ts-mode` modified the global `auto-mode-alist` > settings so that all future *.py buffers I opened use that instead. > > I believe this is a bug in emacs: using some treesit-based major mode > for single buffer should not automatically alter the global settings. I > don't think previously there's any other major modes doing that. It is not a bug, it is the intended behavior that loading python-ts-mode makes that mode the default for Python files. However, the root cause of the issue you are describing seems to be markdown-mode, which is not part of Emacs. I don't understand well enough why markdown-mode needs to load python-ts-mode, but in any case, this issue should be solved in markdown-mode, I think. > (I also submitted a bug report to `markdown-mode`: > https://github.com/jrblevin/markdown-mode/issues/761) Thanks; let's see what the markdown-mode's developers say about this. From unknown Thu Sep 11 02:37:35 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Yikai Zhao Subject: bug#63463: closed (Re: bug#63463: 29.0.90; Using python-ts-mode for single buffer should not alter global auto-mode-alist settings) Message-ID: References: X-Gnu-PR-Message: they-closed 63463 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: notabug wontfix Reply-To: 63463@debbugs.gnu.org Date: Sat, 02 Sep 2023 16:40:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1693672802-6361-1" This is a multi-part message in MIME format... ------------=_1693672802-6361-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #63463: 29.0.90; Using python-ts-mode for single buffer should not alter gl= obal auto-mode-alist settings which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 63463@debbugs.gnu.org. --=20 63463: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D63463 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1693672802-6361-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 63463-done) by debbugs.gnu.org; 2 Sep 2023 16:39:39 +0000 Received: from localhost ([127.0.0.1]:38413 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qcTet-0001dj-67 for submit@debbugs.gnu.org; Sat, 02 Sep 2023 12:39:39 -0400 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]:57771) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qcTeq-0001dU-Jv for 63463-done@debbugs.gnu.org; Sat, 02 Sep 2023 12:39:37 -0400 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-5009969be25so202068e87.3 for <63463-done@debbugs.gnu.org>; Sat, 02 Sep 2023 09:39:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693672760; x=1694277560; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=VnjKc86nkYRHnK2aNJsisZscsROBWiN0py4+CWTEUPA=; b=b/ULXr33wCptWSHiFvFEe9WZNzCTKTf7yuEhnDytzId/yKZOVJK45Iq/ZG1ODVhZ12 nPx1XhBSKOwSXbQ9XRByEnUNXTwEqkaCchGT0cOsRof6RBBkCjwg/A600Ll87M9vBx+E 6tKJLOKAUDdcQ3w2tEjoDvP/xbzi1W6hCnzdQGoXsFpt1LtBH5fGbwkIuIee0SlkRQ6x 0bFd7KNhhLRUD3Qs0QiWhMbyQAZslxf2KKI02S5dVyM09NMVjdHjFTHrgwL6JxhCCLw+ PS4J6a0TrYqq/vLXD5VVi9++0zOuosV7Kj1d+H/b5exMMGDiIUG9sSxdLkFqULcVaugb 9OKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693672760; x=1694277560; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VnjKc86nkYRHnK2aNJsisZscsROBWiN0py4+CWTEUPA=; b=ghHwt3GyW+l8JGe8A/R8fC25kKhEzYCU4WJ0xi1S8WXCCdsvDexMiK3Gysug0f68/J Vrq0Gon3ZnQxXNrqr6KUML2UHl3uFo7bxZri3MGaxEx6ft4h1AC2JpAaKoc9TipGRBx0 ojIcEe9PRNp3+xfC1LogZGxtOiSQh2m/tXPoQ6BwCbqhLpJVnnTZtlkReoE/21RyRg2g 0kmM3PT0vYSVqVfb19LbGfXb5nq7m29sJd2VFWtwlRRYvRsP5WJ7UR5HOcbBi7bhXr9z JBGEMu94f1w8/TBKZti017zqej4Tl3vdUHllJz8YspoNH+20JBESgTFD35RElXMiBzKP cHLA== X-Gm-Message-State: AOJu0Yw1bZUcLICaX8vgSMllwX8ZsfMAnDE/eYo2oM1wzlTKZWkC+UwL wOxEQEt4iLnPlcdaUij+tlIs5owAxOlbS0Kf/nc= X-Google-Smtp-Source: AGHT+IGoK5dQCHN8GhZrF3PjFmCYi3A1gsNXkKsIYsh2o6D7Yab+9LE1RG52cYk3cvQGdbE8P3KTSOXaQUmY2IyjvfU= X-Received: by 2002:a05:6512:3da8:b0:500:b3f2:73e2 with SMTP id k40-20020a0565123da800b00500b3f273e2mr4698164lfv.50.1693672760515; Sat, 02 Sep 2023 09:39:20 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 2 Sep 2023 09:39:20 -0700 From: Stefan Kangas In-Reply-To: <831qjld6kv.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 12 May 2023 16:26:08 +0300") References: <831qjld6kv.fsf@gnu.org> MIME-Version: 1.0 Date: Sat, 2 Sep 2023 09:39:20 -0700 Message-ID: Subject: Re: bug#63463: 29.0.90; Using python-ts-mode for single buffer should not alter global auto-mode-alist settings To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 63463-done Cc: Yikai Zhao , 63463-done@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 (-) Eli Zaretskii writes: > tags 63463 notabug wontfix > thanks > >> From: Yikai Zhao >> Date: Fri, 12 May 2023 20:45:18 +0800 >> >> So today, out of nowhere, I noticed that some of the *.py >> buffers I opened are using `python-ts-mode` instead of the default >> `python-mode`, also some of my configs are not working correctly because >> of this (due to different hooks etc.). I was sure I didn't enable or configure >> anything related to `python-ts-mode` so that's very strange. >> >> After some debugging, it turns out that `markdown-mode` used >> `python-ts-mode` when fontifying a python code block >> (https://github.com/jrblevin/markdown-mode/commit/44ac8e4f96f03149f60cb182f8b3f1503f66f6d0), >> and during that, `python-ts-mode` modified the global `auto-mode-alist` >> settings so that all future *.py buffers I opened use that instead. >> >> I believe this is a bug in emacs: using some treesit-based major mode >> for single buffer should not automatically alter the global settings. I >> don't think previously there's any other major modes doing that. > > It is not a bug, it is the intended behavior that loading > python-ts-mode makes that mode the default for Python files. > > However, the root cause of the issue you are describing seems to be > markdown-mode, which is not part of Emacs. I don't understand well > enough why markdown-mode needs to load python-ts-mode, but in any > case, this issue should be solved in markdown-mode, I think. > >> (I also submitted a bug report to `markdown-mode`: >> https://github.com/jrblevin/markdown-mode/issues/761) > > Thanks; let's see what the markdown-mode's developers say about this. I'm therefore closing this bug report. ------------=_1693672802-6361-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 12 May 2023 12:45:44 +0000 Received: from localhost ([127.0.0.1]:54386 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pxS9X-0005o9-KJ for submit@debbugs.gnu.org; Fri, 12 May 2023 08:45:44 -0400 Received: from lists.gnu.org ([209.51.188.17]:37506) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pxS9W-0005o2-6E for submit@debbugs.gnu.org; Fri, 12 May 2023 08:45:42 -0400 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 1pxS9U-0001tn-Mb for bug-gnu-emacs@gnu.org; Fri, 12 May 2023 08:45:41 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pxS9S-00083n-PR for bug-gnu-emacs@gnu.org; Fri, 12 May 2023 08:45:40 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3f41dceb9c9so50172135e9.3 for ; Fri, 12 May 2023 05:45:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=z1k.dev; s=google; t=1683895529; x=1686487529; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=LLQN13wJCGPrRRdWi3JX08Uq/SZqO58keBe+uv7/ztY=; b=FI8zp/Qqf5XLxPIFSdQoJI3ncXTZDXCudY0LJelbxVpfucxC4TMEK9+JYk/qieVgPT rY8qCVloN5loA2kqSI1cA1J2lp0xuCTno+PfjrvNqc3F9gCS+eOMj2jENU7ombhjCtqH CUDdJ48SyXrwhVbXBIJ6jfWAmYNSZfu1s6r8uuVN1X6ZFE/jFYd+HMAe+PkTbGG2SVKg n/IqTscMxumOirjPpgSkaNcYU3cvHo53RfwrxDzNIeh/N0b+MPj7vXGNB41bIQgqi8I0 j93/LBuN3G5FYSACQ9B1y1e/vxXs1ad2ayNLNK7fzZfpaosz2l4ksD75+V/6hA/v5jTf 1WAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683895529; x=1686487529; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=LLQN13wJCGPrRRdWi3JX08Uq/SZqO58keBe+uv7/ztY=; b=SZBJsiG5+/I3QjghuO0MM5yLqPNkp9yyqBodJDMKeaMvDnXUnAgKQfwBQ7LwFaEvvH Mvd9s7yvUebOMJUVOG+HULvVrczc7eXPDVXs56gN7OKYI9h8iCoX8adnFALGClJFCGo8 Xu4Lu3XpIUFXNt2XC6DjKF1+ezd+eAt7l7DzNqAJdu+OaAELqjzg6tFfnpGta6gXGFQz ed2b02wkcwXFZywdcnimenxpz9FSJJ2esO/ne3dw+/oYDL/6M0eYXjyekROeFBEukY21 oY3j6QJ8CCu19wrKD77TZezsLzGb3M4nH8PDYJTni9DhPPT/nUuV/ozqmU8Z0Y4US9Mw T/Aw== X-Gm-Message-State: AC+VfDx8Z6MF30soZEdQvl2n5I2KyIhw3Pfs8QzKHuWQ9/ad4jnYH17v blz42RFYUS0syslSzhvM+J+t5O2x4B9J6qF/KT8UEKzZWbMNKMWnwFjWZtVF X-Google-Smtp-Source: ACHHUZ6cjFCL098QiiEGDyeLLfL34S1XJgSqQyBvhsKn5QM3tU7vwE9rYffzZqdU3tDO8EzWjXhQ/EHc3hxYE8VuxJM= X-Received: by 2002:a1c:7308:0:b0:3ef:6819:b2ad with SMTP id d8-20020a1c7308000000b003ef6819b2admr17100967wmb.37.1683895529187; Fri, 12 May 2023 05:45:29 -0700 (PDT) MIME-Version: 1.0 From: Yikai Zhao Date: Fri, 12 May 2023 20:45:18 +0800 Message-ID: Subject: 29.0.90; Using python-ts-mode for single buffer should not alter global auto-mode-alist settings To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=i@blahgeek.com; helo=mail-wm1-x335.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.1 (-) 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: -2.1 (--) Hi emacs devs, So today, out of nowhere, I noticed that some of the *.py buffers I opened are using `python-ts-mode` instead of the default `python-mode`, also some of my configs are not working correctly because of this (due to different hooks etc.). I was sure I didn't enable or configure anything related to `python-ts-mode` so that's very strange. After some debugging, it turns out that `markdown-mode` used `python-ts-mode` when fontifying a python code block (https://github.com/jrblevin/markdown-mode/commit/44ac8e4f96f03149f60cb182f8b3f1503f66f6d0), and during that, `python-ts-mode` modified the global `auto-mode-alist` settings so that all future *.py buffers I opened use that instead. I believe this is a bug in emacs: using some treesit-based major mode for single buffer should not automatically alter the global settings. I don't think previously there's any other major modes doing that. I understand that some may argue this behavior to be reasonable based on the thought that, "if the user chose to use treesit for one file, then it would be good to use treesit automatically for all future files". This MAY be true, but in my case, I didn't choose to use it by my own. It's some lisp code down the rabbit hole that loads it without me even realized. I fear that this kind of issue would become more common when: 1. more distros build emacs with treesit support by default and ship with treesit language libraries, 2. more emacs packages tries to use treesit-based major modes internally (I also submitted a bug report to `markdown-mode`: https://github.com/jrblevin/markdown-mode/issues/761) --- In GNU Emacs 29.0.90 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars) Repository revision: emacs-29.0.90 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12013000 System Description: Ubuntu 20.04.5 LTS Configured using: 'configure --prefix=/nix/store/4mgq52v87wxra7nqhvsspn3klp8c731m-emacs-unstable-29.0.90 --disable-build-details --with-modules --with-x-toolkit=lucid --with-xft --with-cairo --with-native-compilation' ------------=_1693672802-6361-1--