[latex3-commits] [git/latex3] master: Make warning more explicit for deprecated variants (c2572fd)
Bruno Le Floch
bruno at le-floch.fr
Tue Jan 2 14:24:13 CET 2018
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/c2572fd667a3dba3ed1a686d28b11e336929dc38
>---------------------------------------------------------------
commit c2572fd667a3dba3ed1a686d28b11e336929dc38
Author: Bruno Le Floch <bruno at le-floch.fr>
Date: Tue Jan 2 08:24:13 2018 -0500
Make warning more explicit for deprecated variants
This came up in LaTeX-L, where a user changing "nF" to "cF" thought the
warning was about making variants of conditionals. Now the warning explicitly
states which letter went wrong, and suggests a replacement or a short reason
why the variant is deprecated.
>---------------------------------------------------------------
c2572fd667a3dba3ed1a686d28b11e336929dc38
l3kernel/l3expan.dtx | 5 ++-
l3kernel/l3msg.dtx | 13 +++++-
l3kernel/testfiles/m3expan001.tlg | 71 +++++++++++++++++--------------
l3kernel/testfiles/m3expan002.tlg | 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 +
14 files changed, 77 insertions(+), 40 deletions(-)
diff --git a/l3kernel/l3expan.dtx b/l3kernel/l3expan.dtx
index 20ea8bb..20c5212 100644
--- a/l3kernel/l3expan.dtx
+++ b/l3kernel/l3expan.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: l3expan.dtx Copyright (C) 1990-2017 The LaTeX3 project
+%% File: l3expan.dtx Copyright (C) 1990-2018 The LaTeX3 project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -1877,7 +1877,8 @@
#3 \q_stop #4 #5 {#6} {#7}
\exp_not:n
{
- \@@_generate_variant_loop_warning:nnxxxx { kernel } { invalid-variant }
+ \@@_generate_variant_loop_warning:nnxxxx
+ { kernel } { deprecated-variant }
{#7} { \token_to_str:N #5 } {#1} {#2}
}
}
diff --git a/l3kernel/l3msg.dtx b/l3kernel/l3msg.dtx
index 2c1ad54..7920c14 100644
--- a/l3kernel/l3msg.dtx
+++ b/l3kernel/l3msg.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: l3msg.dtx Copyright (C) 2009-2017 The LaTeX3 Project
+%% File: l3msg.dtx Copyright (C) 2009-2018 The LaTeX3 Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -1922,6 +1922,17 @@
with~a~signature~starting~with~'#1',~but~cannot~change~an~argument~
from~type~'#3'~to~type~'#4'.
}
+\__kernel_msg_new:nnn { kernel } { deprecated-variant }
+ {
+ Variant~form~'#1'~deprecated~for~base~form~'#2'.~
+ One~should~not~change~an~argument~from~type~'#3'~to~type~'#4'
+ \str_case:nnF {#3}
+ {
+ { n } { :~use~a~'\token_if_eq_charcode:NNTF #4 c v V'~variant? }
+ { N } { :~base~form~only~accepts~a~single~token~argument. }
+ {#4} { :~base~form~is~already~a~variant. }
+ } { . }
+ }
% \end{macrocode}
%
% Some errors are only needed in package mode if debugging is enabled by
diff --git a/l3kernel/testfiles/m3expan001.tlg b/l3kernel/testfiles/m3expan001.tlg
index 1a17870..7b7ca39 100644
--- a/l3kernel/testfiles/m3expan001.tlg
+++ b/l3kernel/testfiles/m3expan001.tlg
@@ -13,14 +13,16 @@ Defining \foo:VV on line ...
Defining \foo:xx on line ...
Defining \foo:cc on line ...
*************************************************
-* LaTeX warning: "kernel/invalid-variant"
+* LaTeX warning: "kernel/deprecated-variant"
*
-* Variant form 'cc' invalid for base form '\foo:nn'.
+* Variant form 'cc' deprecated for base form '\foo:nn'. One should not change
+* an argument from type 'n' to type 'c': use a 'v' variant?
*************************************************
*************************************************
-* LaTeX warning: "kernel/invalid-variant"
+* LaTeX warning: "kernel/deprecated-variant"
*
-* Variant form 'cc' invalid for base form '\foo:nn'.
+* Variant form 'cc' deprecated for base form '\foo:nn'. One should not change
+* an argument from type 'n' to type 'c': use a 'v' variant?
*************************************************
Defining \foo:nx on line ...
Defining \exp_args:Nfx on line ...
@@ -241,22 +243,27 @@ TEST 10: Issue 418: changing N/n to incompatible variants
============================================================
Defining \foobar:on on line ...
*************************************************
-* LaTeX warning: "kernel/invalid-variant"
+* LaTeX warning: "kernel/deprecated-variant"
*
-* Variant form 'on' invalid for base form '\foobar:Nn'.
+* Variant form 'on' deprecated for base form '\foobar:Nn'. One should not
+* change an argument from type 'N' to type 'o': base form only accepts a
+* single token argument.
*************************************************
Defining \foobar:Nc on line ...
*************************************************
-* LaTeX warning: "kernel/invalid-variant"
+* LaTeX warning: "kernel/deprecated-variant"
*
-* Variant form 'Nc' invalid for base form '\foobar:Nn'.
+* Variant form 'Nc' deprecated for base form '\foobar:Nn'. One should not
+* change an argument from type 'n' to type 'c': use a 'v' variant?
*************************************************
Defining \exp_args:Nn on line ...
Defining \foobar:nn on line ...
*************************************************
-* LaTeX warning: "kernel/invalid-variant"
+* LaTeX warning: "kernel/deprecated-variant"
*
-* Variant form 'n' invalid for base form '\foobar:Nn'.
+* Variant form 'n' deprecated for base form '\foobar:Nn'. One should not
+* change an argument from type 'N' to type 'n': base form only accepts a
+* single token argument.
*************************************************
\long macro:->\exp_args:No \foobar:Nn ,\long macro:->\exp_args:NNc \foobar:Nn ,\long macro:->\exp_args:Nn \foobar:Nn ,
============================================================
@@ -266,59 +273,61 @@ TEST 11: Issue 418 again
Variant \foobar:on already defined; not changing it on line ...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
-! LaTeX error: "kernel/invalid-variant"
+! LaTeX error: "kernel/deprecated-variant"
!
-! Variant form 'on' invalid for base form '\foobar:Nn'.
+! Variant form 'on' deprecated for base form '\foobar:Nn'. One should not
+! change an argument from type 'N' to type 'o': base form only accepts a
+! single token argument.
!
! See the LaTeX3 documentation for further information.
!
-! For immediate help type H <return>.
+! Type <return> to continue.
!...............................................
l. ... }
|'''''''''''''''''''''''''''''''''''''''''''''''
-| This is a coding error.
+| LaTeX does not know anything more about this error, sorry.
|
-| LaTeX has been asked to create a variant of the function '\foobar:Nn' with a
-| signature starting with 'on', but cannot change an argument from type 'N' to
-| type 'o'.
+| Try typing <return> to proceed.
+| If that doesn't work, type X <return> to quit.
|...............................................
Variant \foobar:Nc already defined; not changing it on line ...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
-! LaTeX error: "kernel/invalid-variant"
+! LaTeX error: "kernel/deprecated-variant"
!
-! Variant form 'Nc' invalid for base form '\foobar:Nn'.
+! Variant form 'Nc' deprecated for base form '\foobar:Nn'. One should not
+! change an argument from type 'n' to type 'c': use a 'v' variant?
!
! See the LaTeX3 documentation for further information.
!
-! For immediate help type H <return>.
+! Type <return> to continue.
!...............................................
l. ... }
|'''''''''''''''''''''''''''''''''''''''''''''''
-| This is a coding error.
+| LaTeX does not know anything more about this error, sorry.
|
-| LaTeX has been asked to create a variant of the function '\foobar:Nn' with a
-| signature starting with 'Nc', but cannot change an argument from type 'n' to
-| type 'c'.
+| Try typing <return> to proceed.
+| If that doesn't work, type X <return> to quit.
|...............................................
Variant \foobar:nn already defined; not changing it on line ...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
-! LaTeX error: "kernel/invalid-variant"
+! LaTeX error: "kernel/deprecated-variant"
!
-! Variant form 'n' invalid for base form '\foobar:Nn'.
+! Variant form 'n' deprecated for base form '\foobar:Nn'. One should not
+! change an argument from type 'N' to type 'n': base form only accepts a
+! single token argument.
!
! See the LaTeX3 documentation for further information.
!
-! For immediate help type H <return>.
+! Type <return> to continue.
!...............................................
l. ... }
|'''''''''''''''''''''''''''''''''''''''''''''''
-| This is a coding error.
+| LaTeX does not know anything more about this error, sorry.
|
-| LaTeX has been asked to create a variant of the function '\foobar:Nn' with a
-| signature starting with 'n', but cannot change an argument from type 'N' to
-| type 'n'.
+| Try typing <return> to proceed.
+| If that doesn't work, type X <return> to quit.
|...............................................
\long macro:->\exp_args:No \foobar:Nn ,\long macro:->\exp_args:NNc \foobar:Nn ,\long macro:->\exp_args:Nn \foobar:Nn ,
============================================================
diff --git a/l3kernel/testfiles/m3expan002.tlg b/l3kernel/testfiles/m3expan002.tlg
index 1a23336..ce2623e 100644
--- a/l3kernel/testfiles/m3expan002.tlg
+++ b/l3kernel/testfiles/m3expan002.tlg
@@ -44,22 +44,28 @@ Defining \foo:oNnTF on line ...
Defining \exp_args:NnNo on line ...
Defining \foo:oNoTF on line ...
*************************************************
-* LaTeX warning: "kernel/invalid-variant"
+* LaTeX warning: "kernel/deprecated-variant"
*
-* Variant form 'oNoT' invalid for base form '\foo:oNnTF'.
+* Variant form 'oNoT' deprecated for base form '\foo:oNnTF'. One should not
+* change an argument from type 'o' to type 'o': base form is already a
+* variant.
*************************************************
Defining \exp_args:NnNx on line ...
Defining \foo:oNxTF on line ...
*************************************************
-* LaTeX warning: "kernel/invalid-variant"
+* LaTeX warning: "kernel/deprecated-variant"
*
-* Variant form 'oNxTF' invalid for base form '\foo:oNnTF'.
+* Variant form 'oNxTF' deprecated for base form '\foo:oNnTF'. One should not
+* change an argument from type 'o' to type 'o': base form is already a
+* variant.
*************************************************
Defining \foo:ocnTF on line ...
*************************************************
-* LaTeX warning: "kernel/invalid-variant"
+* LaTeX warning: "kernel/deprecated-variant"
*
-* Variant form 'ocnTF' invalid for base form '\foo:oNnTF'.
+* Variant form 'ocnTF' deprecated for base form '\foo:oNnTF'. One should not
+* change an argument from type 'o' to type 'o': base form is already a
+* variant.
*************************************************
Variant \foo:oNnTF already defined; not changing it on line ...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index 5cc0046..2ce5dc5 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -2911,6 +2911,7 @@ Defining message LaTeX/kernel/scanmark-already-defined on line ...
Defining message LaTeX/kernel/variable-not-defined on line ...
Defining message LaTeX/kernel/variant-too-long on line ...
Defining message LaTeX/kernel/invalid-variant on line ...
+Defining message LaTeX/kernel/deprecated-variant on line ...
Defining message LaTeX/kernel/debug on line ...
Defining message LaTeX/kernel/expr on line ...
Defining message LaTeX/kernel/local-global on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index a367d67..efeb1c7 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -2899,6 +2899,7 @@ Defining message LaTeX/kernel/scanmark-already-defined on line ...
Defining message LaTeX/kernel/variable-not-defined on line ...
Defining message LaTeX/kernel/variant-too-long on line ...
Defining message LaTeX/kernel/invalid-variant on line ...
+Defining message LaTeX/kernel/deprecated-variant on line ...
Defining message LaTeX/kernel/debug on line ...
Defining message LaTeX/kernel/expr on line ...
Defining message LaTeX/kernel/local-global on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index 2175d81..6c1f70f 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -2899,6 +2899,7 @@ Defining message LaTeX/kernel/scanmark-already-defined on line ...
Defining message LaTeX/kernel/variable-not-defined on line ...
Defining message LaTeX/kernel/variant-too-long on line ...
Defining message LaTeX/kernel/invalid-variant on line ...
+Defining message LaTeX/kernel/deprecated-variant on line ...
Defining message LaTeX/kernel/debug on line ...
Defining message LaTeX/kernel/expr on line ...
Defining message LaTeX/kernel/local-global on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index c633baa..bdd2fed 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -2899,6 +2899,7 @@ Defining message LaTeX/kernel/scanmark-already-defined on line ...
Defining message LaTeX/kernel/variable-not-defined on line ...
Defining message LaTeX/kernel/variant-too-long on line ...
Defining message LaTeX/kernel/invalid-variant on line ...
+Defining message LaTeX/kernel/deprecated-variant on line ...
Defining message LaTeX/kernel/debug on line ...
Defining message LaTeX/kernel/expr on line ...
Defining message LaTeX/kernel/local-global on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index 7076f4b..6511c1b 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -2909,6 +2909,7 @@ Defining message LaTeX/kernel/scanmark-already-defined on line ...
Defining message LaTeX/kernel/variable-not-defined on line ...
Defining message LaTeX/kernel/variant-too-long on line ...
Defining message LaTeX/kernel/invalid-variant on line ...
+Defining message LaTeX/kernel/deprecated-variant on line ...
Defining message LaTeX/kernel/debug on line ...
Defining message LaTeX/kernel/expr on line ...
Defining message LaTeX/kernel/local-global on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index 5cc0046..2ce5dc5 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -2911,6 +2911,7 @@ Defining message LaTeX/kernel/scanmark-already-defined on line ...
Defining message LaTeX/kernel/variable-not-defined on line ...
Defining message LaTeX/kernel/variant-too-long on line ...
Defining message LaTeX/kernel/invalid-variant on line ...
+Defining message LaTeX/kernel/deprecated-variant on line ...
Defining message LaTeX/kernel/debug on line ...
Defining message LaTeX/kernel/expr on line ...
Defining message LaTeX/kernel/local-global on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index a367d67..efeb1c7 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -2899,6 +2899,7 @@ Defining message LaTeX/kernel/scanmark-already-defined on line ...
Defining message LaTeX/kernel/variable-not-defined on line ...
Defining message LaTeX/kernel/variant-too-long on line ...
Defining message LaTeX/kernel/invalid-variant on line ...
+Defining message LaTeX/kernel/deprecated-variant on line ...
Defining message LaTeX/kernel/debug on line ...
Defining message LaTeX/kernel/expr on line ...
Defining message LaTeX/kernel/local-global on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index 2175d81..6c1f70f 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -2899,6 +2899,7 @@ Defining message LaTeX/kernel/scanmark-already-defined on line ...
Defining message LaTeX/kernel/variable-not-defined on line ...
Defining message LaTeX/kernel/variant-too-long on line ...
Defining message LaTeX/kernel/invalid-variant on line ...
+Defining message LaTeX/kernel/deprecated-variant on line ...
Defining message LaTeX/kernel/debug on line ...
Defining message LaTeX/kernel/expr on line ...
Defining message LaTeX/kernel/local-global on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index c633baa..bdd2fed 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -2899,6 +2899,7 @@ Defining message LaTeX/kernel/scanmark-already-defined on line ...
Defining message LaTeX/kernel/variable-not-defined on line ...
Defining message LaTeX/kernel/variant-too-long on line ...
Defining message LaTeX/kernel/invalid-variant on line ...
+Defining message LaTeX/kernel/deprecated-variant on line ...
Defining message LaTeX/kernel/debug on line ...
Defining message LaTeX/kernel/expr on line ...
Defining message LaTeX/kernel/local-global on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index 7076f4b..6511c1b 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -2909,6 +2909,7 @@ Defining message LaTeX/kernel/scanmark-already-defined on line ...
Defining message LaTeX/kernel/variable-not-defined on line ...
Defining message LaTeX/kernel/variant-too-long on line ...
Defining message LaTeX/kernel/invalid-variant on line ...
+Defining message LaTeX/kernel/deprecated-variant on line ...
Defining message LaTeX/kernel/debug on line ...
Defining message LaTeX/kernel/expr on line ...
Defining message LaTeX/kernel/local-global on line ...
More information about the latex3-commits
mailing list