[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Request for Features in DocTeX mode
From: |
Arash Esbati |
Subject: |
Re: Request for Features in DocTeX mode |
Date: |
Wed, 29 Mar 2023 09:41:23 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Jan Braun <Jan.Braun@klein-gallien.org> writes:
> Thank you, I had forgotten about the % sign. So with refTeX you
> can get along/work around.
>
> But for pure AUCTeX, this seems not be possible?
No, I'm afraid not. AUCTeX's parser ignores stuff which is commented,
AFAIU.
> This is a snippet from the DTX file with an indentation as it
> should be.
>
> % \begin{macro}{\@@_set_option_defaults:}
> % \TestFiles{options}
> % \UnitTested
> % Diese Funktion sorgt dafür, dass zu Beginn einer Aktion, alle
> % Optionen auf die normalen Standardwerte zurück gesetzt werden.
> % \begin{macrocode}
> \cs_new:Npn \@@_set_option_defaults:
> {
> \tl_gset:Nn \g_@@_handle_code_tl {U}
> % \end{macrocode}
> % Wenn es sich um einen DIN- oder One"=Din"=Beschlag handelt,
> % dann ist der Default für den Abstand nicht \enquote{00},
> % sondern \enquote{SH}.
> % \begin{macrocode}
> \str_case_e:nn
> \l_@@_bracket_type_tl
> {
> { xs } { \tl_gset:Nn \g_@@_distance_code_tl {00} }
> { one } { \tl_gset:Nn \g_@@_distance_code_tl {00} }
> { xsdin } { \tl_gset:Nn \g_@@_distance_code_tl {SH} }
> { onedin } { \tl_gset:Nn \g_@@_distance_code_tl {SH} }
> }
> % \end{macrocode}
> % Alle anderen Parameter werden wie üblich gesetzt.
> % \begin{macrocode}
> \tl_gset:Nn \g_@@_material_code_tl {IM}
> \tl_gset:Nn \g_@@_readercolor_code_tl {B}
> \tl_gset:Nn \g_@@_thickness_code_tl {-}
> \tl_gset:Nn \g_@@_shanksize_code_tl {8}
> \tl_gset:Nn \g_@@_sealing_code_tl {}
> \tl_gset:Nn \g_@@_reinforcement_code_tl {}
> }
> % \end{macrocode}
> % \end{macro}
Ok, I see what you mean. AUCTeX's indentation isn't smart enough to
understand code which is spread over multiple macrocode environments.
> After having tested the code to work and to deliver the desired
> results, I decide to insert a piece of documentation between
> \tl_gset:Nn and \str_case_e:nn (or wherever you prefer). I type
> C-c C-e macrocode RET and will get this result:
>
> % \begin{macrocode}
> \cs_new:Npn \_@@_set_option_defaults:
> {
> \tl_gset:Nn \g_@@_handle_code_tl {U}
> % \begin{macrocode}
> @
> % \end{macrocode}
> \str_case_e:nn
> \l_@@_bracket_type_tl
> {
> …
> }
> }
> % \end{macrocode}
Why not following David's advice and using `LaTeX-close-environment'?
,----[ C-h f LaTeX-close-environment RET ]
| LaTeX-close-environment is an interactive native-compiled Lisp
| function in ‘latex.el’.
|
| (LaTeX-close-environment &optional REOPEN)
|
| Create an \end{...} to match the current environment.
| With prefix-argument, reopen environment afterwards.
`----
> It depends on how often and how many guards you insert into your
> code.
Patches welcome.
Best, Arash