Subject: bug#77059: 14.0.9; Errors signaled by LuaLaTeX about missing characters are not reported as such

From: jfbu <[email-masked]>
Date: Sun, 16 Mar 2025 19:53:44 +0100

With LuaLaTeX (and other engines) it is possible since a few years 
to set \tracinglostchars=3 (the LaTeX kernel uses 2 not 3).

This means that attempting
to use a character not existing in the current document font
will cause an error on built.  But it seems such errors are
not parsed by AUCTeX, and as a result, this important
mechanism to not produce wrong output is lost.

Here is an example, adapted from
https://tex.stackexchange.com/q/739039/293669

```latex
\documentclass{article}
\RequirePackage{fontspec}% compile with lualatex
\tracinglostchars=3 % 2 is latex default (=warn)
\begin{document}
Hello.\par
\typeout{AAAAAAAAA}
\sbox0{\char"3E3A}
\typeout{BBBBBBBBB}
\char"3E3A\par
\typeout{CCCCCCCCC}
\end{document}

% Local Variables:
% TeX-engine: luatex
% End:
```

With TeXLive2025  LuaLaTeX you can set \tracinglostchars=5
and the effect is triggered also by the box construction,
not only by material ending up on the galley.

(the above example is by a contributor to tex.sx who
was trying to test that recent TeXLive 2025 LuaLaTeX feature).

To reproduce the problem paste the above in an Emacs window,
hit C-cC-n to get AUCTeX parse and understand that it is to
use LuaLaTeX then hit C-cC-a.  No error will be reported.
(At least this is what happens at my locale).

With XeTeX engine, the error **is** reported by AUCTeX.

For info the LuaLaTeX log contains following type of lines.

```text
AAAAAAAAA
Missing character: There is no 㸺 (U+3E3A) in font [lmroman10-regular]:+tlig;!
.
\sbox  ...box {\color@setgroup #2\color@endgroup }
                                                  
l.7 \sbox0{\char"3E3A}
                       % No problem ?!

BBBBBBBBB
Missing character: There is no 㸺 (U+3E3A) in font [lmroman10-regular]:+tlig;!
.
<argument> ...hskip:D \c_zero_dim \fi: \tex_par:D 
                                                  \hook_use:n {para/after}\@...
l.9 \char"3E3A\par
                   % Or \usebox0

Missing character: There is no 㸺 (U+3E3A) in font [lmroman10-regular]:+tlig;!
.
<argument> ...hskip:D \c_zero_dim \fi: \tex_par:D 
                                                  \hook_use:n {para/after}\@...
l.9 \char"3E3A\par
                   % Or \usebox0

CCCCCCCCC

```

For the above I set \tracinglostchars=5 because I am using a TeXLive2025
LuaLaTeX (*) with 3 in place of 5 you will get only on error line in the log
and it will actually be located there after the CCCCCCCCC.

Jean-François B.

(*) which at time of writing has problems with math mode, but that is
another non-AUCTeX matter.

; I can not include TeX-command-list as it contains private things

Emacs  : GNU Emacs 28.1 (build 1, x86_64-apple-darwin17.7.0, Carbon Version 158 AppKit 1561.61)
 of 2022-05-10
Package: 14.0.9

current state:
==============
(setq
 window-system 'mac
 LaTeX-version "2e"
 TeX-style-path '("~/.emacs.d/auctex/" "/path/to/.emacs.d/elpa/auctex-14.0.9/style"
		  "/path/to/.emacs.d/auctex/.auto" "/path/to/.emacs.d/auctex/style"
		  ".auto" "style")
 TeX-auto-save t
 TeX-parse-self t
 TeX-master t
)