GNU bug report logs - #76781
Fontification of expl3 code

Previous Next

Package: auctex;

Reported by: Arash Esbati <arash <at> gnu.org>

Date: Thu, 6 Mar 2025 13:00:02 UTC

Severity: normal

Fixed in version 14.1.0

Done: Arash Esbati <arash <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Arash Esbati <arash <at> gnu.org>
Cc: 76781 <at> debbugs.gnu.org
Subject: bug#76781: Fontification of expl3 code
Date: Thu, 27 Mar 2025 22:21:33 +0900
[Message part 1 (text/plain, inline)]
>>>>> Ikumi Keita <ikumi <at> ikumi.que.jp> writes:
> 2. I think that there are two approaches to this bug.
>    A: To move the call to `TeX-master-file' and `TeX-update-style' from
>       `find-file-hook' to somewhere run _before_
>       `after-change-major-mode-hook' and _after_ major mode hook and
>       local variables entries are applied.
>    B: To abandon the assumption in question and make a new AUCTeX policy
>       to write style files assuming that style hooks are run after font
>       lock is enabled.

>    In my view, A isn't satisfactory:

I changed my mind. :-) It seems that we can use
`hack-local-variables-hook'. The attached patch looks working well for
me, although this affects tex-jp.el.

>    o It wouldn't be robust. The detail of the interaction between major
>      mode function and turning on of font lock can be subject to further
>      changes in future.
>    o There is no suitable place for such "somewhere". Looking at the
>      definition of `run-mode-hooks', the only possibility is to register
>      the calls as local hook of `after-change-major-mode-hook' but I'm
>      afraid that such treatment can break in future as described in the
>      previous item.
>    (On the other hand, there is a good aspect that we can merge call to
>    `TeX-update-sytle' for non-file buffer in `TeX-mode-cleanup'.)

This doesn't happen for the attached patch because emacs doesn't run
`hack-local-variables-hook' for non-file buffer. However, we can
simplify `TeX-normal-mode', which doesn't run `find-file-hook' whereas
does `hack-local-variables-hook' through `normal-mode'.

>    If we take approach B, I think the proper solution is to use
>    `font-latex-add-to-syntax-alist' instead of re-calling
>    `font-lock-set-defaults' in expl3.el. See the attached patch.
>    Additionally, we would have to revise similarly existing style files
>    which install their own syntax tables. I expect this doesn't require
>    much work; Here is the output of "grep -E set-syntax-table *.el"
>    under style/ subdirectory:
> brazilian.el:   (set-syntax-table LaTeX-brazilian-mode-syntax-table)
> bulgarian.el:   (set-syntax-table LaTeX-bulgarian-mode-syntax-table)
> expl3.el:   (set-syntax-table LaTeX-expl3-syntax-table)
> german.el:   (set-syntax-table LaTeX-german-mode-syntax-table)
> icelandic.el:   (set-syntax-table LaTeX-icelandic-mode-syntax-table)
> ngerman.el:   (set-syntax-table LaTeX-german-mode-syntax-table)
> plfonts.el:   (set-syntax-table LaTeX-plfonts-mode-syntax-table)
> plhb.el:   (set-syntax-table LaTeX-plhb-mode-syntax-table)
> polish.el:   (set-syntax-table LaTeX-polish-mode-syntax-table)
> portuguese.el:   (set-syntax-table LaTeX-portuguese-mode-syntax-table)

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine
#Gaza #StopMassiveKilling #CeasefireNOW

[0001-temporal-commit.patch (text/x-diff, attachment)]

This bug report was last modified 54 days ago.

Previous Next


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