diff --git a/base/ltcmd.dtx b/base/ltcmd.dtx index 05a87b9ab..3927dc29e 100644 --- a/base/ltcmd.dtx +++ b/base/ltcmd.dtx @@ -2226,10 +2226,9 @@ % we'll just print stuff to the terminal. % % \begin{macro}{\@@_show:N} -% This macro just branches to the proper copying command by using -% \cs{@@_cmd_type_cases:NnnnF}. The copying command takes the names -% of the commands to be copied to and from, and the actual commands -% as its four arguments. +% This macro just branches to the proper showing command by using +% \cs{@@_cmd_type_cases:NnnnF}. The showing command takes the command +% to be shown as argument. % \begin{macrocode} \cs_new_protected:Npn \@@_show:N #1 { @@ -2246,7 +2245,21 @@ \int_set:Nn \tex_escapechar:D { \int_use:N \tex_escapechar:D } } } +% \end{macrocode} +% \end{macro} % +% \begin{macro}{ +% \@@_show_command:N, +% \@@_show_command:NnNNwN, +% \@@_show_expandable:N, +% \@@_show_expandable:NnNNNNnN, +% \@@_show_command_aux:nNNn, +% \@@_show_environment:N, +% } +% These commands just expand the command once to reveal its innards, +% then pass the type of command, the control sequence, the signature, +% and the code macro to \cs{@@_show_command_aux:nNNn}. +% \begin{macrocode} \cs_new_protected:Npn \@@_show_command:N #1 { \exp_after:wN \@@_show_command:NnNNwN #1 \q_@@ #1 } \cs_new_protected:Npn \@@_show_command:NnNNwN #1 #2 #3 #4 #5 \q_@@ #6 @@ -2255,19 +2268,26 @@ { \exp_after:wN \@@_show_expandable:NnNNNNnN #1 #1 } \cs_new_protected:Npn \@@_show_expandable:NnNNNNnN #1 #2 #3 #4 #5 #6 #7 #8 { \@@_show_command_aux:nNNn { expandable~document~command } #8 #5 {#2} } +% \end{macrocode} +% +% And now just pretty-print everything: +% \begin{macrocode} \cs_new_protected:Npn \@@_show_command_aux:nNNn #1 #2 #3 #4 { - \iow_term:x { > ~ \token_to_str:N #2 = #1: } - \iow_term:x { > ~ signature = \tl_to_str:n {#4} . } \iow_term:x { + > ~ \token_to_str:N #2 = #1: \iow_newline: + > ~ signature = \tl_to_str:n {#4} . \iow_newline: > ~ \token_to_str:N #3 ~ ( \int_eval:n { \exp_args:Nf \str_count:n { \cs_argument_spec:N #3 } / 2 } ~ parameters ) : \cs_replacement_spec:N #3 } } +% \end{macrocode} % +% But complain when used with an environment: +% \begin{macrocode} \cs_new_protected:Npn \@@_show_environment:N #1 { \msg_error:nn { cmd } { env-show } } \msg_new:nnn { cmd } { env-show }