I've found that I can't un-render an inactive& block because <arg|x> is
rendered as x, in a different colour, and picking out the
with|...|color|brown|... is more hacky than I want to get.

In scheme mode "arg" is emitted but so is lots of other text that is hard
to filter out.

So I'm back to making render-inactive work

Sam

On Thu, May 24, 2012 at 8:25 AM, Sam Liddicott <[email protected]> wrote:

> I thought I'd try implementing closures in texmacs macros instead.
>
> I want a macro that can be provided a list of variables and produce a new
> macro that is a "with" block of those variables, and then evaluates the
> parameters.
>
> The produced macro would be of this form (although possibly I would use
> eval instead of compound):
> <xmacro|x|<with|...|...|<quasi|<compound|<unquote*|<quote-arg|x>>>>>>
>
> It seems it would work as this example shows:
> <xmacro|x|<with|a|AHA|<quasi|<compound|<unquote*|<quote-arg|x>>>>>>
>
> The producing macro must fill in ... according to the arguments it is
> passed, indicating the variables and their values to be preserved.
>
> My first attempt at the constructing macro is:
>
> <assign|enclose|<xmacro|w|<quasi|<xmacro|x|<quasi|<with|<unquote*|<quote-arg|w>>|<compound|<unquote*|<quote-arg|x>>>>>>>>>
>
> Note the nested quasi. I need the first unquote* to be expanded by the
> first quasi, and the second quasi to be preserved along with the second
> unquote*, but nesting makes this hard, because the first quasi encloses the
> second quasi which encloses both unquote*
>
>
> <assign|enclose|<xmacro|w|<quasi|<xmacro|x|<with|<unquote*|<quote-arg|w>>|<quote|<quasi|<compound|<unquote*|<quote-arg|x>>>>>>>>>>
>
> otherwise the idea works as this hard-wired version shows:
> <assign|enclose|<xmacro|w|<quasi|<xmacro|x|<with|<unquote*|<quote-arg|w>>|Hello
>  <value|a>
> there>>>>>
>
> That hard wired version fixes the body, and can be executed with:
> <assign|tc|<enclose|a|HEE HEE>>
> <tc>
>
> I tried deferring the body execution into an xcompound macro, like this:
> <assign|xcompound|<xmacro|x|<quasi|<compound|<unquote*|<quote-arg|x>>>>>>
>
>
> <assign|enclose|<xmacro|w|<quasi|<xmacro|x|<with|<unquote*|<quote-arg|w>>|<xcompound|<arg|x>>>>>>>
>
> But then texmacs just segfaults. I guess to call xcompound still needs to
> be using quasi unquote* quote-arg
>
> Can anyone help me preserve SECOND quasi and unquote* in the emitted macro
> while still allowing the FIRST unquote* in the with block to be expanded?
>
> Sam
>
_______________________________________________
Texmacs-dev mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/texmacs-dev

Reply via email to