[latex3-commits] [git/LaTeX3-latex3-latex2e] kernel-msgs: make para error hooks error (and in one case a general kernel error); also correct error message, it was missing the spaces (48086d57)
Frank Mittelbach
frank.mittelbach at latex-project.org
Sun May 16 16:36:57 CEST 2021
Repository : https://github.com/latex3/latex2e
On branch : kernel-msgs
Link : https://github.com/latex3/latex2e/commit/48086d57761fd757cf883616b6a2a53df4d6f8ef
>---------------------------------------------------------------
commit 48086d57761fd757cf883616b6a2a53df4d6f8ef
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Sun May 16 16:36:57 2021 +0200
make para error hooks error (and in one case a general kernel error);
also correct error message, it was missing the spaces
>---------------------------------------------------------------
48086d57761fd757cf883616b6a2a53df4d6f8ef
base/ltpara.dtx | 26 ++++++++-------
base/testfiles-lthooks2/ltpara-002.tlg | 8 ++---
base/testfiles-lthooks2/ltpara-007.tlg | 8 ++---
base/testfiles-lthooks2/ltpara-008.lvt | 3 ++
base/testfiles-lthooks2/ltpara-008.tlg | 58 +++++++++++++++++++++++++++++++++-
5 files changed, 82 insertions(+), 21 deletions(-)
diff --git a/base/ltpara.dtx b/base/ltpara.dtx
index 481baa04..1ef0d5a3 100644
--- a/base/ltpara.dtx
+++ b/base/ltpara.dtx
@@ -751,7 +751,7 @@
% we can detect and report if the \hook{para/before} hook illegally
% changed out of vmode.
% \begin{macrocode}
- \tex_everypar:D { \__kernel_msg_error:nnnn {para}{mode}{before}{vertical} }
+ \tex_everypar:D { \msg_error:nnnn { hooks }{ para-mode }{before}{vertical} }
\@kernel at before@para at before
\hook_use:n {para/before}
% \end{macrocode}
@@ -785,7 +785,7 @@
% If we aren't in horizontal mode any longer the hooks above misbehaved.
% \begin{macrocode}
\if_mode_horizontal: \else:
- \__kernel_msg_error:nnnn {para}{mode}{begin}{vertical} \fi:
+ \msg_error:nnnn { hooks }{ para-mode }{begin}{vertical} \fi:
% \end{macrocode}
% Finally we reinsert the indentation box (unless suppressed) and
% then call \cs{everypar} the way legacy \LaTeX\ code expects it.
@@ -1047,7 +1047,7 @@
% If we haven't been in horizontal mode then the earlier hook
% \hook{para/end} is at fault and we report that.
% \begin{macrocode}
- { \__kernel_msg_error:nnnn {para}{mode}{end}{horizontal} }
+ { \msg_error:nnnn { hooks }{ para-mode }{end}{horizontal} }
% \end{macrocode}
% Finally close out the nested conditionals.
% \begin{macrocode}
@@ -1088,7 +1088,7 @@
\@@_handle_indent:
\the\everypar }
}
- { \__kernel_msg_error:nn {para}{raw} }
+ { \__kernel_msg_error:nn { kernel }{ raw-para } }
\tex_indent:D
}
% \end{macrocode}
@@ -1101,7 +1101,7 @@
\tex_everypar:D { \g_@@_standard_everypar_tl }
\the\everypar }
}
- { \__kernel_msg_error:nn {para}{raw} }
+ { \__kernel_msg_error:nn { kernel }{ raw-para } }
\tex_noindent:D
}
% \end{macrocode}
@@ -1165,7 +1165,7 @@
% \end{macrocode}
%
% \begin{macrocode}
-\__kernel_msg_new:nnnn {para} {mode}
+\msg_new:nnnn { hooks } { para-mode }
{
Illegal~mode~ change~ in~ hook~ 'para/#1'.\\
Hook~ code~ did~ not~ remain~ in~ #2~ mode.
@@ -1174,21 +1174,23 @@
Paragraph~ hooks~ cannot~ change~ the~ TeX~ mode~ without~ causing~
endless~ recursion.~ The~ hook~ code~ in~ 'para/#1'~ needs~ to~ stay~
in~ #2~ mode,~ but~ it~ didn't.~ Examine~ the~ hook~
- code~ with~ \ShowHook~ to~ find~ the~ issue.
+ code~ with~ \iow_char:N \\ShowHook~ to~ find~ the~ issue.
}
% \end{macrocode}
%
% And here is one used in the \enquote{raw} commands when they are
% used outside of vertical mode.
% \begin{macrocode}
-\__kernel_msg_new:nnnn {para} {raw}
+\__kernel_msg_new:nnnn { kernel } { raw-para }
{
- Paragraph started while not in vertical mode.
+ Paragraph~ started~ while~ not~ in~ vertical~ mode.
}
{
- Starting a paragraph with \RawIndent or \RawNoindent
- (or \para_raw_indent: or \para_raw_noindent:) is only
- allowed if LaTeX is in vertical mode.
+ Starting~ a~ paragraph~ with~ \iow_char:N \\RawIndent~ or~
+ \iow_char:N \\RawNoindent \\
+ (or~ \iow_char:N \\para_raw_indent:~ or~
+ \iow_char:N \\para_raw_noindent:)~ is~ only~ allowed \\
+ if~ LaTeX~ is~ in~ vertical~ mode.
}
% \end{macrocode}
diff --git a/base/testfiles-lthooks2/ltpara-002.tlg b/base/testfiles-lthooks2/ltpara-002.tlg
index 3e349a6d..d32bd6d4 100644
--- a/base/testfiles-lthooks2/ltpara-002.tlg
+++ b/base/testfiles-lthooks2/ltpara-002.tlg
@@ -4,8 +4,8 @@ PARA: 1 start (document level on input line ...)
PARA: 1 end (document level on input line ...)
PARA: 1 start (document level on input line ...)
PARA: 1 end (document level on input line ...)
-! LaTeX3 Error: Illegal mode change in hook 'para/begin'.
-(LaTeX3) Hook code did not remain in vertical mode.
+! LaTeX hooks Error: Illegal mode change in hook 'para/begin'.
+(hooks) Hook code did not remain in vertical mode.
For immediate help type H <return>.
...
l. ...A
@@ -18,8 +18,8 @@ PARA: 1 end (document level on input line ...)
PARA: 1 start (document level on input line ...)
PARA: 1 end (document level on input line ...)
PARA: 0 end (document level on input line ...)
-! LaTeX3 Error: Illegal mode change in hook 'para/end'.
-(LaTeX3) Hook code did not remain in horizontal mode.
+! LaTeX hooks Error: Illegal mode change in hook 'para/end'.
+(hooks) Hook code did not remain in horizontal mode.
For immediate help type H <return>.
...
l. ...
diff --git a/base/testfiles-lthooks2/ltpara-007.tlg b/base/testfiles-lthooks2/ltpara-007.tlg
index 2bd59982..acd480dc 100644
--- a/base/testfiles-lthooks2/ltpara-007.tlg
+++ b/base/testfiles-lthooks2/ltpara-007.tlg
@@ -4,8 +4,8 @@ PARA: 1 start (document level on input line ...)
PARA: 1 end (document level on input line ...)
PARA: 1 start (document level on input line ...)
PARA: 1 end (document level on input line ...)
-! LaTeX3 Error: Illegal mode change in hook 'para/before'.
-(LaTeX3) Hook code did not remain in vertical mode.
+! LaTeX hooks Error: Illegal mode change in hook 'para/before'.
+(hooks) Hook code did not remain in vertical mode.
For immediate help type H <return>.
...
l. ...T
@@ -19,8 +19,8 @@ PARA: 0 end (document level on input line ...)
PARA: 0 start (document level on input line ...)
PARA: 0 end (document level on input line ...)
PARA: -1 end (document level on input line ...)
-! LaTeX3 Error: Illegal mode change in hook 'para/end'.
-(LaTeX3) Hook code did not remain in horizontal mode.
+! LaTeX hooks Error: Illegal mode change in hook 'para/end'.
+(hooks) Hook code did not remain in horizontal mode.
For immediate help type H <return>.
...
l. ...
diff --git a/base/testfiles-lthooks2/ltpara-008.lvt b/base/testfiles-lthooks2/ltpara-008.lvt
index abe71663..3d25170c 100644
--- a/base/testfiles-lthooks2/ltpara-008.lvt
+++ b/base/testfiles-lthooks2/ltpara-008.lvt
@@ -21,6 +21,9 @@ Test1
\noindent Test4
+Test error 1 \RawIndent 2 \RawNoindent 3 \par
+
+\RawParEnd
\end{document}
diff --git a/base/testfiles-lthooks2/ltpara-008.tlg b/base/testfiles-lthooks2/ltpara-008.tlg
index 4ef21756..07424a19 100644
--- a/base/testfiles-lthooks2/ltpara-008.tlg
+++ b/base/testfiles-lthooks2/ltpara-008.tlg
@@ -4,6 +4,24 @@ PARA: 1 start (document level on input line ...)
PARA: 1 end (document level on input line ...)
PARA: 1 start (document level on input line ...)
PARA: 1 end (document level on input line ...)
+PARA: 1 start (document level on input line ...)
+! LaTeX3 Error: Paragraph started while not in vertical mode.
+For immediate help type H <return>.
+ ...
+l. ...Test error 1 \RawIndent
+ 2 \RawNoindent 3 \par
+Starting a paragraph with \RawIndent or \RawNoindent
+(or \para_raw_indent: or \para_raw_noindent:) is only allowed
+if LaTeX is in vertical mode.
+! LaTeX3 Error: Paragraph started while not in vertical mode.
+For immediate help type H <return>.
+ ...
+l. ...Test error 1 \RawIndent 2 \RawNoindent
+ 3 \par
+Starting a paragraph with \RawIndent or \RawNoindent
+(or \para_raw_indent: or \para_raw_noindent:) is only allowed
+if LaTeX is in vertical mode.
+PARA: 1 end (document level on input line ...)
Completed box being shipped out [1]
\vbox(633.0+0.0)x407.0
.\hbox(0.0+0.0)x0.0
@@ -17,7 +35,7 @@ Completed box being shipped out [1]
....\special{color pop}
..\glue 25.0
..\glue(\lineskip) 0.0
-..\vbox(550.0+0.0)x345.0, glue set 503.94617fil
+..\vbox(550.0+0.0)x345.0, glue set 491.94745fil
...\write-{}
...\glue(\topskip) 2.5
...\hbox(7.5+1.94397)x345.0, glue set 306.33331fil
@@ -93,6 +111,44 @@ Completed box being shipped out [1]
....\penalty 10000
....\glue(\parfillskip) 0.0 plus 1.0fil
....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\parskip) 0.0
+...\glue(\baselineskip) 2.55603
+...\hbox(7.5+1.94397)x345.0, glue set 246.8055fil
+....\hbox(7.5+0.0)x0.0, glue set - 5.00002fil
+.....\glue 0.0 plus 1.0fil minus 1.0fil
+.....\special{color push rgb 1 0 0}
+.....\OT1/cmr/m/n/10 *
+.....\special{color pop}
+....\hbox(0.0+0.0)x0.0
+....\hbox(0.0+0.0)x15.0
+....\OT1/cmr/m/n/10 T
+....\kern-0.83334
+....\OT1/cmr/m/n/10 e
+....\OT1/cmr/m/n/10 s
+....\OT1/cmr/m/n/10 t
+....\glue 3.33333 plus 1.66666 minus 1.11111
+....\OT1/cmr/m/n/10 e
+....\OT1/cmr/m/n/10 r
+....\OT1/cmr/m/n/10 r
+....\OT1/cmr/m/n/10 o
+....\OT1/cmr/m/n/10 r
+....\glue 3.33333 plus 1.66666 minus 1.11111
+....\OT1/cmr/m/n/10 1
+....\glue 3.33333 plus 1.66666 minus 1.11111
+....\hbox(0.0+0.0)x15.0
+....\OT1/cmr/m/n/10 2
+....\glue 3.33333 plus 1.66666 minus 1.11111
+....\OT1/cmr/m/n/10 3
+....\hbox(6.8872+1.94397)x0.0, glue set - 6.10962fil
+.....\special{color push rgb 1 0 0}
+.....\TS1/cmr/m/n/10 ^^b6
+.....\special{color pop}
+.....\glue 0.0 plus 1.0fil minus 1.0fil
+....\kern 0.0
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
...\glue -1.94397
...\glue 0.0 plus 1.0fil
...\glue 0.0
More information about the latex3-commits
mailing list.