ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Benjamin Buchmuller via ntg-context <ntg-context@ntg.nl>
To: Hans Hagen <j.hagen@xs4all.nl>
Cc: Benjamin Buchmuller <benjamin.buchmuller@gmail.com>,
	mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: How to make \def accept block or buffer as part of (long) command argument
Date: Sun, 2 Jan 2022 14:14:05 +0100	[thread overview]
Message-ID: <4F07B012-EB6C-4609-BAF0-2852C7CCD8B8@gmail.com> (raw)
In-Reply-To: <77d4adfd-c605-0656-9fea-48d9f40c5651@xs4all.nl>

Thanks, Hans, for the answer, but I'm not sure if I get the point.

While this is possible in ConTeXt:

\startsection[title={My Title}]

\beginMyBlock
bla bla
\endMyBlock

\stopsection

The following won't work (end of file error):

\startMyCommand[optional={Maybe}]

\beginMyBlock
bla bla
\endMyBlock

\stopMyCommand

I had hoped for a simple command/modifier like \pleaseacceptblocks\def\startMyCommand[#1]#2\stopMyCommand  to have #2 work in a similar way. 

But maybe, as Wolfgang stated here (https://www.mail-archive.com/ntg-context@ntg.nl/msg73956.html), buffers and blocks can't be used in commands. (To add: Even when passed as arguments during compilation?)

Many Thanks again!


Benjamin

> On Jan 2, 2022, at 12:19, Hans Hagen <j.hagen@xs4all.nl> wrote:
> 
> On 1/2/2022 11:47 AM, Benjamin Buchmuller via ntg-context wrote:
>> Hi list,
>> I'm playing around with blocks and buffers again, realizing that I cannot use them inbetween a \start...\stop that I defined myself. Apparently, they work between \startsection...\stopsection and the like, so I was wondering how I should define or expand #2 in the MWE below to make TeX happily accept these useful features?
> buffers are stored as-is so no catcode magic stored, contrary to macros
> 
> you can use \setbuffer but that doesn't solve the argument passing
> 
> however, you can nest buffers so you can make other \start\stop commands buffers too and then do some at the start and (look for \defiebuffer) but it quickly becomes messy i think
> 
> 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 / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2022-01-02 13:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.440.1641107345.1172.ntg-context@ntg.nl>
2022-01-02 10:30 ` Dangerous bends symbol in manfnt.afm accidentally chopped by LMTX? Benjamin Buchmuller via ntg-context
2022-01-02 10:47   ` How to make \def accept block or buffer as part of (long) command argument Benjamin Buchmuller via ntg-context
2022-01-02 11:19     ` Hans Hagen via ntg-context
2022-01-02 13:14       ` Benjamin Buchmuller via ntg-context [this message]
2022-01-02 13:43         ` Hans Hagen via ntg-context
2022-01-02 17:06           ` Benjamin Buchmuller via ntg-context
2022-01-02 11:43   ` Dangerous bends symbol in manfnt.afm accidentally chopped by LMTX? Hans Hagen via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F07B012-EB6C-4609-BAF0-2852C7CCD8B8@gmail.com \
    --to=ntg-context@ntg.nl \
    --cc=benjamin.buchmuller@gmail.com \
    --cc=j.hagen@xs4all.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).