[latex3-commits] [git/LaTeX3-latex3-latex2e] edef-opts: protected at edef in option handler (269b6dfb)
David Carlisle
d.p.carlisle at gmail.com
Mon Oct 10 22:32:05 CEST 2022
Repository : https://github.com/latex3/latex2e
On branch : edef-opts
Link : https://github.com/latex3/latex2e/commit/269b6dfb4aafd7f5f4bc15132bb38bd5005708cf
>---------------------------------------------------------------
commit 269b6dfb4aafd7f5f4bc15132bb38bd5005708cf
Author: David Carlisle <d.p.carlisle at gmail.com>
Date: Mon Oct 10 21:32:05 2022 +0100
protected at edef in option handler
>---------------------------------------------------------------
269b6dfb4aafd7f5f4bc15132bb38bd5005708cf
base/ltclass.dtx | 19 ++++++++++++-----
base/testfiles/github-0932.lvt | 24 ++++++++++++++++++++++
.../testfiles/{github-0109.tlg => github-0932.tlg} | 9 ++++----
3 files changed, 43 insertions(+), 9 deletions(-)
diff --git a/base/ltclass.dtx b/base/ltclass.dtx
index 35c4251f..1d27d6e7 100644
--- a/base/ltclass.dtx
+++ b/base/ltclass.dtx
@@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltclass.dtx}
- [2022/06/20 v1.5c LaTeX Kernel (Class & Package Interface)]
+ [2022/10/10 v1.5d LaTeX Kernel (Class & Package Interface)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltclass.dtx}
@@ -1302,7 +1302,10 @@
{\@expl@@@filehook at resolve@file at subst@@w #3.#1\@nil}%
\reserved at a\reserved at b
\@expl@@@filehook at clear@replacement at flag@@
- \expandafter\xdef\csname opt@\reserved at a\endcsname{%
+% \end{macrocode}
+% \changes{v1.5d}{2022/010/10}{Use \cs{\protected at xdef}.}
+% \begin{macrocode}
+ \expandafter\protected at xdef\csname opt@\reserved at a\endcsname{%
\@ifundefined{opt@\reserved at a}\@empty
{\csname opt@\reserved at a\endcsname,}%
\zap at space#2 \@empty}%
@@ -1476,10 +1479,12 @@
% {Star form added.}
% \changes{v0.2c}{1993/11/17}
% {restoring \cs{@fileswith at pti@ns} added.}
+% \changes{v1.5d}{2022/010/10}
+% {Use \cs{\protected at edef}.}
% \begin{macrocode}
\def\ProcessOptions{%
\let\ds@\@empty
- \edef\@curroptions{\@ptionlist{\@currname.\@currext}}%
+ \protected at edef\@curroptions{\@ptionlist{\@currname.\@currext}}%
\@ifstar\@xprocess at ptions\@process at ptions}
\@onlypreamble\ProcessOptions
% \end{macrocode}
@@ -2186,7 +2191,10 @@
\@ifundefined{opt at fam@\@currname.\@currext}
{\@onefilewithoptions at clashchk{#2}}
{%
- \expandafter\edef\csname opt@\@currname.\@currext\endcsname
+% \end{macrocode}
+% \changes{v1.5d}{2022/010/10}{Use \cs{\protected at edef}.}
+% \begin{macrocode}
+ \expandafter\protected at edef\csname opt@\@currname.\@currext\endcsname
{\zap at space#2 \@empty}%
\@namedef{@raw at opt@\@currname.\@currext}{#2}%
\expandafter\expandafter\expandafter\ProcessKeyOptions
@@ -2693,10 +2701,11 @@
% \changes{v0.2v}{1994/01/29}
% {Macro added.}
% \changes{v1.0t}{1995/11/14}{Allow empty option}
+% \changes{v1.5d}{2022/010/10}{Use \cs{\protected at edef}.}
% \begin{macrocode}
\def\@@unprocessedoptions{%
\ifx\@currext\@pkgextension
- \edef\@curroptions{\@ptionlist{\@currname.\@currext}}%
+ \protected at edef\@curroptions{\@ptionlist{\@currname.\@currext}}%
\@for\CurrentOption:=\@curroptions\do{%
\ifx\CurrentOption\@empty\else\@unknownoptionerror\fi}%
\fi}
diff --git a/base/testfiles/github-0932.lvt b/base/testfiles/github-0932.lvt
new file mode 100644
index 00000000..c0411847
--- /dev/null
+++ b/base/testfiles/github-0932.lvt
@@ -0,0 +1,24 @@
+\begin{filecontents}{0932.sty}
+
+\ProvidesPackage{0932}
+
+\def\mainfont{\reset at font}
+
+\DeclareKeys{
+font .store = \mainfont
+}
+
+\ProcessKeyOptions
+\end{filecontents}
+
+\documentclass{article}
+
+\input{test2e}
+
+\START
+% this should not error
+\usepackage[font=\bfseries]{0932}
+
+\show\mainfont
+
+\END
diff --git a/base/testfiles/github-0109.tlg b/base/testfiles/github-0932.tlg
similarity index 56%
copy from base/testfiles/github-0109.tlg
copy to base/testfiles/github-0932.tlg
index bdde2283..3d248c07 100644
--- a/base/testfiles/github-0109.tlg
+++ b/base/testfiles/github-0932.tlg
@@ -1,7 +1,8 @@
This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
-(github-0109-2.tex
-file 2
-) (github-0109-1.tex
-file 1
+(0932.sty
+Package: 0932
)
+> \mainfont=macro:
+->\bfseries .
+l. ...\show\mainfont
More information about the latex3-commits
mailing list.