From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 26 04:28:47 2024 Received: (at submit) by debbugs.gnu.org; 26 Feb 2024 09:28:47 +0000 Received: from localhost ([127.0.0.1]:48882 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1reXHz-00074l-0v for submit@debbugs.gnu.org; Mon, 26 Feb 2024 04:28:47 -0500 Received: from lists.gnu.org ([209.51.188.17]:40186) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1reXHw-00074U-3X for submit@debbugs.gnu.org; Mon, 26 Feb 2024 04:28:45 -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 1reXHV-0001Pu-DC for bug-gnu-emacs@gnu.org; Mon, 26 Feb 2024 04:28:17 -0500 Received: from smtp03.cbsolt.net ([185.97.217.42]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1reXHL-0007Hv-1D for bug-gnu-emacs@gnu.org; Mon, 26 Feb 2024 04:28:17 -0500 Received: from [10.0.2.15] (host-79-16-242-199.retail.telecomitalia.it [79.16.242.199]) by smtp03.cbsolt.net (Postfix) with ESMTPSA id 4TjwJW5BzPz3wdC for ; Mon, 26 Feb 2024 10:27:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cbsolt.net; s=201504-di4k2w; t=1708939677; bh=xrdrsDsktxmW08IV4FdxnpaCZPoJk2t5cllySMJlk1c=; h=Date:To:From:Subject:From; b=f/L+0V1Hgiqh0NuH+22Ffs6aDVAeW79YoKvj4I9RjI2eGY+QqN9SmlVqxWPUNxZIf KxoLu28tzX6cSg+PQtcRtiN/ORd7ue07ncRdAnWLjAYg5lmp77azmkXaU4EZ5IJRKy VZ2JvZXxYF8CZpwJFi4OIV1NJxwaasSROlKipTec= Content-Type: multipart/alternative; boundary="------------iDCEWKWiqi0rtofnwnQrVwab" Message-ID: <83d4284b-37b8-45c1-84a5-a31eba5abda8@medialab.sissa.it> Date: Mon, 26 Feb 2024 10:27:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: bug-gnu-emacs@gnu.org Content-Language: en-US From: Gabriele Nicolardi Subject: Loss of latex-mode fontification when loading libraries in latex-mode-hook that require json-mode Received-SPF: pass client-ip=185.97.217.42; envelope-from=gabriele@medialab.sissa.it; helo=smtp03.cbsolt.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_REMOTE_IMAGE=0.01, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) 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.3 (--) This is a multi-part message in MIME format. --------------iDCEWKWiqi0rtofnwnQrVwab Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi, my actual scenario involves using |latex-mode-hook| to load some libraries that require |json-mode|. I replicated my issue in a MWE: I have a |LaTeX| file: |\documentclass{article} \usepackage{mwe} \begin{document} \blindtext \noindent \includegraphics[width=.4\textwidth]{example-image-a}\hfill \includegraphics[width=.4\textwidth]{example-image-b} \blindtext \end{document} | If I load it like this: |emacs -Q test.tex | I get this “correct” |latex-mode| fontification: enter image description here I have also a config file (I simplified it to obtain the feature): |(add-hook 'latex-mode-hook #'(lambda () (package-initialize) (require 'json-mode))) | If I load my |.tex| file like this: |emacs -Q --eval "(load-file \"/tmp/config.el\")" test.tex | I lose |latex-mode| fontification: enter image description here 1. In the last case, to restore correct |latex-mode| fontification I need to do |M-x latex-mode| 2. This problem does not happen with other packages or custom libraries but, in my experience, it happens only for the |json-mode| package. 3. If I load |json-mode| “before” |latex-mode| I have no problem. E.g. if I modify the |config.el| file this way: |(package-initialize) (require 'json-mode) | and I do: |emacs -Q --eval "(load-file \"/tmp/config.el\")" test.tex | I get the correct |latex-mode| fontification. Am I doing something wrong or is it some kind of bug in |json-mode| or in |Emacs|? *Important note.* This didn’t happen with previous versions of |Emacs|. Before upgrading to version 29.2, I was using version 27 and never encountered this issue prior to the upgrade. (I opened an issue on StackExchange where you can find the formatted version, with figures, of this message: https://emacs.stackexchange.com/q/80447/15606) Best regards, Gabriele Nicolardi ​ --------------iDCEWKWiqi0rtofnwnQrVwab Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hi,

my actual scenario involves using latex-mode-hook to load some libraries that require json-mode.

I replicated my issue in a MWE:

I have a LaTeX file:

\documentclass{article}
\usepackage{mwe}
\begin{document}

\blindtext

\noindent
\includegraphics[width=.4\textwidth]{example-image-a}\hfill
\includegraphics[width=.4\textwidth]{example-image-b}

\blindtext

\end{document}

If I load it like this:

emacs -Q test.tex

I get this “correct” latex-mode fontification:

enter image description here

I have also a config file (I simplified it to obtain the feature):

(add-hook 'latex-mode-hook
          #'(lambda ()
          (package-initialize)
          (require 'json-mode)))

If I load my .tex file like this:

emacs -Q --eval "(load-file \"/tmp/config.el\")" test.tex

I lose latex-mode fontification:

enter image description here

  1. In the last case, to restore correct latex-mode fontification I need to do M-x latex-mode
  2. This problem does not happen with other packages or custom libraries but, in my experience, it happens only for the json-mode package.
  3. If I load json-mode “before” latex-mode I have no problem. E.g. if I modify the config.el file this way:
(package-initialize)
(require 'json-mode)

and I do:

emacs -Q --eval "(load-file \"/tmp/config.el\")" test.tex

I get the correct latex-mode fontification.

Am I doing something wrong or is it some kind of bug in json-mode or in Emacs?

Important note. This didn’t happen with previous versions of Emacs. Before upgrading to version 29.2, I was using version 27 and never encountered this issue prior to the upgrade.

(I opened an issue on StackExchange where you can find the formatted version, with figures, of this message: https://emacs.stackexchange.com/q/80447/15606)

Best regards,

Gabriele Nicolardi

--------------iDCEWKWiqi0rtofnwnQrVwab-- From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 26 08:04:04 2024 Received: (at 69404) by debbugs.gnu.org; 26 Feb 2024 13:04:04 +0000 Received: from localhost ([127.0.0.1]:34449 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1reaeK-0003AN-AY for submit@debbugs.gnu.org; Mon, 26 Feb 2024 08:04:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34374) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1reaeI-00039V-FN for 69404@debbugs.gnu.org; Mon, 26 Feb 2024 08:04:03 -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 1readl-0005mM-Po; Mon, 26 Feb 2024 08:03:30 -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=9SnZ0pusY8EB4/yuJI96vhrKDz+Mm3ik4/cm8NuLtPQ=; b=fQit4rDW3+QWyc3JC/qk MN/GqpW9vkypFzON3vSly24Qs7naLVOVKcu7Ke5yJ3aTT8elDU0RlTtY1ghZ27tvlknl8jiK4ewaw XkG82yZ21Yw7+Tku+e9jlixIyayu/23UmOi1+L8l3mkEJjErHUy+07aLURQ/uyDjuPVDQxI+VFvXd lFN0yqXs+loBkN5jEpSkJ+arHGBgctggOL3Oy7NtSizKB+IgKzhU17Thl1aNTbYsJmbIYI/nrRnyO vGzC3zLoJbLorefJSk0cz3ijuO4tMkWA0K7Mw33BCKppNt0j4nEtMF/lTx5tALhS+DOAp6FIinq8M Nq4joOrJXE6B0w==; Date: Mon, 26 Feb 2024 15:03:19 +0200 Message-Id: <861q8zwf6w.fsf@gnu.org> From: Eli Zaretskii To: Gabriele Nicolardi In-Reply-To: <83d4284b-37b8-45c1-84a5-a31eba5abda8@medialab.sissa.it> (message from Gabriele Nicolardi on Mon, 26 Feb 2024 10:27:53 +0100) Subject: Re: bug#69404: Loss of latex-mode fontification when loading libraries in latex-mode-hook that require json-mode References: <83d4284b-37b8-45c1-84a5-a31eba5abda8@medialab.sissa.it> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 69404 Cc: 69404@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 (---) > Date: Mon, 26 Feb 2024 10:27:53 +0100 > From: Gabriele Nicolardi > > I have a LaTeX file: > > \documentclass{article} > \usepackage{mwe} > \begin{document} > > \blindtext > > \noindent > \includegraphics[width=.4\textwidth]{example-image-a}\hfill > \includegraphics[width=.4\textwidth]{example-image-b} > > \blindtext > > \end{document} > > If I load it like this: > > emacs -Q test.tex > > I get this “correct” latex-mode fontification: > > I have also a config file (I simplified it to obtain the feature): > > (add-hook 'latex-mode-hook > #'(lambda () > (package-initialize) > (require 'json-mode))) > > If I load my .tex file like this: > > emacs -Q --eval "(load-file \"/tmp/config.el\")" test.tex > > I lose latex-mode fontification: What is the value of major-mode after you load your .tex file as above? From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 26 10:41:53 2024 Received: (at 69404) by debbugs.gnu.org; 26 Feb 2024 15:41:53 +0000 Received: from localhost ([127.0.0.1]:44996 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1red72-0003FZ-Bz for submit@debbugs.gnu.org; Mon, 26 Feb 2024 10:41:53 -0500 Received: from smtp01.cbsolt.net ([185.97.217.40]:51670) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1red70-0003F9-D7 for 69404@debbugs.gnu.org; Mon, 26 Feb 2024 10:41:51 -0500 Received: from [10.0.2.15] (host-79-16-242-199.retail.telecomitalia.it [79.16.242.199]) by smtp01.cbsolt.net (Postfix) with ESMTPSA id 4Tk4bK1Ljpz3wd9; Mon, 26 Feb 2024 16:41:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cbsolt.net; s=201504-di4k2w; t=1708962079; bh=K87YyHsSl//sKsAXcI36Zao0n2mE0JVOFkTHh9uVfas=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=pKecjKlM3eDtdrEOlh0NP5v3q/TavRqbYplP4Lilr4JQgZNzCtnnE6v2NZ7VPEDr6 PnrGZmhz+8b31tjr8RFLqrLHwN4Uw5T5hOsd+8FEownnDjTqWMIcRAP1K8KSx74P67 W8eGVzouSK1s6/U7oa3+qAB0PcE2lyF0m7eN3iTY= Message-ID: Date: Mon, 26 Feb 2024 16:41:15 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#69404: Loss of latex-mode fontification when loading libraries in latex-mode-hook that require json-mode Content-Language: en-US To: Eli Zaretskii References: <83d4284b-37b8-45c1-84a5-a31eba5abda8@medialab.sissa.it> <861q8zwf6w.fsf@gnu.org> From: Gabriele Nicolardi In-Reply-To: <861q8zwf6w.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 69404 Cc: 69404@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 (-) Il 26/02/24 14:03, Eli Zaretskii ha scritto: >> Date: Mon, 26 Feb 2024 10:27:53 +0100 >> From: Gabriele Nicolardi >> >> I have a LaTeX file: >> >> \documentclass{article} >> \usepackage{mwe} >> \begin{document} >> >> \blindtext >> >> \noindent >> \includegraphics[width=.4\textwidth]{example-image-a}\hfill >> \includegraphics[width=.4\textwidth]{example-image-b} >> >> \blindtext >> >> \end{document} >> >> If I load it like this: >> >> emacs -Q test.tex >> >> I get this “correct” latex-mode fontification: >> >> I have also a config file (I simplified it to obtain the feature): >> >> (add-hook 'latex-mode-hook >> #'(lambda () >> (package-initialize) >> (require 'json-mode))) >> >> If I load my .tex file like this: >> >> emacs -Q --eval "(load-file \"/tmp/config.el\")" test.tex >> >> I lose latex-mode fontification: > What is the value of major-mode after you load your .tex file as > above? In the buffer loaded as above, with the wrong fontification, I have: major-mode is a variable defined in ‘C source code’. Its value is ‘latex-mode’ Original value was ‘fundamental-mode’ Local in buffer test.tex; global value is fundamental-mode From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 26 11:20:40 2024 Received: (at 69404) by debbugs.gnu.org; 26 Feb 2024 16:20:41 +0000 Received: from localhost ([127.0.0.1]:47279 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rediZ-0007us-PM for submit@debbugs.gnu.org; Mon, 26 Feb 2024 11:20:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47736) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rediK-0007tW-1k for 69404@debbugs.gnu.org; Mon, 26 Feb 2024 11:20:39 -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 1redMH-0004Zs-0j; Mon, 26 Feb 2024 10:57:37 -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=tKyYU3PMbZVukOGjZcFOWWmmKJsGzp4QcaLrPw4Sq7o=; b=O4fBNHyHsDl98Mm/50fx 6Rk8YJ63RHQ9q4oQWSBcSot0eKPTG0pIUs9a8ZbWcTEbW+TafV4MQS4GH/RcvapyQnbtPTkVMinmc BOWsj3nSHgxeyk366zOFvrXkfM6g9nYRQ9WSae4Txe59mLO1nH8y0cN2DtIrPrnrJsQCdJpTtnQAI EmVY8m1ENqhqORVzZ2QY9L3SjWQki8+vbLx5VKdNlrOJHfkm/MiU8GAFkgCgCem/WrPnM1nh9K9VX hjS2j7JmJzIW06hcNroqn9XdjP5cNdxSBXw4BU/r7ge+qDxBzx2pzuscBE3a50UiTrDscp78b5Omd yzaIXlBhokyo4Q==; Date: Mon, 26 Feb 2024 17:57:07 +0200 Message-Id: <86plwjusks.fsf@gnu.org> From: Eli Zaretskii To: Gabriele Nicolardi In-Reply-To: (message from Gabriele Nicolardi on Mon, 26 Feb 2024 16:41:15 +0100) Subject: Re: bug#69404: Loss of latex-mode fontification when loading libraries in latex-mode-hook that require json-mode References: <83d4284b-37b8-45c1-84a5-a31eba5abda8@medialab.sissa.it> <861q8zwf6w.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 69404 Cc: 69404@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 (---) > Date: Mon, 26 Feb 2024 16:41:15 +0100 > Cc: 69404@debbugs.gnu.org > From: Gabriele Nicolardi > > > Il 26/02/24 14:03, Eli Zaretskii ha scritto: > >> If I load my .tex file like this: > >> > >> emacs -Q --eval "(load-file \"/tmp/config.el\")" test.tex > >> > >> I lose latex-mode fontification: > > What is the value of major-mode after you load your .tex file as > > above? > > In the buffer loaded as above, with the wrong fontification, I have: > > major-mode is a variable defined in ‘C source code’. > > > Its value is ‘latex-mode’ > Original value was ‘fundamental-mode’ > Local in buffer test.tex; global value is fundamental-mode Then I suggest to look for the reason in json-mode.el. For example, this part: (add-to-list 'magic-fallback-mode-alist '("^[{[]$" . json-mode)) could change the global state when you load json-mode. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 26 11:42:04 2024 Received: (at 69404) by debbugs.gnu.org; 26 Feb 2024 16:42:04 +0000 Received: from localhost ([127.0.0.1]:48392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ree3I-0000Oo-A7 for submit@debbugs.gnu.org; Mon, 26 Feb 2024 11:42:04 -0500 Received: from smtp06.cbsolt.net ([185.97.217.45]:40086) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ree3G-0000O7-Gu for 69404@debbugs.gnu.org; Mon, 26 Feb 2024 11:42:03 -0500 Received: from [10.0.2.15] (host-79-16-242-199.retail.telecomitalia.it [79.16.242.199]) by smtp06.cbsolt.net (Postfix) with ESMTPSA id 4Tk5Xs6PcSz3wnM; Mon, 26 Feb 2024 17:24:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cbsolt.net; s=201504-di4k2w; t=1708964654; bh=38VoOazOE7WJY98JErnKAn0UQ7olycAuxi2pNFaovTc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=fHLMWR9/OQAEXMWlVMD9YLXluGinswZOfT1klclUuQHhLQUi1iXGbS4Bgmby+x5kd l5fU1h0ElAadp4r6Z/dQ6AoRORde1BERAufWp07oaaP3a4GG2R9aoC679QpmuQeI7+ g0luakgFeJ3HfyHd9XWAn2Wm8pAMLP9gslHwgQ9U= Content-Type: multipart/alternative; boundary="------------P6H7rOeuV2ESGNBbE3eGHRMb" Message-ID: Date: Mon, 26 Feb 2024 17:24:12 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#69404: Loss of latex-mode fontification when loading libraries in latex-mode-hook that require json-mode Content-Language: en-US To: Eli Zaretskii References: <83d4284b-37b8-45c1-84a5-a31eba5abda8@medialab.sissa.it> <861q8zwf6w.fsf@gnu.org> <86plwjusks.fsf@gnu.org> From: Gabriele Nicolardi In-Reply-To: <86plwjusks.fsf@gnu.org> X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 69404 Cc: 69404@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 (-) This is a multi-part message in MIME format. --------------P6H7rOeuV2ESGNBbE3eGHRMb Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Il 26/02/24 16:57, Eli Zaretskii ha scritto: >> In the buffer loaded as above, with the wrong fontification, I have: >> >> major-mode is a variable defined in ‘C source code’. >> >> >> Its value is ‘latex-mode’ >> Original value was ‘fundamental-mode’ >> Local in buffer test.tex; global value is fundamental-mode > Then I suggest to look for the reason in json-mode.el. For example, > this part: > > (add-to-list 'magic-fallback-mode-alist '("^[{[]$" . json-mode)) > > could change the global state when you load json-mode. I opened and issue on the json-mode GitHub project page. --------------P6H7rOeuV2ESGNBbE3eGHRMb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit Il 26/02/24 16:57, Eli Zaretskii ha scritto:
In the buffer loaded as above, with the wrong fontification, I have:

major-mode is a variable defined in ‘C source code’.


Its value is ‘latex-mode’
Original value was ‘fundamental-mode’
Local in buffer test.tex; global value is fundamental-mode
Then I suggest to look for the reason in json-mode.el.  For example,
this part:

  (add-to-list 'magic-fallback-mode-alist '("^[{[]$" . json-mode))

could change the global state when you load json-mode.

I opened and issue on the json-mode GitHub project page.


--------------P6H7rOeuV2ESGNBbE3eGHRMb-- From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 28 08:30:20 2024 Received: (at 69404) by debbugs.gnu.org; 28 Feb 2024 13:30:20 +0000 Received: from localhost ([127.0.0.1]:39877 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rfK0o-0006u6-6V for submit@debbugs.gnu.org; Wed, 28 Feb 2024 08:30:19 -0500 Received: from smtp01.cbsolt.net ([185.97.217.40]:33788) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rfK0k-0006sW-9J for 69404@debbugs.gnu.org; Wed, 28 Feb 2024 08:30:16 -0500 Received: from [10.0.2.15] (host-79-16-242-199.retail.telecomitalia.it [79.16.242.199]) by smtp01.cbsolt.net (Postfix) with ESMTPSA id 4TlFZY0cQzz3wt6; Wed, 28 Feb 2024 14:29:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cbsolt.net; s=201504-di4k2w; t=1709126981; bh=1T95aXhg/086MIRLknEEBQFDRGL9KK6ulhelVVJ7wUg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=II9V9YW1vrHjiQIhI4WPgrSR7KnPsnsHzY6LuK8h8V7dOTRX0+3mMefX+ae1lDOL+ /OoDe4SagIUsbsORdlTrFUzoN2kuVICS0C05Gqygio5EtwGAq3CVGm7Vj/lqxruqTo JVuep4ZSMyim0HiLo4c7sIv2KlTKtMux1qyNCUbM= Message-ID: Date: Wed, 28 Feb 2024 14:29:40 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#69404: Loss of latex-mode fontification when loading libraries in latex-mode-hook that require json-mode Content-Language: en-US To: Eli Zaretskii References: <83d4284b-37b8-45c1-84a5-a31eba5abda8@medialab.sissa.it> <861q8zwf6w.fsf@gnu.org> <86plwjusks.fsf@gnu.org> From: Gabriele Nicolardi In-Reply-To: <86plwjusks.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 69404 Cc: 69404@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 (-) Indeed it was a bug in json-mode.el https://github.com/json-emacs/json-mode/issues/79 Thanks! Gabriele Nicolardi Il 26/02/24 16:57, Eli Zaretskii ha scritto: >> Date: Mon, 26 Feb 2024 16:41:15 +0100 >> Cc: 69404@debbugs.gnu.org >> From: Gabriele Nicolardi >> >> >> Il 26/02/24 14:03, Eli Zaretskii ha scritto: >>>> If I load my .tex file like this: >>>> >>>> emacs -Q --eval "(load-file \"/tmp/config.el\")" test.tex >>>> >>>> I lose latex-mode fontification: >>> What is the value of major-mode after you load your .tex file as >>> above? >> In the buffer loaded as above, with the wrong fontification, I have: >> >> major-mode is a variable defined in ‘C source code’. >> >> >> Its value is ‘latex-mode’ >> Original value was ‘fundamental-mode’ >> Local in buffer test.tex; global value is fundamental-mode > Then I suggest to look for the reason in json-mode.el. For example, > this part: > > (add-to-list 'magic-fallback-mode-alist '("^[{[]$" . json-mode)) > > could change the global state when you load json-mode. From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 28 08:42:07 2024 Received: (at 69404-done) by debbugs.gnu.org; 28 Feb 2024 13:42:07 +0000 Received: from localhost ([127.0.0.1]:40516 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rfKCD-0007R3-Kn for submit@debbugs.gnu.org; Wed, 28 Feb 2024 08:42:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56502) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rfKC9-0007QN-2v for 69404-done@debbugs.gnu.org; Wed, 28 Feb 2024 08:42:04 -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 1rfKBa-00032C-LJ; Wed, 28 Feb 2024 08:41:26 -0500 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=EiqQd7tJVUkATgngUfFB+vsJPuCjyFvllpnl7n9MmMI=; b=eEII2wHZHhd+ 37JzaBBW+9W3z6TvhIU0L5muUdng2v79AOy3YL9gK3yyDKJiiouI/ZiPg/03Zn6t3PrOJ4GE8KE2B WflyEvrrKE6tdnCwon0sb5h3C9Qt8x2pDxRdMwiAc8BoG2yVq7Kl/zxiKiljp4juaKQVQrtKd1ebn b8kjmgr/LjrGwZYMeHjWtFu6rW/NBBnHSn7YfrXf4zkmNVH27mHp0FaX5U4wgXlilVBcb8LrUiHYx HVR2S7TAJ5xq1tiL4Fx4WliYTRVjMOSASb9WMJ3Ua/uXe8r/tEMJQoj6RpYfEfbWiFiSYvZD+FM9u GVNO+wIyp7Pq7ySMdGGO8A==; Date: Wed, 28 Feb 2024 15:41:24 +0200 Message-Id: <86zfvkso3f.fsf@gnu.org> From: Eli Zaretskii To: Gabriele Nicolardi In-Reply-To: (message from Gabriele Nicolardi on Wed, 28 Feb 2024 14:29:40 +0100) Subject: Re: bug#69404: Loss of latex-mode fontification when loading libraries in latex-mode-hook that require json-mode References: <83d4284b-37b8-45c1-84a5-a31eba5abda8@medialab.sissa.it> <861q8zwf6w.fsf@gnu.org> <86plwjusks.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 69404-done Cc: 69404-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: -3.3 (---) > Date: Wed, 28 Feb 2024 14:29:40 +0100 > Cc: 69404@debbugs.gnu.org > From: Gabriele Nicolardi > > Indeed it was a bug in json-mode.el > > https://github.com/json-emacs/json-mode/issues/79 Thanks for telling us, I'm therefore closing this bug. From unknown Mon Aug 11 18:19:23 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 28 Mar 2024 11:24:07 +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