[latex3-commits] [git/LaTeX3-latex3-latex2e] gh776: Correctly detect `\set at curr@file(@nosearch)` in graphics.sty (c718e0eb)

PhelypeOleinik phelype.oleinik at latex-project.org
Fri Mar 11 04:17:48 CET 2022


Repository : https://github.com/latex3/latex2e
On branch  : gh776
Link       : https://github.com/latex3/latex2e/commit/c718e0eb55da6602003b114c3b45dccd0b4626ca

>---------------------------------------------------------------

commit c718e0eb55da6602003b114c3b45dccd0b4626ca
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date:   Fri Mar 11 00:17:48 2022 -0300

    Correctly detect `\set at curr@file(@nosearch)` in graphics.sty
    
    Instead of making `\set at curr@file at nosearch` a copy of `\set at curr@file`
    when rolling back, make graphics.sty correctly detect which of both is
    currently defined, and use the latest (either the `@nosearch` version if
    it exists, or the regular one) as a copy in `\Gin at set@curr at file`.  This
    makes the code a bit easier, and better supports Plain (and also is more
    correct than having a `@nosearch` macro that _does_ search).


>---------------------------------------------------------------

c718e0eb55da6602003b114c3b45dccd0b4626ca
 base/changes.txt                                   |  2 +-
 base/ltfilehook.dtx                                |  9 ++--
 required/graphics/changes.txt                      |  2 +-
 required/graphics/graphics.dtx                     | 52 ++++++++++++----------
 .../testfiles/github-0776-rollback-2019-09-30.lvt  | 12 +++++
 .../testfiles/github-0776-rollback-2019-09-30.tlg  | 21 +++++++++
 .../github-0776-rollback-2019-09-30.xetex.tlg      | 21 +++++++++
 .../testfiles/github-0776-rollback-2021-11-15.lvt  | 12 +++++
 .../testfiles/github-0776-rollback-2021-11-15.tlg  | 18 ++++++++
 .../github-0776-rollback-2021-11-15.xetex.tlg      | 18 ++++++++
 10 files changed, 139 insertions(+), 28 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index 202d8854..b9bea0a5 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -6,7 +6,7 @@ completeness or accuracy and it contains some references to files that
 are not part of the distribution.
 ================================================================================
 
-2021-12-31  Phelype Oleinik  <phelype.oleinik at latex-project.org>
+2022-03-10  Phelype Oleinik  <phelype.oleinik at latex-project.org>
 
 	* ltfilehook.dtx (subsection{Selecting a file (\cs{set at curr@file})}):
 	Add \set at curr@file at nosearch, to ignore \input at path and \l_file_search_path_seq.
diff --git a/base/ltfilehook.dtx b/base/ltfilehook.dtx
index f072f2c8..af503b26 100644
--- a/base/ltfilehook.dtx
+++ b/base/ltfilehook.dtx
@@ -32,7 +32,7 @@
 %
 %    \begin{macrocode}
 \providecommand\ltfilehookversion{v1.0m}
-\providecommand\ltfilehookdate{2022/02/28}
+\providecommand\ltfilehookdate{2022/03/10}
 %    \end{macrocode}
 %
 %<*driver>
@@ -1071,7 +1071,7 @@
 %   control sequence.
 %   \changes{v1.0i}{2021/04/20}
 %           {Make \string~ expand to a string (tracks change in l3kernel)}
-%   \changes{v1.0m}{2022/02/28}
+%   \changes{v1.0m}{2022/03/10}
 %           {Add \cs{set at curr@file at nosearch} for \pkg{graphicx}}
 %    \begin{macrocode}
 %</2ekernel>
@@ -1149,7 +1149,7 @@
 %<latexrelease>       \global\let\@curr at file@reqd\@curr at file}%
 %<latexrelease>    \@expl@@@filehook at clear@replacement at flag@@
 %<latexrelease>  \endgroup}
-%<latexrelease>\let\set at curr@file at nosearch\set at curr@file
+%<latexrelease>\let\set at curr@file at nosearch\@undefined
 %<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 %
@@ -1173,6 +1173,7 @@
 %<latexrelease>       \global\let\@curr at file@reqd\@curr at file}%
 %<latexrelease>    \@expl@@@filehook at clear@replacement at flag@@
 %<latexrelease>  \endgroup}
+%<latexrelease>\let\set at curr@file at nosearch\@undefined
 %<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 %
@@ -1189,6 +1190,7 @@
 %<latexrelease>        \csname\@firstofone#1\@empty\endcsname}}%
 %<latexrelease>  \endgroup
 %<latexrelease>}
+%<latexrelease>\let\set at curr@file at nosearch\@undefined
 %<latexrelease>\EndIncludeInRelease
 %    \end{macrocode}
 %
@@ -1196,6 +1198,7 @@
 %<latexrelease>\IncludeInRelease{0000/00/00}%
 %<latexrelease>          {\set at curr@file}{Setting current file name}%
 %<latexrelease>\let\set at curr@file\@undefined
+%<latexrelease>\let\set at curr@file at nosearch\@undefined
 %<latexrelease>\EndIncludeInRelease
 %<*2ekernel>
 %    \end{macrocode}
diff --git a/required/graphics/changes.txt b/required/graphics/changes.txt
index 15de37af..2a542dca 100644
--- a/required/graphics/changes.txt
+++ b/required/graphics/changes.txt
@@ -4,7 +4,7 @@ completeness or accuracy and it contains some references to files that
 are not part of the distribution.
 =======================================================================
 
-2022-02-28  Phelype Oleinik  <phelype.oleinik at latex-project.org>
+2022-03-10  Phelype Oleinik  <phelype.oleinik at latex-project.org>
 
 	* graphics.dtx:
 	Use \set at curr@file at nosearch to avoid premature inclusion of path
diff --git a/required/graphics/graphics.dtx b/required/graphics/graphics.dtx
index 3504fef5..92b3c8f3 100644
--- a/required/graphics/graphics.dtx
+++ b/required/graphics/graphics.dtx
@@ -27,7 +27,7 @@
 %<driver> \ProvidesFile{graphics.drv}
 % \fi
 %         \ProvidesFile{graphics.dtx}
-          [2022/02/28 v1.4e  Standard LaTeX Graphics (DPC,SPQR)]
+          [2022/03/10 v1.4e  Standard LaTeX Graphics (DPC,SPQR)]
 %
 % \iffalse
 %<*driver>
@@ -1053,33 +1053,39 @@
 %    \edef{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\set at curr@file}
+% \begin{macro}{\Gin at set@curr at file}
 % \begin{macro}{\quote at name}
 % \changes{v1.3c}{2019/10/08}
 %     {Definitions added for old formats}
+% \changes{v1.4e}{2022/03/10}
+%     {Use \cs{Gin at set@curr at file}, and define it appropriately}
+%   We have to cope with older formats (rollback as far as 2019-10-01)
+%   and Plain.  Define a minimal \cs{Gin at set@curr at file} first:
 %    \begin{macrocode}
-\def\Gin at temp#1{%
-  \begingroup
-    \escapechar\m at ne
-    \xdef\@curr at file{\expandafter\string\csname #1\endcsname}%
-  \endgroup
-}
-\ifx\set at curr@file\@Gin at temp
-  \let\set at curr@file\@undefined
-\fi
-%    \end{macrocode}
-%
-%    \begin{macrocode}
-\ifx\set at curr@file\@undefined
-\def\set at curr@file#1{%
+\def\Gin at set@curr at file#1{%
   \begingroup
     \escapechar\m at ne
     \xdef\@curr at file{\expandafter\string\csname\@firstofone#1\@empty\endcsname}%
-  \endgroup
-}
-\def\quote at name#1{"\quote@@name#1\@gobble""}
-\def\quote@@name#1"{#1\quote@@name}
-\def\unquote at name#1{\quote@@name#1\@gobble"}
+  \endgroup}
+%    \end{macrocode}
+%   Then, if \cs{set at curr@file at nosearch} is undefined, we're before
+%   2022-06-01, and if \cs{set at curr@file} is undefined, we're before
+%   2019-10-01 (aka Plain, as far as these tests are concerned).  Make
+%   \cs{Gin at set@curr at file} be a copy of the most recent macro:
+%   \cs{set at curr@file at nosearch} if it exists, and \cs{set at curr@file}
+%   otherwise.  If neither exist, we also need to define
+%   \cs{quote at name} et~al.
+%    \begin{macrocode}
+\ifx\set at curr@file at nosearch\@undefined
+  \ifx\set at curr@file\@undefined
+    \def\quote at name#1{"\quote@@name#1\@gobble""}
+    \def\quote@@name#1"{#1\quote@@name}
+    \def\unquote at name#1{\quote@@name#1\@gobble"}
+  \else
+    \let\Gin at set@curr at file\set at curr@file
+  \fi
+\else
+  \let\Gin at set@curr at file\set at curr@file at nosearch
 \fi
 %    \end{macrocode}
 % \end{macro}
@@ -1114,11 +1120,11 @@
 %
 % \changes{v1.3d}{2019/11/01}
 %     {\cs{curr at name} now unquoted}
-% \changes{v1.4e}{2022/02/28}
+% \changes{v1.4e}{2022/03/10}
 %     {Use \cs{set at curr@file at nosearch} to avoid premature inclusion of
 %      path from \cs{graphicspath}}
 %    \begin{macrocode}
-  \set at curr@file at nosearch{#1}%
+  \Gin at set@curr at file{#1}%
   \expandafter\filename at parse\expandafter{\@curr at file}%
 %    \end{macrocode}
 % If extension is |.gz| tack on to previous extension, eg |.eps.gz| if available.
diff --git a/required/graphics/testfiles/github-0776-rollback-2019-09-30.lvt b/required/graphics/testfiles/github-0776-rollback-2019-09-30.lvt
new file mode 100644
index 00000000..72f5336c
--- /dev/null
+++ b/required/graphics/testfiles/github-0776-rollback-2019-09-30.lvt
@@ -0,0 +1,12 @@
+\input test2e
+\START
+\typeout{A: \meaning\set at curr@file at nosearch}
+\OMIT
+\RequirePackage[2019-09-30]{latexrelease}
+\TIMO
+\typeout{B: \meaning\set at curr@file at nosearch}
+\RequirePackage{graphics}
+\makeatletter
+\typeout{C: \meaning\Gin at set@curr at file}
+\sbox0{\includegraphics{miau}}
+\END
diff --git a/required/graphics/testfiles/github-0776-rollback-2019-09-30.tlg b/required/graphics/testfiles/github-0776-rollback-2019-09-30.tlg
new file mode 100644
index 00000000..8d657552
--- /dev/null
+++ b/required/graphics/testfiles/github-0776-rollback-2019-09-30.tlg
@@ -0,0 +1,21 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+A: macro:->\begingroup \let \input at path \@empty \seq_clear:N \l_file_search_path_seq \set at curr@file at aux 
+B: undefined
+(graphics.sty
+Rollback for package 'graphics' requested -> date ....-..-...
+         Best approximation is the release introduced on ....-..-...
+(graphics-....-..-...sty
+Package: graphics ....-..-.. v... Standard LaTeX Graphics (DPC,SPQR)
+(trig.sty
+Package: trig ....-..-.. v... sin cos tan (DPC)
+) (graphics.cfg
+File: graphics.cfg ....-..-.. v... sample graphics configuration
+)
+Package graphics Info: Driver file: dvips.def on input line ....
+(dvips.def
+File: dvips.def ....-..-.. v... Driver-dependent file (DPC,SPQR)
+)))
+C: undefined
+File: miau.ps Graphic file (type eps)
+<miau.ps>
diff --git a/required/graphics/testfiles/github-0776-rollback-2019-09-30.xetex.tlg b/required/graphics/testfiles/github-0776-rollback-2019-09-30.xetex.tlg
new file mode 100644
index 00000000..0b1d94ea
--- /dev/null
+++ b/required/graphics/testfiles/github-0776-rollback-2019-09-30.xetex.tlg
@@ -0,0 +1,21 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+A: macro:->\begingroup \let \input at path \@empty \seq_clear:N \l_file_search_path_seq \set at curr@file at aux 
+B: undefined
+(graphics.sty
+Rollback for package 'graphics' requested -> date ....-..-...
+         Best approximation is the release introduced on ....-..-...
+(graphics-....-..-...sty
+Package: graphics ....-..-.. v... Standard LaTeX Graphics (DPC,SPQR)
+(trig.sty
+Package: trig ....-..-.. v... sin cos tan (DPC)
+) (graphics.cfg
+File: graphics.cfg ....-..-.. v... sample graphics configuration
+)
+Package graphics Info: Driver file: xetex.def on input line ....
+(xetex.def
+File: xetex.def ....-..-.. v... LaTeX color/graphics driver for XeTeX (L3/RRM/JK)
+)))
+C: undefined
+File: miau.ps Graphic file (type eps)
+<miau.ps>
diff --git a/required/graphics/testfiles/github-0776-rollback-2021-11-15.lvt b/required/graphics/testfiles/github-0776-rollback-2021-11-15.lvt
new file mode 100644
index 00000000..4ec42fe0
--- /dev/null
+++ b/required/graphics/testfiles/github-0776-rollback-2021-11-15.lvt
@@ -0,0 +1,12 @@
+\input test2e
+\START
+\typeout{A: \meaning\set at curr@file at nosearch}
+\OMIT
+\RequirePackage[2021-11-15]{latexrelease}
+\TIMO
+\typeout{B: \meaning\set at curr@file at nosearch}
+\RequirePackage{graphics}
+\makeatletter
+\typeout{C: \meaning\Gin at set@curr at file}
+\sbox0{\includegraphics{miau}}
+\END
diff --git a/required/graphics/testfiles/github-0776-rollback-2021-11-15.tlg b/required/graphics/testfiles/github-0776-rollback-2021-11-15.tlg
new file mode 100644
index 00000000..fe95b661
--- /dev/null
+++ b/required/graphics/testfiles/github-0776-rollback-2021-11-15.tlg
@@ -0,0 +1,18 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+A: macro:->\begingroup \let \input at path \@empty \seq_clear:N \l_file_search_path_seq \set at curr@file at aux 
+B: undefined
+(graphics.sty
+Package: graphics ....-..-.. v... Standard LaTeX Graphics (DPC,SPQR)
+(trig.sty
+Package: trig ....-..-.. v... sin cos tan (DPC)
+) (graphics.cfg
+File: graphics.cfg ....-..-.. v... sample graphics configuration
+)
+Package graphics Info: Driver file: dvips.def on input line ....
+(dvips.def
+File: dvips.def ....-..-.. v... Driver-dependent file (DPC,SPQR)
+))
+C: macro:#1->\begingroup \escapechar \m at ne \let \protect \string \edef ~{\string ~}\expandafter \def \csname \expandafter \endcsname \expandafter {\csname \endcsname }\@expl@@@filehook at if@no at extension@@nTF {#1}{\@tempswatrue }{\@tempswafalse }\@kernel at make@file at csname \@curr at file \@expl@@@filehook at resolve@file at subst@@w {#1}\@expl@@@filehook at if@file at replaced@@TF {\@kernel at make@file at csname \@curr at file@reqd \@expl@@@filehook at normalize@file at name@@w {#1}\if at tempswa \@expl@@@filehook at drop@extension@@N \@curr at file@reqd \fi }{\if at tempswa \@expl@@@filehook at drop@extension@@N \@curr at file \fi \global \let \@curr at file@reqd \@curr at file }\@expl@@@filehook at clear@replacement at flag@@ \endgroup 
+File: miau.ps Graphic file (type eps)
+<miau.ps>
diff --git a/required/graphics/testfiles/github-0776-rollback-2021-11-15.xetex.tlg b/required/graphics/testfiles/github-0776-rollback-2021-11-15.xetex.tlg
new file mode 100644
index 00000000..12861bf3
--- /dev/null
+++ b/required/graphics/testfiles/github-0776-rollback-2021-11-15.xetex.tlg
@@ -0,0 +1,18 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+A: macro:->\begingroup \let \input at path \@empty \seq_clear:N \l_file_search_path_seq \set at curr@file at aux 
+B: undefined
+(graphics.sty
+Package: graphics ....-..-.. v... Standard LaTeX Graphics (DPC,SPQR)
+(trig.sty
+Package: trig ....-..-.. v... sin cos tan (DPC)
+) (graphics.cfg
+File: graphics.cfg ....-..-.. v... sample graphics configuration
+)
+Package graphics Info: Driver file: xetex.def on input line ....
+(xetex.def
+File: xetex.def ....-..-.. v... LaTeX color/graphics driver for XeTeX (L3/RRM/JK)
+))
+C: macro:#1->\begingroup \escapechar \m at ne \let \protect \string \edef ~{\string ~}\expandafter \def \csname \expandafter \endcsname \expandafter {\csname \endcsname }\@expl@@@filehook at if@no at extension@@nTF {#1}{\@tempswatrue }{\@tempswafalse }\@kernel at make@file at csname \@curr at file \@expl@@@filehook at resolve@file at subst@@w {#1}\@expl@@@filehook at if@file at replaced@@TF {\@kernel at make@file at csname \@curr at file@reqd \@expl@@@filehook at normalize@file at name@@w {#1}\if at tempswa \@expl@@@filehook at drop@extension@@N \@curr at file@reqd \fi }{\if at tempswa \@expl@@@filehook at drop@extension@@N \@curr at file \fi \global \let \@curr at file@reqd \@curr at file }\@expl@@@filehook at clear@replacement at flag@@ \endgroup 
+File: miau.ps Graphic file (type eps)
+<miau.ps>





More information about the latex3-commits mailing list.