[latex3-commits] [git/LaTeX3-latex3-latex2e] main: Keep file path stack in sync when rolling back/forward (#578) (96ced636)
GitHub
noreply at github.com
Mon Jun 7 10:12:35 CEST 2021
Repository : https://github.com/latex3/latex2e
On branch : main
Link : https://github.com/latex3/latex2e/commit/96ced636fad1663ff48d9882d0ce2f4d4b37aeaa
>---------------------------------------------------------------
commit 96ced636fad1663ff48d9882d0ce2f4d4b37aeaa
Author: Phelype Oleinik <phelype.oleinik at latex-project.org>
Date: Mon Jun 7 05:12:35 2021 -0300
Keep file path stack in sync when rolling back/forward (#578)
* Keep file path stack in sync when rolling back/forward
Fixes #577
* typos
Co-authored-by: Frank Mittelbach <frank.mittelbach at latex-project.org>
>---------------------------------------------------------------
96ced636fad1663ff48d9882d0ce2f4d4b37aeaa
base/changes.txt | 5 ++++
base/doc/latexchanges.tex | 14 ++++++++--
base/ltclass.dtx | 30 ++++++++++++++++++++--
base/testfiles/github-0577.lvt | 11 ++++++++
.../{github-0060.luatex.tlg => github-0577.tlg} | 3 +++
5 files changed, 59 insertions(+), 4 deletions(-)
diff --git a/base/changes.txt b/base/changes.txt
index 20f43334..136554a6 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -20,6 +20,11 @@ All changes above are only part of the development branch for the next release.
loading by \LoadClassWithOptions, expand one step so
\CurrentOption expanded (gh #580)
+2021-06-03 Phelype Oleinik <phelype.oleinik at latex-project.org>
+
+ * ltclass.dtx:
+ Keep file path stack in sync when rolling back/forward (gh/577).
+
#########################
# 2021-06-01 Release
diff --git a/base/doc/latexchanges.tex b/base/doc/latexchanges.tex
index b4f213c5..454a3a65 100644
--- a/base/doc/latexchanges.tex
+++ b/base/doc/latexchanges.tex
@@ -41,12 +41,14 @@
\author{\copyright~Copyright 2015--2021, \LaTeX\ Project Team.\\
All rights reserved.}
-\date{2021-06-06}
+\date{2021-06-07}
% a few commands from doc
\newcommand\Lpack[1]{\mbox{\textsf{#1}}}
\newcommand\DescribeMacro[1]{\texttt{\string#1}}
+\newcommand\pkg[1]{\texttt{#1}}
+
\makeatletter % -- provide command introduced in new release
% so this typesets with an old format
@@ -54,8 +56,11 @@
{\hmode at bgroup\ooalign{\null#1\crcr\hidewidth\raise-.31ex
\hbox{\check at mathfonts\fontsize\ssf at size\z@
\math at fontsfalse\selectfont,}\hidewidth}\egroup}
+
\makeatother
+
+
\ifx\href\undefined
\newcommand\ghissue[1]{github #1}
\newcommand\gnatsissue[1]{gnats #1}
@@ -116,6 +121,11 @@ see for example
A further refinement to the handling of ``raw'' option lists added
in the last release, see \ghissue{508}.
+Fixes an issue with rollback when \pkg{latexrelease} is loaded by some
+other package (as done for \texttt{platex} (\ghissue{577}).
+
+
+
\section{Changes introduced in 2021-06-01}
The focus of this release is to provide further important building
@@ -133,7 +143,7 @@ disconcerting (\ghissue{463}). The other bug was more serious, in some
situations a wrong value of \verb=\CurrentFile= inside of file-related hooks
could lead to errors (\ghissue{464}).
-We also added the documentation file \texttt{userguide3.pdf} which
+We also added the documentation file \texttt{usrguide3.pdf} which
will become the main home for documenting new features of \LaTeX. At
this point in time it covers the \Lpack{xparse} functionality that has
been added to the kernel.
diff --git a/base/ltclass.dtx b/base/ltclass.dtx
index 68a2040e..2ab3081b 100644
--- a/base/ltclass.dtx
+++ b/base/ltclass.dtx
@@ -757,14 +757,40 @@
% needed here to insert a \cs{@empty} to prevent the loss of braces.
% \changes{v1.3u}{2020/11/20}{Macro added}
% \changes{v1.3w}{2021/01/21}{Add empty entry for latexrelease}
+% \changes{v1.4c}{2021/06/03}%
+% {Take care of \cs{@kernel at currpathstack} when rolling
+% back/forward.}
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>
%<latexrelease>\IncludeInRelease{2020/10/01}{\@kernel at currpathstack}%
%<latexrelease> {Add \@kernel at currpathstack}%
-\gdef\@kernel at currpathstack{}
-%<latexrelease>\g at addto@macro\@kernel at currpathstack{{}}
+% \end{macrocode}
+% If rolling backwards to this release, \cs{@kernel at currpathstack}
+% will be defined, so the \cs{gdef} line should not be executed, thus
+% the \cs{@gobblethree} will take it out, so the satck isn't touched.
+% \begin{macrocode}
+%<latexrelease>\@ifundefined{@kernel at currpathstack}{}{\@gobblethree}
+\gdef\@kernel at currpathstack{}%
+% \end{macrocode}
+% If rolling forward to this release, then the \cs{gdef} line above
+% will define the path stack to be empty (which it can't be, inside a
+% file), so the code below will traverse the \cs{@currnamestack}, and
+% add as many empty items to \cs{@kernel at currpathstack} as there are
+% items in \cs{@currnamestack}, so both are back in sync. Most of the
+% time \pkg{latexrelease} is loaded on top-level, so only one item is
+% needed, but \pkg{platexrelease} loads it internally, so the more
+% complicated loop is needed.
+% \begin{macrocode}
+%<latexrelease>\ifx\@kernel at currpathstack\@empty
+%<latexrelease> \def\reserved at a#1#2#3{%
+%<latexrelease> \ifx\relax#3\else
+%<latexrelease> \g at addto@macro\@kernel at currpathstack{{}}%
+%<latexrelease> \expandafter\reserved at a
+%<latexrelease> \fi}%
+%<latexrelease> \expandafter\reserved at a\@currnamestack{}{}{\relax}%
+%<latexrelease>\fi
\def\@p at pfilepath#1{%
\gdef\@currpath{#1}\@p at pfilepath@aux\@empty}
\def\@p at pfilepath@aux#1\@nil{%
diff --git a/base/testfiles/github-0577.lvt b/base/testfiles/github-0577.lvt
new file mode 100644
index 00000000..8db66971
--- /dev/null
+++ b/base/testfiles/github-0577.lvt
@@ -0,0 +1,11 @@
+\input{test2e}
+\begin{filecontents*}[overwrite]{\jobname.sty}
+\RequirePackageWithOptions{latexrelease}
+\START
+\@gobble\@nil
+\show\@kernel at currpathstack
+\OMIT
+\end{filecontents*}
+\RequirePackage[2020-10-01]{\jobname}
+\TIMO
+\END
diff --git a/base/testfiles/github-0060.luatex.tlg b/base/testfiles/github-0577.tlg
similarity index 57%
copy from base/testfiles/github-0060.luatex.tlg
copy to base/testfiles/github-0577.tlg
index 1d0c6975..2502f73e 100644
--- a/base/testfiles/github-0060.luatex.tlg
+++ b/base/testfiles/github-0577.tlg
@@ -1,2 +1,5 @@
This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
+> \@kernel at currpathstack=macro:
+->{}.
+l. ...\show\@kernel at currpathstack
More information about the latex3-commits
mailing list.