Honour protect in edef but expand it normally

\protect was just a no-op token, so \edef\b{\protect\a} expanded \a at
definition time. In an edef-style pass the expander now copies \protect and the
following token unchanged (so the stored body keeps the protected command); in
the ordinary document pass it drops \protect and lets the token expand as
LaTeX does when the text is typeset.

A test defines a=A, \edef b={\protect\a}, redefines a=C, and checks both \b and
a literal \protect\a print C with no warnings.
This commit is contained in:
gloamxun committed 2026-10-27 01:54:13 +08:00
1 parent c3ae52452d
commit 53a299bd58
4 files changed
+45 -6

No files matched your search

+2 -2
View File
@@ -14,12 +14,12 @@ cargo fmt --all -- --check
cargo test --workspace --offline
```
The workspace currently passes **1018 tests**:
The workspace currently passes **1019 tests**:
| Suite | Tests |
| --- | --- |
| route-D unit (engine) | 437 |
| engine binary unit | 389 |
| engine binary unit | 390 |
| server integration | 63 |
| v1 integration | 71 |
| pdfLaTeX oracle | 42 |