[latex3-commits] [git/LaTeX3-latex3-latex2e] kernel-msgs: further error normalization (7e5135e3)

Frank Mittelbach frank.mittelbach at latex-project.org
Wed May 26 20:21:20 CEST 2021


Repository : https://github.com/latex3/latex2e
On branch  : kernel-msgs
Link       : https://github.com/latex3/latex2e/commit/7e5135e3ff316a0b639079d77bea1efb702f25b6

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

commit 7e5135e3ff316a0b639079d77bea1efb702f25b6
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Wed May 26 20:21:20 2021 +0200

    further error normalization


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

7e5135e3ff316a0b639079d77bea1efb702f25b6
 base/changes.txt                             |  5 +++++
 base/ltcmdhooks.dtx                          |  8 +++-----
 base/ltdefns.dtx                             |  5 +++--
 base/testfiles-lthooks/ltcmdhooks-001.tlg    |  7 +++----
 base/testfiles-lthooks/ltcmdhooks-009.tlg    |  7 +++----
 base/testfiles-lthooks/ltcmdhooks-011.tlg    | 30 ++++++++++++----------------
 base/testfiles/github-robust-0123.luatex.tlg |  2 +-
 base/testfiles/github-robust-0123.tlg        |  2 +-
 base/testfiles/github-robust-0123.xetex.tlg  |  2 +-
 9 files changed, 33 insertions(+), 35 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index b389ade0..2bd836d6 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -6,6 +6,11 @@ completeness or accuracy and it contains some references to files that
 are not part of the distribution.
 ================================================================================
 
+2021-05-26  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* ltdefns.dtx (subsection{Robust commands and protect}):
+	Normalize error message in \MakeRobust
+
 2021-05-26  Phelype Oleinik  <phelype.oleinik at latex-project.org>
 
 	* lthooks.dtx:
diff --git a/base/ltcmdhooks.dtx b/base/ltcmdhooks.dtx
index a4220105..e73a1bd2 100644
--- a/base/ltcmdhooks.dtx
+++ b/base/ltcmdhooks.dtx
@@ -1050,13 +1050,11 @@
   }
 \msg_new:nnnn { hooks } { cant-patch }
   {
-    Command~`#1'~cannot~have~hooks~because~it~
-    \@@_unpatchable_cases:n {#2} .
+    Generic~hooks~cannot~be~added~to~'#1'.
   }
   {
-    You~tried~to~add~a~hook~to~`#1',~but~LaTeX~was~not~able~to~
-    add~the~hook~to~that~command~because~`#1'~
-    \@@_unpatchable_cases:n {#2} .
+    You~tried~to~add~a~hook~to~'#1',~but~LaTeX~was~unable~to~
+    patch~the~command~because~it~\@@_unpatchable_cases:n {#2}.
   }
 \cs_new:Npn \@@_unpatchable_cases:n #1
   {
diff --git a/base/ltdefns.dtx b/base/ltdefns.dtx
index 7236083d..31a7bf25 100644
--- a/base/ltdefns.dtx
+++ b/base/ltdefns.dtx
@@ -32,7 +32,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltdefns.dtx}
-             [2021/04/19 v1.5o LaTeX Kernel (definition commands)]
+             [2021/05/26 v1.5p LaTeX Kernel (definition commands)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltdefns.dtx}
@@ -1222,6 +1222,7 @@
 %
 %    The macro firstly checks if the control sequence in question exists
 %    at all.
+% \changes{v1.5p}{2021/05/26}{Normalize error message in \cs{MakeRobust}}
 %    \begin{macrocode}
 %</2ekernel>
 %<latexrelease>\IncludeInRelease{2020/10/01}{\MakeRobust}{\MakeRobust}%
@@ -1230,7 +1231,7 @@
   \count@=\escapechar
   \escapechar=`\\
   \@ifundefined{\expandafter\@gobble\string#1}{%
-    \@latex at error{The control sequence `\string#1' is undefined!%
+    \@latex at error{Command `\string#1' is undefined!%
       \MessageBreak There is nothing here to make robust}%
     \@eha
   }%
diff --git a/base/testfiles-lthooks/ltcmdhooks-001.tlg b/base/testfiles-lthooks/ltcmdhooks-001.tlg
index e65c9402..20b59930 100644
--- a/base/testfiles-lthooks/ltcmdhooks-001.tlg
+++ b/base/testfiles-lthooks/ltcmdhooks-001.tlg
@@ -214,12 +214,11 @@ before 1 before 2 FOO hello world after 2 after 1
 -> Adding cmd hook to 'baz' (before):
 [lthooks] analyzing '\baz'
 [lthooks] \baz=\relax
-! LaTeX hooks Error: Command `\baz' cannot have hooks because it doesn't
-(hooks)              exist.
+! LaTeX hooks Error: Generic hooks cannot be added to '\baz'.
 For immediate help type H <return>.
  ...                                              
 l. ...\AddToHook{cmd/baz/before}{error}
-You tried to add a hook to `\baz', but LaTeX was not able to add the hook to
-that command because `\baz' doesn't exist.
+You tried to add a hook to '\baz', but LaTeX was unable to patch the command
+because it doesn't exist.
 **** Add to hook cmd/baz/before (top-level) on input line ... <- error
 Update code for hook 'cmd/baz/before' on input line ...:
diff --git a/base/testfiles-lthooks/ltcmdhooks-009.tlg b/base/testfiles-lthooks/ltcmdhooks-009.tlg
index 21248b23..d1f76583 100644
--- a/base/testfiles-lthooks/ltcmdhooks-009.tlg
+++ b/base/testfiles-lthooks/ltcmdhooks-009.tlg
@@ -1,11 +1,10 @@
 This is a generated file for the l3build validation system.
 Don't change this file in any respect.
-! LaTeX hooks Error: Command `\alsoundefined' cannot have hooks because it
-(hooks)              doesn't exist.
+! LaTeX hooks Error: Generic hooks cannot be added to '\alsoundefined'.
 For immediate help type H <return>.
  ...                                              
 l. ...\AddToHook{cmd/alsoundefined/after}{Error}
-You tried to add a hook to `\alsoundefined', but LaTeX was not able to add the
-hook to that command because `\alsoundefined' doesn't exist.
+You tried to add a hook to '\alsoundefined', but LaTeX was unable to patch the
+command because it doesn't exist.
 This one is ... 
 now defined (but no after cmd hook)
diff --git a/base/testfiles-lthooks/ltcmdhooks-011.tlg b/base/testfiles-lthooks/ltcmdhooks-011.tlg
index 4c65f6c0..ad579662 100644
--- a/base/testfiles-lthooks/ltcmdhooks-011.tlg
+++ b/base/testfiles-lthooks/ltcmdhooks-011.tlg
@@ -8,32 +8,28 @@ For immediate help type H <return>.
 l. ...\AddToHook{cmd/textbf/middle}{error}
 You tried to add a hook to command \textbf, but `middle' is an invalid
 component. Only `before' or `after' are allowed.
-! LaTeX hooks Error: Command `\undefined' cannot have hooks because it doesn't
-(hooks)              exist.
+! LaTeX hooks Error: Generic hooks cannot be added to '\undefined'.
 For immediate help type H <return>.
  ...                                              
 l. ...\AddToHook{cmd/undefined/before}{error}
-You tried to add a hook to `\undefined', but LaTeX was not able to add the
-hook to that command because `\undefined' doesn't exist.
-! LaTeX hooks Error: Command `\detokenize' cannot have hooks because it is not
-(hooks)              a macro.
+You tried to add a hook to '\undefined', but LaTeX was unable to patch the
+command because it doesn't exist.
+! LaTeX hooks Error: Generic hooks cannot be added to '\detokenize'.
 For immediate help type H <return>.
  ...                                              
 l. ...\AddToHook{cmd/detokenize/before}{error}
-You tried to add a hook to `\detokenize', but LaTeX was not able to add the
-hook to that command because `\detokenize' is not a macro.
-! LaTeX hooks Error: Command `\__hook_cmd_begindocument_code:' cannot have
-(hooks)              hooks because it doesn't exist.
+You tried to add a hook to '\detokenize', but LaTeX was unable to patch the
+command because it is not a macro.
+! LaTeX hooks Error: Generic hooks cannot be added to
+(hooks)              '\__hook_cmd_begindocument_code:'.
 For immediate help type H <return>.
  ...                                              
 l. ......ook_cmd_begindocument_code:/before}{error}
-You tried to add a hook to `\__hook_cmd_begindocument_code:', but LaTeX was
-not able to add the hook to that command because
-`\__hook_cmd_begindocument_code:' doesn't exist.
-! LaTeX hooks Error: Command `\mycmd' cannot have hooks because it can't be
-(hooks)              retokenized cleanly.
+You tried to add a hook to '\__hook_cmd_begindocument_code:', but LaTeX was
+unable to patch the command because it doesn't exist.
+! LaTeX hooks Error: Generic hooks cannot be added to '\mycmd'.
 For immediate help type H <return>.
  ...                                              
 l. ...\AddToHook{cmd/mycmd/before}{error}
-You tried to add a hook to `\mycmd', but LaTeX was not able to add the hook to
-that command because `\mycmd' can't be retokenized cleanly.
+You tried to add a hook to '\mycmd', but LaTeX was unable to patch the command
+because it can't be retokenized cleanly.
diff --git a/base/testfiles/github-robust-0123.luatex.tlg b/base/testfiles/github-robust-0123.luatex.tlg
index 30b6baeb..319634eb 100644
--- a/base/testfiles/github-robust-0123.luatex.tlg
+++ b/base/testfiles/github-robust-0123.luatex.tlg
@@ -112,7 +112,7 @@ l. ...\mruntest{ccc}
 ---------------------------------------
 \LoadClass -> \GenericError {               }{LaTeX Error: Can be used only in preamble}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}
 ---------------------------------------
-\MakeRobust{foo}{bar}{baz} -> \count@ =\escapechar \escapechar =`\\ \GenericError {               }{LaTeX Error: The control sequence `foo' is undefined!\MessageBreak There is nothing here to make robust}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}\escapechar =\count@ {bar}{baz}
+\MakeRobust{foo}{bar}{baz} -> \count@ =\escapechar \escapechar =`\\ \GenericError {               }{LaTeX Error: Command `foo' is undefined!\MessageBreak There is nothing here to make robust}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}\escapechar =\count@ {bar}{baz}
 ---------------------------------------
 \OptionNotUsed -> \GenericError {               }{LaTeX Error: Can be used only in preamble}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}
 ---------------------------------------
diff --git a/base/testfiles/github-robust-0123.tlg b/base/testfiles/github-robust-0123.tlg
index c696a920..21725a5b 100644
--- a/base/testfiles/github-robust-0123.tlg
+++ b/base/testfiles/github-robust-0123.tlg
@@ -112,7 +112,7 @@ l. ...\mruntest{ccc}
 ---------------------------------------
 \LoadClass -> \GenericError {               }{LaTeX Error: Can be used only in preamble}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}
 ---------------------------------------
-\MakeRobust{foo}{bar}{baz} -> \count@ =\escapechar \escapechar =`\\ \GenericError {               }{LaTeX Error: The control sequence `foo' is undefined!\MessageBreak There is nothing here to make robust}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}\escapechar =\count@ {bar}{baz}
+\MakeRobust{foo}{bar}{baz} -> \count@ =\escapechar \escapechar =`\\ \GenericError {               }{LaTeX Error: Command `foo' is undefined!\MessageBreak There is nothing here to make robust}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}\escapechar =\count@ {bar}{baz}
 ---------------------------------------
 \OptionNotUsed -> \GenericError {               }{LaTeX Error: Can be used only in preamble}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}
 ---------------------------------------
diff --git a/base/testfiles/github-robust-0123.xetex.tlg b/base/testfiles/github-robust-0123.xetex.tlg
index 0d42f1db..bc364a5d 100644
--- a/base/testfiles/github-robust-0123.xetex.tlg
+++ b/base/testfiles/github-robust-0123.xetex.tlg
@@ -112,7 +112,7 @@ l. ...\mruntest{ccc}
 ---------------------------------------
 \LoadClass -> \GenericError {               }{LaTeX Error: Can be used only in preamble}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}
 ---------------------------------------
-\MakeRobust{foo}{bar}{baz} -> \count@ =\escapechar \escapechar =`\\ \GenericError {               }{LaTeX Error: The control sequence `foo' is undefined!\MessageBreak There is nothing here to make robust}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}\escapechar =\count@ {bar}{baz}
+\MakeRobust{foo}{bar}{baz} -> \count@ =\escapechar \escapechar =`\\ \GenericError {               }{LaTeX Error: Command `foo' is undefined!\MessageBreak There is nothing here to make robust}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}\escapechar =\count@ {bar}{baz}
 ---------------------------------------
 \OptionNotUsed -> \GenericError {               }{LaTeX Error: Can be used only in preamble}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}
 ---------------------------------------





More information about the latex3-commits mailing list.