* [NTG-context] How to easily comment out/uncomment multiple lines all at once?
[not found] <431378854.1243657.1745779357147.ref@mail.yahoo.com>
@ 2025-04-27 18:42 ` Joel via ntg-context
2025-04-27 18:54 ` [NTG-context] " Hans Hagen via ntg-context
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Joel via ntg-context @ 2025-04-27 18:42 UTC (permalink / raw)
To: Mailing List for ConTeXt Users; +Cc: Joel
[-- Attachment #1.1: Type: text/plain, Size: 1171 bytes --]
I have a single *.tex file that I have setup, here's a simple minimal example:
\define\macroA{This outputs some stuff.}
\define\macroB{\input knuth }
\define\macroC{This outputs other stuff.}
\define\macroD{This outputs other stuff.}
\define\macroE{This outputs other stuff.}
\define[2]\macroF{This is text #1 and #2.}
\define\macroG{This outputs other stuff.}
\define\macroH{This outputs other stuff.}
\starttext
\macroA%\macroB%\macroC%\macroD%\macroE
%%% some more code
\macroF{a}{b}\macroG\macroH
\stoptext
Normally, I will compile it as above, so only two of the macros actually appear. But sometimes, for testing purposes, I want to make sure my code is functioning good, so I will go an un-comment all of the macros, and then compile, and it basically does a test, making sure all of the macros in my code function perfectly. When testing, it looks like this:
\starttext
\macroA\macroB\macroC\macroD\macroE
%%% some more code
\macroF{a}{b}\macroG\macroH
\stoptext
Because the actual file is quite large, commenting and un-commenting the lines takes a long time, and can lead to mistakes. Is there any simpler way to easily switch between the two versions?
--Joel
[-- Attachment #1.2: Type: text/html, Size: 3783 bytes --]
[-- Attachment #2: Type: text/plain, Size: 511 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* [NTG-context] Re: How to easily comment out/uncomment multiple lines all at once?
2025-04-27 18:42 ` [NTG-context] How to easily comment out/uncomment multiple lines all at once? Joel via ntg-context
@ 2025-04-27 18:54 ` Hans Hagen via ntg-context
2025-04-27 18:58 ` mf
2025-04-27 19:10 ` Pablo Rodriguez via ntg-context
2 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen via ntg-context @ 2025-04-27 18:54 UTC (permalink / raw)
To: ntg-context; +Cc: Hans Hagen
On 4/27/2025 8:42 PM, Joel via ntg-context wrote:
> I have a single *.tex file that I have setup, here's a simple minimal
> example:
>
> \define\macroA{This outputs some stuff.}
>
> \define\macroB{\input knuth }
>
> \define\macroC{This outputs other stuff.}
>
> \define\macroD{This outputs other stuff.}
>
> \define\macroE{This outputs other stuff.}
>
> \define[2]\macroF{This is text #1 and #2.}
>
> \define\macroG{This outputs other stuff.}
>
> \define\macroH{This outputs other stuff.}
>
> \starttext
>
> \macroA
> %\macroB
> %\macroC
> %\macroD
> %\macroE
>
> %%% some more code
>
> \macroF{a}{b}
> \macroG
> \macroH
>
> \stoptext
>
> Normally, I will compile it as above, so only two of the macros actually
> appear. But sometimes, for testing purposes, I want to make sure my code
> is functioning good, so I will go an un-comment all of the macros, and
> then compile, and it basically does a test, making sure all of the
> macros in my code function perfectly. When testing, it looks like this:
>
> \starttext
>
> \macroA
> \macroB
> \macroC
> \macroD
> \macroE
>
> %%% some more code
>
> \macroF{a}{b}
> \macroG
> \macroH
>
> \stoptext
>
>
> Because the actual file is quite large, commenting and un-commenting the
> lines takes a long time, and can lead to mistakes. Is there any simpler
> way to easily switch between the two versions?
Search for "modes" ...
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* [NTG-context] Re: How to easily comment out/uncomment multiple lines all at once?
2025-04-27 18:42 ` [NTG-context] How to easily comment out/uncomment multiple lines all at once? Joel via ntg-context
2025-04-27 18:54 ` [NTG-context] " Hans Hagen via ntg-context
@ 2025-04-27 18:58 ` mf
2025-04-27 19:10 ` Pablo Rodriguez via ntg-context
2 siblings, 0 replies; 4+ messages in thread
From: mf @ 2025-04-27 18:58 UTC (permalink / raw)
To: ntg-context
Hello,
you can use modes.
-----------
\definemode[ModeA][keep]
\definemode[ModeB][keep]
% ...
\starttext
\startmode[ModeA]
\macroA
\stopmode
\startmode[ModeB]
\macroB
\stopmode
\stoptext
-----------
Then you type:
context --mode=ModeA yourfile.tex
or
context --mode=ModeB yourfile.tex
If you want to run both \macroA and \macroB,
context --mode=ModeA,ModeB yourfile.tex
You can also use \startnotmode[ModeA] ... \stopnotmode to run something
only when ModeA is not active.
Massi
Il 27/04/25 20:42, Joel via ntg-context ha scritto:
> I have a single *.tex file that I have setup, here's a simple minimal
> example:
>
> \define\macroA{This outputs some stuff.}
>
> \define\macroB{\input knuth }
>
> \define\macroC{This outputs other stuff.}
>
> \define\macroD{This outputs other stuff.}
>
> \define\macroE{This outputs other stuff.}
>
> \define[2]\macroF{This is text #1 and #2.}
>
> \define\macroG{This outputs other stuff.}
>
> \define\macroH{This outputs other stuff.}
>
> \starttext
>
> \macroA
> %\macroB
> %\macroC
> %\macroD
> %\macroE
>
> %%% some more code
>
> \macroF{a}{b}
> \macroG
> \macroH
>
> \stoptext
>
> Normally, I will compile it as above, so only two of the macros actually
> appear. But sometimes, for testing purposes, I want to make sure my code
> is functioning good, so I will go an un-comment all of the macros, and
> then compile, and it basically does a test, making sure all of the
> macros in my code function perfectly. When testing, it looks like this:
>
> \starttext
>
> \macroA
> \macroB
> \macroC
> \macroD
> \macroE
>
> %%% some more code
>
> \macroF{a}{b}
> \macroG
> \macroH
>
> \stoptext
>
>
> Because the actual file is quite large, commenting and un-commenting the
> lines takes a long time, and can lead to mistakes. Is there any simpler
> way to easily switch between the two versions?
>
> --Joel
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* [NTG-context] Re: How to easily comment out/uncomment multiple lines all at once?
2025-04-27 18:42 ` [NTG-context] How to easily comment out/uncomment multiple lines all at once? Joel via ntg-context
2025-04-27 18:54 ` [NTG-context] " Hans Hagen via ntg-context
2025-04-27 18:58 ` mf
@ 2025-04-27 19:10 ` Pablo Rodriguez via ntg-context
2 siblings, 0 replies; 4+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2025-04-27 19:10 UTC (permalink / raw)
To: ntg-context; +Cc: Pablo Rodriguez
On 4/27/25 20:42, Joel via ntg-context wrote:
> [...]
> Because the actual file is quite large, commenting and un-commenting the
> lines takes a long time, and can lead to mistakes. Is there any simpler
> way to easily switch between the two versions?
Hi Joel,
your source (which has \startmode...\stopmode added):
\define\macroA{This outputs some stuff.}
\define\macroB{\input knuth }
\define\macroC{This outputs other stuff.}
\define\macroD{This outputs other stuff.}
\define\macroE{This outputs other stuff.}
\define[2]\macroF{This is text #1 and #2.}
\define\macroG{This outputs other stuff.}
\define\macroH{This outputs other stuff.}
\starttext
\macroA
\startmode[just-checking]
\macroB
\macroC
\macroD
\macroE
some more code
\stopmode
\macroF{a}{b}
\macroG
\macroH
\stoptext
Compile to get the just-checking content with:
context --mode=just-checking source.tex
https://www.pragma-ade.com/general/manuals/mmodes.pdf contains the
documentation and it’s only five pages long (excluding the cover).
Just in case it helps,
Pablo
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-27 19:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <431378854.1243657.1745779357147.ref@mail.yahoo.com>
2025-04-27 18:42 ` [NTG-context] How to easily comment out/uncomment multiple lines all at once? Joel via ntg-context
2025-04-27 18:54 ` [NTG-context] " Hans Hagen via ntg-context
2025-04-27 18:58 ` mf
2025-04-27 19:10 ` Pablo Rodriguez via ntg-context
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).