[latex3-commits] [git/LaTeX3-latex3-latex2e] hotfix/gh441: Enforce no stack items are blank (2aca9747)
PhelypeOleinik
phelype.oleinik at latex-project.org
Tue Dec 15 00:03:09 CET 2020
Repository : https://github.com/latex3/latex2e
On branch : hotfix/gh441
Link : https://github.com/latex3/latex2e/commit/2aca9747019793c54af8ef71b8207199753f3f06
>---------------------------------------------------------------
commit 2aca9747019793c54af8ef71b8207199753f3f06
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date: Mon Dec 14 20:03:09 2020 -0300
Enforce no stack items are blank
>---------------------------------------------------------------
2aca9747019793c54af8ef71b8207199753f3f06
base/ltclass.dtx | 4 ++--
base/lthooks.dtx | 34 ++++++++++++++++++++++++++--------
2 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/base/ltclass.dtx b/base/ltclass.dtx
index af041dea..475f5044 100644
--- a/base/ltclass.dtx
+++ b/base/ltclass.dtx
@@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltclass.dtx}
- [2020/11/20 v1.3u LaTeX Kernel (Class & Package Interface)]
+ [2020/12/14 v1.3v LaTeX Kernel (Class & Package Interface)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltclass.dtx}
@@ -583,6 +583,7 @@
% \changes{v1.3l}{2020/06/05}{Added \cs{@expl at push@filename@@}
% and \cs{@expl at push@filename at aux@@}}
% \changes{v1.3s}{2020/10/08}{Added missing 2020/02/02 \cs{IncludeInRelease}}
+% \changes{v1.3v}{2020/12/14}{Removed \cs{@expl@@@hook at curr@name at push@@n}}
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
@@ -599,7 +600,6 @@
% here, e.g., \cs{@expl at push@filename@@} needs cleanup and (and
% should probably not have this name either).
% \begin{macrocode}
- \@expl@@@hook at curr@name at push@@n{}%
\@expl at push@filename@@
\xdef\@currnamestack{%
{\@currname}%
diff --git a/base/lthooks.dtx b/base/lthooks.dtx
index 1b01b012..f26c180c 100644
--- a/base/lthooks.dtx
+++ b/base/lthooks.dtx
@@ -2063,8 +2063,8 @@
{
\tl_if_empty:NTF \@currname
{
- \msg_expandable_error:nnf { hooks } { no-default-label }
- { label-missing }
+ \msg_expandable_error:nnn { hooks } { should-not-happen }
+ { Empty~default~label. }
\@@_make_name:n { label-missing }
}
{ \@currname }
@@ -3911,7 +3911,7 @@
\msg_new:nnn { hooks } { no-default-label }
{
Missing~(empty)~default~label~\msg_line_context:. \\
- Using~`#1'~instead.
+ This~command~was~ignored.
}
% \end{macrocode}
%
@@ -4006,7 +4006,8 @@
% \begin{macro}{\PushDefaultHookLabel}
% \begin{macro}{\PopDefaultHookLabel}
% \begin{macro}{\DeclareDefaultHookLabel}
-% \begin{macro}{\@@_curr_name_push:n,\@@_curr_name_pop:}
+% \begin{macro}{\@@_curr_name_push:n,\@@_curr_name_push_aux:n}
+% \begin{macro}{\@@_curr_name_pop:}
% The token list \cs{g_@@_hook_curr_name_tl} stores the name of the
% current package/file to be used as label for hooks.
% Providing a consistent interface is tricky, because packages can
@@ -4029,7 +4030,7 @@
%<latexrelease>\cs_set_protected:Npn \@@_tmp:w #1 #2 #3
%<latexrelease> {
%<latexrelease> \quark_if_recursion_tail_stop:n {#1}
-%<latexrelease> \seq_gput_right:Nn \g_@@_name_stack_seq { }
+%<latexrelease> \seq_gput_right:Nn \g_@@_name_stack_seq {#1}
%<latexrelease> \@@_tmp:w
%<latexrelease> }
%<latexrelease>\exp_after:wN \@@_tmp:w \@currnamestack
@@ -4051,10 +4052,13 @@
{ \exp_args:Nx \@@_curr_name_push_aux:n { \@@_make_name:n {#1} } }
\cs_new_protected:Npn \@@_curr_name_push_aux:n #1
{
- \seq_gpush:Nn \g_@@_name_stack_seq {#1}
- \tl_gset:Nn \g_@@_hook_curr_name_tl {#1}
+ \tl_if_blank:nTF {#1}
+ { \msg_error:nn { hooks } { no-default-label } }
+ {
+ \seq_gpush:Nn \g_@@_name_stack_seq {#1}
+ \tl_gset:Nn \g_@@_hook_curr_name_tl {#1}
+ }
}
-%
% \end{macrocode}
% and when an input is over, the topmost item of the stack is popped,
% since the label will not be used again, and \cs{g_@@_hook_curr_name_tl}
@@ -4089,6 +4093,20 @@
\SetDefaultHookLabel {#1}
}
% \end{macrocode}
+% \LaTeX's \cs{@currnamestack} holds data on all files \emph{but} the
+% current one, but the current label stack holds \emph{all} files, so
+% we need to look ahead to get the info we need. \pkg{expl3} also
+% requires the current file in \cs{@pushfilename}, so here we abuse
+% \cs{@expl at push@filename at aux@@@@} to do \cs{@@_curr_name_push:n}.
+% \begin{macrocode}
+\cs_gset_protected:Npn \@expl at push@filename at aux@@@@ #1#2#3
+ {
+ \@@_curr_name_push:n {#3}
+ \str_gset:Nx \g_file_curr_name_str {#3}
+ #1 #2 {#3}
+ }
+% \end{macrocode}
+% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
More information about the latex3-commits
mailing list.