-
Notifications
You must be signed in to change notification settings - Fork 69
Description
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.texI 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.texI lose latex-mode fontification:
- In the last case, to restore correct
latex-modefontification I need to doM-x latex-mode - This problem does not happen with other packages or custom libraries but, in my experience, it happens only for the
json-modepackage. - If I load
json-mode"before"latex-modeI have no problem. E.g. if I modify theconfig.elfile this way:
(package-initialize)
(require 'json-mode)
and I do:
emacs -Q --eval "(load-file \"/tmp/config.el\")" test.texI 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 a ticket bug fix: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=69404
And I was aswered:
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.
Best Regards,
Gabriele

