[latex3-commits] [git/LaTeX3-latex3-latex3] main: Implement \msg_info_term:nnnnnn (fixes #911) (9a18a9985)
Bruno Le Floch
blflatex at gmail.com
Tue May 18 22:24:03 CEST 2021
Repository : https://github.com/latex3/latex3
On branch : main
Link : https://github.com/latex3/latex3/commit/9a18a99855c08505dc24078ee33585cdf6198028
>---------------------------------------------------------------
commit 9a18a99855c08505dc24078ee33585cdf6198028
Author: Bruno Le Floch <blflatex at gmail.com>
Date: Tue May 18 22:24:03 2021 +0200
Implement \msg_info_term:nnnnnn (fixes #911)
>---------------------------------------------------------------
9a18a99855c08505dc24078ee33585cdf6198028
l3kernel/CHANGELOG.md | 1 +
l3kernel/l3msg.dtx | 97 ++++++++++++++++++++++++++---------------
l3kernel/testfiles/m3msg001.lvt | 8 ++++
l3kernel/testfiles/m3msg001.tlg | 8 +++-
4 files changed, 77 insertions(+), 37 deletions(-)
diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 964d49bc8..c53620c82 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -8,6 +8,7 @@ this project uses date-based 'snapshot' version identifiers.
## [Unreleased]
### Added
+- `\msg_info_term:nnnnnn` (issue #911)
- `\str_compare:nNnTF` (issue #927)
- `\sys_timer:`
- `\prop_concat:NNN`, `\prop_put_from_keyval:Nn` (issue #924)
diff --git a/l3kernel/l3msg.dtx b/l3kernel/l3msg.dtx
index 1a3d0976a..e3766fe48 100644
--- a/l3kernel/l3msg.dtx
+++ b/l3kernel/l3msg.dtx
@@ -274,6 +274,10 @@
% course the sense of the message may be impaired). The four arguments are
% converted to strings before being added to the message text: the
% \texttt{x}-type variants should be used to expand material.
+% Note that this expansion takes place with the standard definitions in
+% effect, which means that shorthands such as |\~| or |\\| are
+% \emph{not} available; instead one should use \cs{iow_char:N} |\~| and
+% \cs{iow_newline:}, respectively.
%
% \begin{function}[updated = 2012-08-11]
% {
@@ -365,8 +369,17 @@
% is not interrupted.
% \end{function}
%
-% \begin{function}[updated = 2012-08-11]
+% \begin{function}[added = 2021-05-18]
% {
+% \msg_info_term:nnnnnn ,
+% \msg_info_term:nnnnn ,
+% \msg_info_term:nnnn ,
+% \msg_info_term:nnn ,
+% \msg_info_term:nn ,
+% \msg_info_term:nnxxxx ,
+% \msg_info_term:nnxxx ,
+% \msg_info_term:nnxx ,
+% \msg_info_term:nnx ,
% \msg_info:nnnnnn ,
% \msg_info:nnnnn ,
% \msg_info:nnnn ,
@@ -378,15 +391,28 @@
% \msg_info:nnx
% }
% \begin{syntax}
+% \cs{msg_info_term:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four}
% \cs{msg_info:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four}
% \end{syntax}
% Issues \meta{module} information \meta{message}, passing
% \meta{arg one} to \meta{arg four} to the text-creating functions.
-% The information text is added to the log file.
+% For the more common \cs{msg_info:nnnnnn}, the information text is
+% added to the log file only, while \cs{msg_info_term:nnnnnn} adds the
+% info text to both the log file and the terminal. The \TeX{} run is
+% not interrupted.
% \end{function}
%
% \begin{function}[updated = 2012-08-11]
% {
+% \msg_term:nnnnnn ,
+% \msg_term:nnnnn ,
+% \msg_term:nnnn ,
+% \msg_term:nnn ,
+% \msg_term:nn ,
+% \msg_term:nnxxxx ,
+% \msg_term:nnxxx ,
+% \msg_term:nnxx ,
+% \msg_term:nnx ,
% \msg_log:nnnnnn ,
% \msg_log:nnnnn ,
% \msg_log:nnnn ,
@@ -398,33 +424,15 @@
% \msg_log:nnx
% }
% \begin{syntax}
-% \cs{msg_log:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four}
-% \end{syntax}
-% Issues \meta{module} information \meta{message}, passing
-% \meta{arg one} to \meta{arg four} to the text-creating functions.
-% The information text is added to the log file: the output
-% is briefer than \cs{msg_info:nnnnnn}.
-% \end{function}
-%
-% \begin{function}[added = 2020-07-16]
-% {
-% \msg_term:nnnnnn ,
-% \msg_term:nnnnn ,
-% \msg_term:nnnn ,
-% \msg_term:nnn ,
-% \msg_term:nn ,
-% \msg_term:nnxxxx ,
-% \msg_term:nnxxx ,
-% \msg_term:nnxx ,
-% \msg_term:nnx
-% }
-% \begin{syntax}
% \cs{msg_term:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four}
+% \cs{msg_log:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four}
% \end{syntax}
% Issues \meta{module} information \meta{message}, passing
% \meta{arg one} to \meta{arg four} to the text-creating functions.
-% The information text is printed on the terminal (and added to the
-% log file): the output is similar to that of \cs{msg_log:nnnnnn}.
+% The output is briefer than \cs{msg_info:nnnnnn}, omitting for
+% instance the module name. It is added to the log file by
+% \cs{msg_log:nnnnnn} while \cs{msg_term:nnnnnn} also prints it on the
+% terminal.
% \end{function}
%
% \begin{function}[updated = 2012-08-11]
@@ -1193,6 +1201,16 @@
%
% \begin{macro}
% {
+% \@@_info_aux:Nnn ,
+% \msg_info_term:nnnnnn ,
+% \msg_info_term:nnnnn ,
+% \msg_info_term:nnnn ,
+% \msg_info_term:nnn ,
+% \msg_info_term:nn ,
+% \msg_info_term:nnxxxx ,
+% \msg_info_term:nnxxx ,
+% \msg_info_term:nnxx ,
+% \msg_info_term:nnx ,
% \msg_info:nnnnnn ,
% \msg_info:nnnnn ,
% \msg_info:nnnn ,
@@ -1203,18 +1221,25 @@
% \msg_info:nnxx ,
% \msg_info:nnx
% }
-% Information only goes into the log.
+% Information has no decoration and goes either to the log or both
+% log and terminal.
% \begin{macrocode}
+ \@@_class_new:nn { info_term }
+ {
+ \@@_info_aux:Nnn \iow_term:n {#1}
+ { \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} }
+ }
\@@_class_new:nn { info }
{
- \str_set:Nx \l_@@_text_str { \msg_info_text:n {#1} }
- \str_set:Nx \l_@@_name_str { \msg_module_name:n {#1} }
- \iow_log:n { }
- \iow_wrap:nxnN
- {
- \l_@@_text_str : ~
- \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6}
- }
+ \@@_info_aux:Nnn \iow_log:n {#1}
+ { \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} }
+ }
+ \cs_new_protected:Npn \@@_info_aux:Nnn #1#2#3
+ {
+ \str_set:Nx \l_@@_text_str { \msg_info_text:n {#2} }
+ \str_set:Nx \l_@@_name_str { \msg_module_name:n {#2} }
+ #1 { }
+ \iow_wrap:nxnN { \l_@@_text_str : ~ #3 }
{
( \l_@@_name_str )
\prg_replicate:nn
@@ -1224,8 +1249,8 @@
}
{ ~ }
}
- { } \iow_log:n
- \iow_log:n { }
+ { } #1
+ #1 { }
}
% \end{macrocode}
% \end{macro}
diff --git a/l3kernel/testfiles/m3msg001.lvt b/l3kernel/testfiles/m3msg001.lvt
index 5946bcaeb..9369c5ba6 100644
--- a/l3kernel/testfiles/m3msg001.lvt
+++ b/l3kernel/testfiles/m3msg001.lvt
@@ -87,6 +87,14 @@
\msg_info:nnxx {module} {name} {\l_test_tl} {\l_test_tl}
\msg_info:nnx {module} {name} {\l_test_tl}
\msg_info:nn {module} {name}
+ \SEPARATOR
+ \msg_info_term:nnxxxx {module} {name} {\l_test_tl} {\l_test_tl}
+ {\l_test_tl} {\l_test_tl}
+ \msg_info_term:nnnnn {module} {name} {\l_test_tl} {\l_test_tl}
+ {\l_test_tl}
+ \msg_info_term:nnxx {module} {name} {\l_test_tl} {\l_test_tl}
+ \msg_info_term:nnn {module} {name} {\l_test_tl}
+ \msg_info:nn {module} {name}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/l3kernel/testfiles/m3msg001.tlg b/l3kernel/testfiles/m3msg001.tlg
index 81723e2f9..dabb7298a 100644
--- a/l3kernel/testfiles/m3msg001.tlg
+++ b/l3kernel/testfiles/m3msg001.tlg
@@ -116,6 +116,12 @@ Package module Info: text text
Package module Info: text text
Package module Info: text
============================================================
+Package module Info: text text
+Package module Info: text \l_test_tl
+Package module Info: text text
+Package module Info: text \l_test_tl
+Package module Info: text
+============================================================
============================================================
TEST 8: Issuing log messages
============================================================
@@ -156,7 +162,7 @@ Package module Warning: text
============================================================
TEST 14: Simple text commands
============================================================
-! Package module Error: TEXT on line ...TEXT162TEXT
+! Package module Error: TEXT on line ...TEXT170TEXT
(module) TEXT
(module)
(module) TEXT
More information about the latex3-commits
mailing list.