* bug#69404: Loss of latex-mode fontification when loading libraries in latex-mode-hook that require json-mode
@ 2024-02-26 9:27 Gabriele Nicolardi
2024-02-26 13:03 ` Eli Zaretskii
0 siblings, 1 reply; 7+ messages in thread
From: Gabriele Nicolardi @ 2024-02-26 9:27 UTC (permalink / raw)
To: 69404
[-- Attachment #1: Type: text/plain, Size: 1928 bytes --]
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 <https://i.stack.imgur.com/J2nvW.png>
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 <https://i.stack.imgur.com/pCKy8.png>
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
[-- Attachment #2: Type: text/html, Size: 14878 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#69404: Loss of latex-mode fontification when loading libraries in latex-mode-hook that require json-mode
2024-02-26 9:27 bug#69404: Loss of latex-mode fontification when loading libraries in latex-mode-hook that require json-mode Gabriele Nicolardi
@ 2024-02-26 13:03 ` Eli Zaretskii
2024-02-26 15:41 ` Gabriele Nicolardi
0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2024-02-26 13:03 UTC (permalink / raw)
To: Gabriele Nicolardi; +Cc: 69404
> Date: Mon, 26 Feb 2024 10:27:53 +0100
> From: Gabriele Nicolardi <gabriele@medialab.sissa.it>
>
> 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?
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#69404: Loss of latex-mode fontification when loading libraries in latex-mode-hook that require json-mode
2024-02-26 13:03 ` Eli Zaretskii
@ 2024-02-26 15:41 ` Gabriele Nicolardi
2024-02-26 15:57 ` Eli Zaretskii
0 siblings, 1 reply; 7+ messages in thread
From: Gabriele Nicolardi @ 2024-02-26 15:41 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 69404
Il 26/02/24 14:03, Eli Zaretskii ha scritto:
>> Date: Mon, 26 Feb 2024 10:27:53 +0100
>> From: Gabriele Nicolardi <gabriele@medialab.sissa.it>
>>
>> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#69404: Loss of latex-mode fontification when loading libraries in latex-mode-hook that require json-mode
2024-02-26 15:41 ` Gabriele Nicolardi
@ 2024-02-26 15:57 ` Eli Zaretskii
2024-02-26 16:24 ` Gabriele Nicolardi
2024-02-28 13:29 ` Gabriele Nicolardi
0 siblings, 2 replies; 7+ messages in thread
From: Eli Zaretskii @ 2024-02-26 15:57 UTC (permalink / raw)
To: Gabriele Nicolardi; +Cc: 69404
> Date: Mon, 26 Feb 2024 16:41:15 +0100
> Cc: 69404@debbugs.gnu.org
> From: Gabriele Nicolardi <gabriele@medialab.sissa.it>
>
>
> 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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#69404: Loss of latex-mode fontification when loading libraries in latex-mode-hook that require json-mode
2024-02-26 15:57 ` Eli Zaretskii
@ 2024-02-26 16:24 ` Gabriele Nicolardi
2024-02-28 13:29 ` Gabriele Nicolardi
1 sibling, 0 replies; 7+ messages in thread
From: Gabriele Nicolardi @ 2024-02-26 16:24 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 69404
[-- Attachment #1: Type: text/plain, Size: 600 bytes --]
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.
[-- Attachment #2: Type: text/html, Size: 1035 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#69404: Loss of latex-mode fontification when loading libraries in latex-mode-hook that require json-mode
2024-02-26 15:57 ` Eli Zaretskii
2024-02-26 16:24 ` Gabriele Nicolardi
@ 2024-02-28 13:29 ` Gabriele Nicolardi
2024-02-28 13:41 ` Eli Zaretskii
1 sibling, 1 reply; 7+ messages in thread
From: Gabriele Nicolardi @ 2024-02-28 13:29 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 69404
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 <gabriele@medialab.sissa.it>
>>
>>
>> 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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#69404: Loss of latex-mode fontification when loading libraries in latex-mode-hook that require json-mode
2024-02-28 13:29 ` Gabriele Nicolardi
@ 2024-02-28 13:41 ` Eli Zaretskii
0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2024-02-28 13:41 UTC (permalink / raw)
To: Gabriele Nicolardi; +Cc: 69404-done
> Date: Wed, 28 Feb 2024 14:29:40 +0100
> Cc: 69404@debbugs.gnu.org
> From: Gabriele Nicolardi <gabriele@medialab.sissa.it>
>
> 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.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-02-28 13:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-26 9:27 bug#69404: Loss of latex-mode fontification when loading libraries in latex-mode-hook that require json-mode Gabriele Nicolardi
2024-02-26 13:03 ` Eli Zaretskii
2024-02-26 15:41 ` Gabriele Nicolardi
2024-02-26 15:57 ` Eli Zaretskii
2024-02-26 16:24 ` Gabriele Nicolardi
2024-02-28 13:29 ` Gabriele Nicolardi
2024-02-28 13:41 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.