Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip mapping over undeclared prop in \ShowHook etc. #1515

Merged
merged 3 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions base/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ to completeness or accuracy and it contains some references to files that are
not part of the distribution.
================================================================================

2024-10-29 Yukai Chou <muzimuzhi@gmail.com>
* lthooks.dtx (subsection{Setting rules for hooks code}):
Skip mapping over undeclared \g__hook_<hook>_code_prop (gh/1513).

2024-10-27 Marcel Krüger <Marcel.Krueger@latex-project.org>
* lttagging.dtx
Change tagging sockets with two arguments to drop the first argument
Expand Down
27 changes: 18 additions & 9 deletions base/lthooks.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
%<*driver>
% \fi
\ProvidesFile{lthooks.dtx}
[2024/10/21 v1.1j LaTeX Kernel (hooks)]
[2024/10/29 v1.1k LaTeX Kernel (hooks)]
% \iffalse
%
\documentclass{l3doc}
Expand Down Expand Up @@ -6174,6 +6174,8 @@
}
% \end{macrocode}
%
% \changes{v1.1k}{2024/10/29}
% {Skip mapping over undeclared \cs{g_@@_\meta{hook}_code_prop} (gh/1513)}
% \begin{macrocode}
\@@_if_usable:nF {#1}
{ \@@_log_line:x { The~hook~is~not~declared. } }
Expand All @@ -6183,7 +6185,9 @@
{ #2 { The~hook~is~empty } }
{
\@@_log_line:x { Code~chunks: }
\prop_if_empty:cTF { g_@@_#1_code_prop }
\bool_lazy_or:nnTF
{ ! \prop_if_exist_p:c { g_@@_#1_code_prop } }
{ \prop_if_empty_p:c { g_@@_#1_code_prop } }
Comment on lines +6189 to +6190
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, it might be worth putting in a short comment why this is necessary, ie that a non-existent prop would return "empty" = true but that fail when mapping over it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rubbish, would be empty = false ....

{ \@@_log_line_indent:x { --- } }
{
\prop_map_inline:cn { g_@@_#1_code_prop }
Expand Down Expand Up @@ -6445,19 +6449,24 @@
% |#2|${}={}$\meta{label_1}\verb=|=\meta{label_2},
% and |#3|${}={}$\meta{hook} (the latter may be the argument |#1| to
% \cs{@@_list_rules:nn}, or \texttt{??} if it is a default rule).
% \changes{v1.1k}{2024/10/29}
% {Skip mapping over undeclared \cs{g_@@_\meta{hook}_code_prop} (gh/1513)}
% \begin{macrocode}
\cs_new_protected:Npn \@@_list_rules:nn #1 #2
{
\cs_set_protected:Npn \@@_tmp:w ##1 ##2 ##3 {#2}
\prop_map_inline:cn { g_@@_#1_code_prop }
\prop_if_exist:cT { g_@@_#1_code_prop }
{
\cs_set_protected:Npn \@@_tmp:w ##1 ##2 ##3 {#2}
\prop_map_inline:cn { g_@@_#1_code_prop }
{
\@@_if_label_case:nnnnn {##1} {####1}
{ \prop_map_break: }
{ \@@_list_one_rule:nnn {##1} {####1} }
{ \@@_list_one_rule:nnn {####1} {##1} }
{#1}
\prop_map_inline:cn { g_@@_#1_code_prop }
{
\@@_if_label_case:nnnnn {##1} {####1}
{ \prop_map_break: }
{ \@@_list_one_rule:nnn {##1} {####1} }
{ \@@_list_one_rule:nnn {####1} {##1} }
{#1}
}
}
}
}
Expand Down
17 changes: 17 additions & 0 deletions base/testfiles-lthooks/github-1513.lvt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

\ExplSyntaxOn
\debug_on:n { check-declarations , deprecation }
\ExplSyntaxOff

\documentclass{article}

\input{regression-test}


\usepackage{tracefnt}

\START

\ShowHook{package/tracefnt/after}

\END
16 changes: 16 additions & 0 deletions base/testfiles-lthooks/github-1513.tlg
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
-> The generic hook 'package/tracefnt/after':
> The hook is not declared.
> Code chunks:
> ---
> Document-level (top-level) code:
> ---
> Extra code for next invocation:
> ->
> Rules:
> ---
> Execution order:
> Not set because the hook is undeclared.
<recently read> }
l. ...\ShowHook{package/tracefnt/after}