[latex3-commits] [git/LaTeX3-latex3-latex3] main: Implement \group_show_list: and log function (see #241) (ee6f43ae7)
Joseph Wright
joseph.wright at morningstar2.co.uk
Wed May 12 14:36:30 CEST 2021
Repository : https://github.com/latex3/latex3
On branch : main
Link : https://github.com/latex3/latex3/commit/ee6f43ae78947c1ea64b63c12baa02b82b3a9b98
>---------------------------------------------------------------
commit ee6f43ae78947c1ea64b63c12baa02b82b3a9b98
Author: Bruno Le Floch <blflatex at gmail.com>
Date: Tue May 11 13:55:03 2021 +0200
Implement \group_show_list: and log function (see #241)
>---------------------------------------------------------------
ee6f43ae78947c1ea64b63c12baa02b82b3a9b98
l3kernel/CHANGELOG.md | 1 +
l3kernel/l3basics.dtx | 41 ++++++++++++++++++++++++++++++++++++++++
l3kernel/testfiles/m3show003.lvt | 23 ++++++++++++++++++++++
l3kernel/testfiles/m3show003.tlg | 19 +++++++++++++++++++
4 files changed, 84 insertions(+)
diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 658ed3b6e..201b289f4 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -12,6 +12,7 @@ this project uses date-based 'snapshot' version identifiers.
- `\color_log:n`, `\tl_log_analysis:N`, `\tl_log_analysis:n` (issue #241)
- `\coffin_show:Nnn` and related functions (issue #241)
- `\ior_show:N`, `\iow_show:N` and log functions (issue #241)
+- `\group_show_list:` and log function (issue #241)
## [2021-05-11]
diff --git a/l3kernel/l3basics.dtx b/l3kernel/l3basics.dtx
index f23c8581d..e7a0491b6 100644
--- a/l3kernel/l3basics.dtx
+++ b/l3kernel/l3basics.dtx
@@ -108,6 +108,18 @@
% |}| if standard category codes apply.
% \end{function}
%
+% \begin{function}[added = 2021-05-11]{\group_show_list:, \group_log_list:}
+% \begin{syntax}
+% \cs{group_show_list:}
+% \cs{group_log_list:}
+% \end{syntax}
+% Display (to the terminal or log file) a list of the groups that are
+% currently opened. This is intended for tracking down problems.
+% \begin{texnote}
+% This is a wrapper around the \tn{showgroups} primitive.
+% \end{texnote}
+% \end{function}
+%
% \section{Control sequences and functions}
%
% As \TeX{} is a macro language, creating new functions means
@@ -3153,6 +3165,35 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\group_show_list:, \group_log_list:, \@@_group_show:NN}
+% Wrapper around \tn{showgroups}. Getting \TeX{} to write to the log
+% without interruption the run is done by altering the interaction
+% mode.
+% \begin{macrocode}
+\cs_new_protected:Npn \group_show_list:
+ { \@@_group_show:NN \use_none:n 1 }
+\cs_new_protected:Npn \group_log_list:
+ { \@@_group_show:NN \int_zero:N 0 }
+\cs_new_protected:Npn \@@_group_show:NN #1#2
+ {
+ \use:x
+ {
+ #1 \tex_interactionmode:D
+ \int_set:Nn \tex_tracingonline:D {#2}
+ \int_set:Nn \tex_errorcontextlines:D { -1 }
+ \exp_not:N \exp_after:wN \scan_stop:
+ \tex_showgroups:D
+ \int_set:Nn \tex_interactionmode:D
+ { \int_use:N \tex_interactionmode:D }
+ \int_set:Nn \tex_tracingonline:D
+ { \int_use:N \tex_tracingonline:D }
+ \int_set:Nn \tex_errorcontextlines:D
+ { \int_use:N \tex_errorcontextlines:D }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Decomposing a macro definition}
%
% \begin{macro}{\cs_prefix_spec:N}
diff --git a/l3kernel/testfiles/m3show003.lvt b/l3kernel/testfiles/m3show003.lvt
index 9da17d853..25af26673 100644
--- a/l3kernel/testfiles/m3show003.lvt
+++ b/l3kernel/testfiles/m3show003.lvt
@@ -256,4 +256,27 @@
\regex_show:N \l_tmpa_tl
}
+% padding to help keep line number constant
+%
+%
+%
+%
+%
+%
+%
+%
+%
+%
+%
+%
+%
+%
+%
+
+\TEST { group_show_list }
+ {
+ \hbox:n { \vbox:n { { \group_log_list: } } }
+ \group_show_list:
+ }
+
\END
diff --git a/l3kernel/testfiles/m3show003.tlg b/l3kernel/testfiles/m3show003.tlg
index 0123e0e25..c953ee707 100644
--- a/l3kernel/testfiles/m3show003.tlg
+++ b/l3kernel/testfiles/m3show003.tlg
@@ -386,3 +386,22 @@ structure:
{\__regex_item_caseful_equal:n {101}\__regex_item_caseful_equal:n
{102}}{0}{-1}\c_true_bool \__regex_command_K: }}{1}{0}\c_false_bool }
============================================================
+============================================================
+TEST 19: group_show_list
+============================================================
+### simple group (level 6) entered at line 280 ({)
+### semi simple group (level 5) entered at line 280 (\begingroup)
+### vbox group (level 4) entered at line 280 (\vbox{)
+### semi simple group (level 3) entered at line 280 (\begingroup)
+### adjusted hbox group (level 2) entered at line 280 (\hbox{)
+### semi simple group (level 1) entered at line 280 (\begingroup)
+### bottom level
+! OK.
+<recently read> \tex_showgroups:D
+l. ... }
+### semi simple group (level 1) entered at line 280 (\begingroup)
+### bottom level
+! OK.
+<recently read> \tex_showgroups:D
+l. ... }
+============================================================
More information about the latex3-commits
mailing list.