[latex3-commits] [git/LaTeX3-latex3-latex3] master: Expand the result of expandable messages (3008c5f)

Bruno Le Floch bruno at le-floch.fr
Thu Feb 28 01:54:25 CET 2019


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/3008c5ffe58b42925a887d04f8b29d8246d54e12

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

commit 3008c5ffe58b42925a887d04f8b29d8246d54e12
Author: Bruno Le Floch <bruno at le-floch.fr>
Date:   Thu Feb 28 01:54:25 2019 +0100

    Expand the result of expandable messages


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

3008c5ffe58b42925a887d04f8b29d8246d54e12
 l3kernel/CHANGELOG.md                   |    1 +
 l3kernel/l3candidates.dtx               |   19 ++++++++++++-------
 l3kernel/l3msg.dtx                      |   18 ++++++++++++------
 l3kernel/testfiles/m3expl001.luatex.tlg |    1 +
 l3kernel/testfiles/m3expl001.ptex.tlg   |    1 +
 l3kernel/testfiles/m3expl001.tlg        |    1 +
 l3kernel/testfiles/m3expl001.uptex.tlg  |    1 +
 l3kernel/testfiles/m3expl001.xetex.tlg  |    1 +
 l3kernel/testfiles/m3expl003.luatex.tlg |    1 +
 l3kernel/testfiles/m3expl003.ptex.tlg   |    1 +
 l3kernel/testfiles/m3expl003.tlg        |    1 +
 l3kernel/testfiles/m3expl003.uptex.tlg  |    1 +
 l3kernel/testfiles/m3expl003.xetex.tlg  |    1 +
 l3kernel/testfiles/m3prg001.tlg         |    2 +-
 14 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index b96347f..3e65b12 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -22,6 +22,7 @@ this project uses date-based 'snapshot' version identifiers.
 - Renamed `\token_get_prefix_spec:N`, `\token_get_arg_spec:N`,
   `\token_get_replacement_spec:N` as `\cs_prefix_spec:N`,
   `\cs_argument_spec:N`, `\cs_replacement_spec:N`, respectively
+- Made expandable messages expand their result, like usual messages
 
 ### Removed
 
diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
index c21da00..01e8ceb 100644
--- a/l3kernel/l3candidates.dtx
+++ b/l3kernel/l3candidates.dtx
@@ -494,14 +494,15 @@
 % having a similar interface as non-expandable messages, expandable
 % errors must be handled internally very differently from normal error
 % messages, as none of the tools to print to the terminal or the log
-% file are expandable.  As a result, the message text and arguments are
-% not expanded, and messages must be very short (with default settings,
+% file are expandable.  As a result, short-hands such as |\{| or |\\| do
+% not work, and messages must be very short (with default settings,
 % they are truncated after approximately 50 characters).  It is
 % advisable to ensure that the message is understandable even when
-% truncated.  Another particularity of expandable messages is that they
+% truncated, by putting the most important information up front.
+% Another particularity of expandable messages is that they
 % cannot be redirected or turned off by the user.
 %
-% \begin{function}[EXP, added = 2015-08-06]
+% \begin{function}[EXP, added = 2015-08-06, updated = 2019-02-28]
 %   {
 %     \msg_expandable_error:nnnnnn ,
 %     \msg_expandable_error:nnnnn  ,
@@ -1811,10 +1812,14 @@
 %    \begin{macrocode}
 \cs_new:Npn \msg_expandable_error:nnnnnn #1#2#3#4#5#6
   {
-    \exp_args:Nf \@@_expandable_error_module:nn
+    \exp_args:Ne \@@_expandable_error_module:nn
       {
-        \exp_args:Nf \tl_to_str:n
-          { \use:c { \c_@@_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} }
+        \exp_args:Nc \exp_args:Noooo
+          { \c_@@_text_prefix_tl #1 / #2 }
+          { \tl_to_str:n {#3} }
+          { \tl_to_str:n {#4} }
+          { \tl_to_str:n {#5} }
+          { \tl_to_str:n {#6} }
       }
       {#1}
   }
diff --git a/l3kernel/l3msg.dtx b/l3kernel/l3msg.dtx
index 72bfd68..6fca228 100644
--- a/l3kernel/l3msg.dtx
+++ b/l3kernel/l3msg.dtx
@@ -1757,7 +1757,7 @@
     Only~expandable~tests~can~have~a~predicate~version.
   }
 \__kernel_msg_new:nnn { kernel } { randint-backward-range }
-  { Bounds~ordered~backwards~in~\int_rand:nn {#1}~{#2}. }
+  { Bounds~ordered~backwards~in~\iow_char:N\\int_rand:nn~{#1}~{#2}. }
 \__kernel_msg_new:nnnn { kernel } { conditional-form-unknown }
   { Conditional~form~'#1'~for~function~'#2'~unknown. }
   {
@@ -1923,7 +1923,7 @@
 \__kernel_msg_new:nnn { kernel } { misused-prop }
   { A~property~list~was~misused. }
 \__kernel_msg_new:nnn { kernel } { negative-replication }
-  { Negative~argument~for~\prg_replicate:nn. }
+  { Negative~argument~for~\iow_char:N\\prg_replicate:nn. }
 \__kernel_msg_new:nnn { kernel } { prop-keyval }
   { Missing/extra~'='~in~'#1'~(in~'..._keyval:Nn') }
 \__kernel_msg_new:nnn { kernel } { unknown-comparison }
@@ -2034,15 +2034,21 @@
 %   The command built from the csname
 %   \cs{c_@@_text_prefix_tl} |LaTeX / #1 / #2|
 %   takes four arguments and builds the error text, which is fed to
-%   \cs{@@_expandable_error:n}.
+%   \cs{@@_expandable_error:n} with appropriate expansion: just as for
+%   usual messages the arguments are first turned to strings, then the
+%   message is fully expanded.
 %    \begin{macrocode}
+\exp_args_generate:n { oooo }
 \cs_new:Npn \__kernel_msg_expandable_error:nnnnnn #1#2#3#4#5#6
   {
-    \exp_args:Nf \@@_expandable_error:n
+    \exp_args:Ne \@@_expandable_error:n
       {
-        \exp_args:NNc \exp_after:wN \exp_stop_f:
+        \exp_args:Nc \exp_args:Noooo
           { \c_@@_text_prefix_tl LaTeX / #1 / #2 }
-          {#3} {#4} {#5} {#6}
+          { \tl_to_str:n {#3} }
+          { \tl_to_str:n {#4} }
+          { \tl_to_str:n {#5} }
+          { \tl_to_str:n {#6} }
       }
   }
 \cs_new:Npn \__kernel_msg_expandable_error:nnnnn #1#2#3#4#5
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index 99db0ec..ebd7086 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -2733,6 +2733,7 @@ Defining message LaTeX/kernel/show-seq on line ...
 Defining message LaTeX/kernel/show-streams on line ...
 Defining \__msg_expandable_error:n on line ...
 Defining \__msg_expandable_error:w on line ...
+Defining \exp_args:Noooo on line ...
 Defining \__kernel_msg_expandable_error:nnnnnn on line ...
 Defining \__kernel_msg_expandable_error:nnnnn on line ...
 Defining \__kernel_msg_expandable_error:nnnn on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index 333d54f..ce341ee 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -3030,6 +3030,7 @@ Defining message LaTeX/kernel/show-seq on line ...
 Defining message LaTeX/kernel/show-streams on line ...
 Defining \__msg_expandable_error:n on line ...
 Defining \__msg_expandable_error:w on line ...
+Defining \exp_args:Noooo on line ...
 Defining \__kernel_msg_expandable_error:nnnnnn on line ...
 Defining \__kernel_msg_expandable_error:nnnnn on line ...
 Defining \__kernel_msg_expandable_error:nnnn on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index a58b46a..5a8b9cb 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -3030,6 +3030,7 @@ Defining message LaTeX/kernel/show-seq on line ...
 Defining message LaTeX/kernel/show-streams on line ...
 Defining \__msg_expandable_error:n on line ...
 Defining \__msg_expandable_error:w on line ...
+Defining \exp_args:Noooo on line ...
 Defining \__kernel_msg_expandable_error:nnnnnn on line ...
 Defining \__kernel_msg_expandable_error:nnnnn on line ...
 Defining \__kernel_msg_expandable_error:nnnn on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index 9f1e49e..8cd39c9 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -3030,6 +3030,7 @@ Defining message LaTeX/kernel/show-seq on line ...
 Defining message LaTeX/kernel/show-streams on line ...
 Defining \__msg_expandable_error:n on line ...
 Defining \__msg_expandable_error:w on line ...
+Defining \exp_args:Noooo on line ...
 Defining \__kernel_msg_expandable_error:nnnnnn on line ...
 Defining \__kernel_msg_expandable_error:nnnnn on line ...
 Defining \__kernel_msg_expandable_error:nnnn on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index 7ffa5e3..89e6879 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -2775,6 +2775,7 @@ Defining message LaTeX/kernel/show-seq on line ...
 Defining message LaTeX/kernel/show-streams on line ...
 Defining \__msg_expandable_error:n on line ...
 Defining \__msg_expandable_error:w on line ...
+Defining \exp_args:Noooo on line ...
 Defining \__kernel_msg_expandable_error:nnnnnn on line ...
 Defining \__kernel_msg_expandable_error:nnnnn on line ...
 Defining \__kernel_msg_expandable_error:nnnn on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index 99db0ec..ebd7086 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -2733,6 +2733,7 @@ Defining message LaTeX/kernel/show-seq on line ...
 Defining message LaTeX/kernel/show-streams on line ...
 Defining \__msg_expandable_error:n on line ...
 Defining \__msg_expandable_error:w on line ...
+Defining \exp_args:Noooo on line ...
 Defining \__kernel_msg_expandable_error:nnnnnn on line ...
 Defining \__kernel_msg_expandable_error:nnnnn on line ...
 Defining \__kernel_msg_expandable_error:nnnn on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index 333d54f..ce341ee 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -3030,6 +3030,7 @@ Defining message LaTeX/kernel/show-seq on line ...
 Defining message LaTeX/kernel/show-streams on line ...
 Defining \__msg_expandable_error:n on line ...
 Defining \__msg_expandable_error:w on line ...
+Defining \exp_args:Noooo on line ...
 Defining \__kernel_msg_expandable_error:nnnnnn on line ...
 Defining \__kernel_msg_expandable_error:nnnnn on line ...
 Defining \__kernel_msg_expandable_error:nnnn on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index a58b46a..5a8b9cb 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -3030,6 +3030,7 @@ Defining message LaTeX/kernel/show-seq on line ...
 Defining message LaTeX/kernel/show-streams on line ...
 Defining \__msg_expandable_error:n on line ...
 Defining \__msg_expandable_error:w on line ...
+Defining \exp_args:Noooo on line ...
 Defining \__kernel_msg_expandable_error:nnnnnn on line ...
 Defining \__kernel_msg_expandable_error:nnnnn on line ...
 Defining \__kernel_msg_expandable_error:nnnn on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index 9f1e49e..8cd39c9 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -3030,6 +3030,7 @@ Defining message LaTeX/kernel/show-seq on line ...
 Defining message LaTeX/kernel/show-streams on line ...
 Defining \__msg_expandable_error:n on line ...
 Defining \__msg_expandable_error:w on line ...
+Defining \exp_args:Noooo on line ...
 Defining \__kernel_msg_expandable_error:nnnnnn on line ...
 Defining \__kernel_msg_expandable_error:nnnnn on line ...
 Defining \__kernel_msg_expandable_error:nnnn on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index 7ffa5e3..89e6879 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -2775,6 +2775,7 @@ Defining message LaTeX/kernel/show-seq on line ...
 Defining message LaTeX/kernel/show-streams on line ...
 Defining \__msg_expandable_error:n on line ...
 Defining \__msg_expandable_error:w on line ...
+Defining \exp_args:Noooo on line ...
 Defining \__kernel_msg_expandable_error:nnnnnn on line ...
 Defining \__kernel_msg_expandable_error:nnnnn on line ...
 Defining \__kernel_msg_expandable_error:nnnn on line ...
diff --git a/l3kernel/testfiles/m3prg001.tlg b/l3kernel/testfiles/m3prg001.tlg
index fbb3313..bff06b5 100644
--- a/l3kernel/testfiles/m3prg001.tlg
+++ b/l3kernel/testfiles/m3prg001.tlg
@@ -30,7 +30,7 @@ TEST 4: Replication negative FAIL
 ============================================================
 ! Undefined control sequence.
 <argument> \LaTeX3 error: 
-                           Negative argument for \prg_replicate:nn .
+                           Negative argument for \prg_replicate:nn.
 l. ...}
 The control sequence at the end of the top line
 of your error message was never \def'ed. If you have





More information about the latex3-commits mailing list