diff options
Diffstat (limited to 'macros/latex-dev/base/lthooks.dtx')
-rw-r--r-- | macros/latex-dev/base/lthooks.dtx | 103 |
1 files changed, 49 insertions, 54 deletions
diff --git a/macros/latex-dev/base/lthooks.dtx b/macros/latex-dev/base/lthooks.dtx index 45d6a78aba..20e172a57f 100644 --- a/macros/latex-dev/base/lthooks.dtx +++ b/macros/latex-dev/base/lthooks.dtx @@ -31,8 +31,8 @@ %%% From File: lthooks.dtx % % \begin{macrocode} -\def\lthooksversion{v1.0m} -\def\lthooksdate{2021/04/29} +\def\lthooksversion{v1.0n} +\def\lthooksdate{2021/05/26} % \end{macrocode} % %<*driver> @@ -1807,8 +1807,9 @@ %<@@=hook> % \end{macrocode} % -% \changes{v1.0i}{2021/03/18} -% {Use \cs{NewModuleRelease}.} +% \changes{v1.0i}{2021/03/18}{Use \cs{NewModuleRelease}.} +% \changes{v1.0n}{2021/05/24}{Use \cs{msg_...} instead of \cs{__kernel_msg...}} +% % \begin{macrocode} %<*2ekernel|latexrelease> \ExplSyntaxOn @@ -2230,7 +2231,7 @@ % \cs{hook_new:n} is used. % \begin{macrocode} \@@_if_declared:nTF {#1} - { \__kernel_msg_error:nnn { hooks } { exists } {#1} } + { \msg_error:nnn { hooks } { exists } {#1} } { \tl_new:c { g_@@_#1_declared_tl } \@@_make_usable:n {#1} @@ -2484,7 +2485,7 @@ % may change). % \begin{macrocode} \@@_if_disabled:nTF {#1} - { \__kernel_msg_warning:nnn { hooks } { provide-disabled } {#1} } + { \msg_warning:nnn { hooks } { provide-disabled } {#1} } % \end{macrocode} % Otherwise we check if it was already declared. % \begin{macrocode} @@ -2496,7 +2497,7 @@ % the already existing one is not (or vice versa). % \begin{macrocode} \str_if_eq:eeF { \tl_use:c { g_@@_#1_reversed_tl } } {#2} - { \__kernel_msg_error:nnn { hooks } { provide-error } {#1} } + { \msg_error:nnn { hooks } { provide-error } {#1} } } % \end{macrocode} % If it wasn't declared, we declared as a normal or reversed hook @@ -2572,7 +2573,7 @@ { \tl_if_empty:nTF {#1} { - \__kernel_msg_expandable_error:nn { hooks } { empty-label } + \msg_expandable_error:nn { hooks } { empty-label } \@@_currname_or_default: } { @@ -2609,7 +2610,7 @@ { \tl_if_empty:NTF \@currname { - \__kernel_msg_expandable_error:nnn { hooks } { should-not-happen } + \msg_expandable_error:nnn { kernel } { should-not-happen } { Empty~default~label. } \@@_make_name:n { label-missing } } @@ -2750,7 +2751,7 @@ % \begin{macrocode} { \@@_if_disabled:nTF {#1} - { \__kernel_msg_error:nnn { hooks } { hook-disabled } {#1} } + { \msg_error:nnn { hooks } { hook-disabled } {#1} } { \@@_try_declaring_generic_hook:nnn {#1} {#2} {#3} } } } @@ -2793,7 +2794,7 @@ \@@_init_structure:n {#1} \@@_tl_gput_right:cn { @@_toplevel~#1 } {#3} } - { \__kernel_msg_error:nnn { hooks } { misused-top-level } {#1} } + { \msg_error:nnn { hooks } { misused-top-level } {#1} } } { \prop_get:cnNTF { g_@@_#1_code_prop } {#2} \l_@@_return_tl @@ -3279,7 +3280,7 @@ {#1} {#2} {#4} \@@_update_hook_code:n {#1} } - { \__kernel_msg_error:nnnnnn { hooks } { unknown-rule } + { \msg_error:nnnnnn { hooks } { unknown-rule } {#1} {#2} {#3} {#4} } } % \end{macrocode} @@ -3887,7 +3888,7 @@ \cs_new_protected:cpn { @@_apply_rule_xE:nnn } #1#2#3 { \@@_debug:n { \@@_msg_pair_found:nnn {#1} {#2} {#3} } - \__kernel_msg_error:nnnnnn { hooks } { labels-incompatible } + \msg_error:nnnnnn { hooks } { labels-incompatible } {#1} {#2} {#3} { 1 } \use:c { @@_apply_rule_->:nnn } {#1} {#2} {#3} \use:c { @@_apply_rule_<-:nnn } {#1} {#2} {#3} @@ -3895,7 +3896,7 @@ \cs_new_protected:cpn { @@_apply_rule_xW:nnn } #1#2#3 { \@@_debug:n { \@@_msg_pair_found:nnn {#1} {#2} {#3} } - \__kernel_msg_warning:nnnnnn { hooks } { labels-incompatible } + \msg_warning:nnnnnn { hooks } { labels-incompatible } {#1} {#2} {#3} { 0 } } % \end{macrocode} @@ -4239,7 +4240,7 @@ \cs_new_protected:Npn \@@_gput_next_code:nn #1 #2 { \@@_if_disabled:nTF {#1} - { \__kernel_msg_error:nnn { hooks } { hook-disabled } {#1} } + { \msg_error:nnn { hooks } { hook-disabled } {#1} } { \@@_init_structure:n {#1} \@@_if_usable:nTF {#1} @@ -4537,8 +4538,18 @@ % % \subsection{Messages} % +% Hook errors are LaTeX kernel errors: +% \begin{macrocode} +\prop_gput:Nnn \g_msg_module_type_prop { hooks } { LaTeX } +% \end{macrocode} +% And so are kernel errors (this should move elsewhere eventually). % \begin{macrocode} -\__kernel_msg_new:nnnn { hooks } { labels-incompatible } +\prop_gput:Nnn \g_msg_module_type_prop { kernel } { LaTeX } +%\prop_gput:Nnn \g_msg_module_name_prop { kernel } { } % <-- currently not working +% \end{macrocode} +% +% \begin{macrocode} +\msg_new:nnnn { hooks } { labels-incompatible } { Labels~'#1'~and~'#2'~are~incompatible \str_if_eq:nnF {#3} {??} { ~in~hook~'#3' } .~ @@ -4551,7 +4562,7 @@ % \end{macrocode} % % \begin{macrocode} -\__kernel_msg_new:nnnn { hooks } { exists } +\msg_new:nnnn { hooks } { exists } { Hook~'#1'~ has~ already~ been~ declared. } { There~ already~ exists~ a~ hook~ declaration~ with~ this~ name.\\ @@ -4560,7 +4571,7 @@ % % % \begin{macrocode} -\__kernel_msg_new:nnnn { hooks } { hook-disabled } +\msg_new:nnnn { hooks } { hook-disabled } { Cannot~add~code~to~disabled~hook~'#1'. } { The~hook~'#1'~you~tried~to~add~code~to~was~previously~disabled~ @@ -4570,7 +4581,7 @@ % \end{macrocode} % % \begin{macrocode} -\__kernel_msg_new:nnn { hooks } { empty-label } +\msg_new:nnn { hooks } { empty-label } { Empty~code~label~\msg_line_context:.~ Using~'\@@_currname_or_default:'~instead. @@ -4578,7 +4589,7 @@ % \end{macrocode} % % \begin{macrocode} -\__kernel_msg_new:nnn { hooks } { no-default-label } +\msg_new:nnn { hooks } { no-default-label } { Missing~(empty)~default~label~\msg_line_context:. \\ This~command~was~ignored. @@ -4586,7 +4597,7 @@ % \end{macrocode} % % \begin{macrocode} -\__kernel_msg_new:nnnn { hooks } { unknown-rule } +\msg_new:nnnn { hooks } { unknown-rule } { Unknown~ relationship~ '#3'~ between~ labels~ '#2'~ and~ '#4'~ \str_if_eq:nnF {#1} {??} { ~in~hook~'#1' }. ~ @@ -4604,9 +4615,9 @@ % \end{macrocode} % % \begin{macrocode} -\__kernel_msg_new:nnnn { hooks } { misused-top-level } +\msg_new:nnnn { hooks } { misused-top-level } { - Illegal~\iow_char:N \\AddToHook{#1}[top-level]{...}.\\ + Illegal~use~of~\iow_char:N \\AddToHook{#1}[top-level]{...}.\\ 'top-level'~is~reserved~for~the~user's~document. } { @@ -4618,7 +4629,7 @@ % \end{macrocode} % % \begin{macrocode} -\__kernel_msg_new:nnn { hooks } { set-top-level } +\msg_new:nnn { hooks } { set-top-level } { You~cannot~change~the~default~label~#1~'top-level'.~Illegal \\ \use:nn { ~ } { ~ } \iow_char:N \\#2{#3} \\ @@ -4627,21 +4638,12 @@ % \end{macrocode} % % \begin{macrocode} -\__kernel_msg_new:nnn { hooks } { ddhl-deprecated } - { - \iow_char:N \\DeclareDefaultHookLabel~is~deprecated.\\ - Use~\iow_char:N \\SetDefaultHookLabel~instead.\\ \\ - The~deprecated~name~will~be~removed~in~the~next~release. - } -% \end{macrocode} -% -% \begin{macrocode} -\__kernel_msg_new:nnn { hooks } { extra-pop-label } +\msg_new:nnn { hooks } { extra-pop-label } { Extra~\iow_char:N \\PopDefaultHookLabel. \\ This~command~will~be~ignored. } -\__kernel_msg_new:nnn { hooks } { missing-pop-label } +\msg_new:nnn { hooks } { missing-pop-label } { Missing~\iow_char:N \\PopDefaultHookLabel. \\ The~label~'#1'~was~pushed~but~never~popped.~Something~is~wrong. @@ -4649,9 +4651,9 @@ % \end{macrocode} % % \begin{macrocode} -\__kernel_msg_new:nnn { hooks } { should-not-happen } +\msg_new:nnn { kernel } { should-not-happen } { - ERROR!~This~should~not~happen.~#1 \\ + This~should~not~happen.~#1 \\ Please~report~at~https://github.com/latex3/latex2e. } % \end{macrocode} @@ -4659,14 +4661,14 @@ % % % \begin{macrocode} -\__kernel_msg_new:nnn { hooks } { provide-disabled } +\msg_new:nnn { hooks } { provide-disabled } { - Can't~ provide~ hook~ '#1'~ because~ it~ is~ disabled! + Cannot~ provide~ hook~ '#1'~ because~ it~ is~ disabled! } % \end{macrocode} % % \begin{macrocode} -\__kernel_msg_new:nnnn { hooks } { provide-error } +\msg_new:nnnn { hooks } { provide-error } { Hook~'#1'~ already~ declared~ as~ a~ \@@_if_reversed:nTF {#1} { reversed } { normal }~ hook! @@ -4764,10 +4766,9 @@ % \begin{macro}{\SetDefaultHookLabel} % \begin{macro}{\PushDefaultHookLabel} % \begin{macro}{\PopDefaultHookLabel} -% \begin{macro}{\DeclareDefaultHookLabel} % % \fmiinline{Docu task: At some point this code for this should be moved to the -% label section earlier and here we should keep only the interface commands.} +% label section earlier and here we should keep only the interface commands.} % % \begin{macro}{\@@_curr_name_push:n,\@@_curr_name_push_aux:n} % \begin{macro}{\@@_curr_name_pop:} @@ -4829,11 +4830,11 @@ \cs_new_protected:Npn \@@_curr_name_push_aux:n #1 { \tl_if_blank:nTF {#1} - { \__kernel_msg_error:nn { hooks } { no-default-label } } + { \msg_error:nn { hooks } { no-default-label } } { \str_if_eq:nnTF {#1} { top-level } { - \__kernel_msg_error:nnnnn { hooks } { set-top-level } + \msg_error:nnnnn { hooks } { set-top-level } { to } { PushDefaultHookLabel } {#1} } { @@ -4851,7 +4852,7 @@ { \seq_gpop:NNTF \g_@@_name_stack_seq \l_@@_return_tl { \tl_gset_eq:NN \g_@@_hook_curr_name_tl \l_@@_return_tl } - { \__kernel_msg_error:nn { hooks } { extra-pop-label } } + { \msg_error:nn { hooks } { extra-pop-label } } } % \end{macrocode} % @@ -4866,7 +4867,7 @@ { \seq_gpop:NNT \g_@@_name_stack_seq \l_@@_return_tl { - \__kernel_msg_error:nnx { hooks } { missing-pop-label } + \msg_error:nnx { hooks } { missing-pop-label } { \g_@@_hook_curr_name_tl } \tl_gset_eq:NN \g_@@_hook_curr_name_tl \l_@@_return_tl \@@_end_document_label_check: @@ -4884,7 +4885,7 @@ { \seq_if_empty:NTF \g_@@_name_stack_seq { - \__kernel_msg_error:nnnnn { hooks } { set-top-level } + \msg_error:nnnnn { hooks } { set-top-level } { for } { SetDefaultHookLabel } {#1} } { \exp_args:Nx \@@_set_default_label:n { \@@_make_name:n {#1} } } @@ -4893,16 +4894,11 @@ { \str_if_eq:nnTF {#1} { top-level } { - \__kernel_msg_error:nnnnn { hooks } { set-top-level } + \msg_error:nnnnn { hooks } { set-top-level } { to } { SetDefaultHookLabel } {#1} } { \tl_gset:Nn \g_@@_hook_curr_name_tl {#1} } } -\NewDocumentCommand \DeclareDefaultHookLabel { m } - { - \__kernel_msg_error:nn { hooks } { ddhl-deprecated } - \SetDefaultHookLabel {#1} - } % \end{macrocode} % % The label is only automatically updated with \cs{@onefilewithoptions} @@ -4942,7 +4938,6 @@ % \end{macro} % \end{macro} % \end{macro} -% \end{macro} % % % |