summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-06-18 21:08:59 +0000
committerKarl Berry <karl@freefriends.org>2020-06-18 21:08:59 +0000
commit700211024849d94938004ff91e0a3928b1578e98 (patch)
treea577e99bdf389f5e3a443561cb0162e4a13cd8ad /Master/texmf-dist/source/latex/l3kernel/l3msg.dtx
parent0e574a322aeab7e91f801eec35e961965f597e7a (diff)
l3 (18jun20)
git-svn-id: svn://tug.org/texlive/trunk@55586 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3msg.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3msg.dtx92
1 files changed, 91 insertions, 1 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx
index af1e78d3ed2..f7182ea0920 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2020-06-03}
+% \date{Released 2020-06-18}
%
% \maketitle
%
@@ -423,6 +423,46 @@
% all (see the discussion of message redirection).
% \end{function}
%
+% \subsection{Expandable error messages}
+%
+% In very rare cases it may be necessary to produce errors in an
+% expansion-only context. The functions in this section should only be
+% used if there is no alternative approach using \cs{msg_error:nnnnnn}
+% or other non-expandable commands from the previous section. Despite
+% 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, 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, 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, updated = 2019-02-28]
+% {
+% \msg_expandable_error:nnnnnn ,
+% \msg_expandable_error:nnnnn ,
+% \msg_expandable_error:nnnn ,
+% \msg_expandable_error:nnn ,
+% \msg_expandable_error:nn ,
+% \msg_expandable_error:nnffff ,
+% \msg_expandable_error:nnfff ,
+% \msg_expandable_error:nnff ,
+% \msg_expandable_error:nnf ,
+% }
+% \begin{syntax}
+% \cs{msg_expandable_error:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four}
+% \end{syntax}
+% Issues an \enquote{Undefined error} message from \TeX{} itself
+% using the undefined control sequence \cs{::error} then prints
+% \enquote{! \meta{module}: }\meta{error message}, which should be
+% short. With default settings, anything beyond approximately $60$
+% characters long (or bytes in some engines) is cropped. A leading
+% space might be removed as well.
+% \end{function}
+%
% \section{Redirecting messages}
%
% Each message has a \enquote{name}, which can be used to alter the behaviour
@@ -2098,6 +2138,56 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}[EXP]
+% {
+% \msg_expandable_error:nnnnnn ,
+% \msg_expandable_error:nnnnn ,
+% \msg_expandable_error:nnnn ,
+% \msg_expandable_error:nnn ,
+% \msg_expandable_error:nn ,
+% \msg_expandable_error:nnffff ,
+% \msg_expandable_error:nnfff ,
+% \msg_expandable_error:nnff ,
+% \msg_expandable_error:nnf
+% }
+% \begin{macro}{\@@_expandable_error_module:nn}
+% Pass to an auxiliary the message to display and the module name
+% \begin{macrocode}
+\cs_new:Npn \msg_expandable_error:nnnnnn #1#2#3#4#5#6
+ {
+ \exp_args:Ne \@@_expandable_error_module:nn
+ {
+ \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}
+ }
+\cs_new:Npn \msg_expandable_error:nnnnn #1#2#3#4#5
+ { \msg_expandable_error:nnnnnn {#1} {#2} {#3} {#4} {#5} { } }
+\cs_new:Npn \msg_expandable_error:nnnn #1#2#3#4
+ { \msg_expandable_error:nnnnnn {#1} {#2} {#3} {#4} { } { } }
+\cs_new:Npn \msg_expandable_error:nnn #1#2#3
+ { \msg_expandable_error:nnnnnn {#1} {#2} {#3} { } { } { } }
+\cs_new:Npn \msg_expandable_error:nn #1#2
+ { \msg_expandable_error:nnnnnn {#1} {#2} { } { } { } { } }
+\cs_generate_variant:Nn \msg_expandable_error:nnnnnn { nnffff }
+\cs_generate_variant:Nn \msg_expandable_error:nnnnn { nnfff }
+\cs_generate_variant:Nn \msg_expandable_error:nnnn { nnff }
+\cs_generate_variant:Nn \msg_expandable_error:nnn { nnf }
+\cs_new:Npn \@@_expandable_error_module:nn #1#2
+ {
+ \exp_after:wN \exp_after:wN
+ \exp_after:wN \@@_use_none_delimit_by_s_stop:w
+ \use:n { \::error ! ~ #2 : ~ #1 } \s_@@_stop
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
% \begin{macrocode}
%</initex|package>
% \end{macrocode}