GNU bug report logs - #69404
Loss of latex-mode fontification when loading libraries in latex-mode-hook that require json-mode

Previous Next

Package: emacs;

Reported by: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>

Date: Mon, 26 Feb 2024 09:29:01 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#69404: closed (Loss of latex-mode fontification when loading
 libraries in latex-mode-hook that require json-mode)
Date: Wed, 28 Feb 2024 13:43:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Wed, 28 Feb 2024 15:41:24 +0200
with message-id <86zfvkso3f.fsf <at> gnu.org>
and subject line Re: bug#69404: Loss of latex-mode fontification when loading libraries in latex-mode-hook that require json-mode
has caused the debbugs.gnu.org bug report #69404,
regarding Loss of latex-mode fontification when loading libraries in latex-mode-hook that require json-mode
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
69404: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=69404
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
To: bug-gnu-emacs <at> gnu.org
Subject: Loss of latex-mode fontification when loading libraries in
 latex-mode-hook that require json-mode
Date: Mon, 26 Feb 2024 10:27:53 +0100
[Message part 3 (text/plain, inline)]
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

​
[Message part 4 (text/html, inline)]
[Message part 5 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
Cc: 69404-done <at> debbugs.gnu.org
Subject: Re: bug#69404: Loss of latex-mode fontification when loading
 libraries in latex-mode-hook that require json-mode
Date: Wed, 28 Feb 2024 15:41:24 +0200
> Date: Wed, 28 Feb 2024 14:29:40 +0100
> Cc: 69404 <at> debbugs.gnu.org
> From: Gabriele Nicolardi <gabriele <at> 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.


This bug report was last modified 1 year and 135 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.