Skip to Content.
Sympa Menu

texmacs-users - crazy compound condumdrum

Subject: mailing-list for TeXmacs Users

List archive

crazy compound condumdrum


Chronological Thread 
  • From: Sam Liddicott <address@hidden>
  • To: TeXmacs user list <address@hidden>
  • Subject: crazy compound condumdrum
  • Date: Sun, 11 Feb 2024 14:42:13 +0000

Using pre-built texmacs 2.1.2 deb for ubuntu focal fossa.

The problem relates to the computation of the name of the macro to use in <compound|macro|arg|...>

It seems that if macro refers to a macro that uses a <with|...> var, it breaks <compund>

This code works fine:

<assign|raize|<\macro|x>
  <quasi|<compound|<if|<provides|<merge|raize-|<get-label|<arg|x>>>>|<merge|raize-|<get-label|<arg|x>>>|identity>|<unquote*|<arg|x>>>>
</macro>>

If it finds a macro matching raize-<label of tag> then it applies that, otherwise it applies identity (which does nothing). It allows me to have behaviour dependent on argument type. (I want to treat document tag differently to contact or string etc)

It has repeated code, but I can't get a re-factor to work using a get-razor function to compute the name of the macro.

<assign|get-razor|<macro|x|<with|razor|<merge|raize-|<get-label|<arg|x>>>|<if|<provides|<value|razor>>|<value|razor>|identity>>>>

This function uses temporary variables and returns the name of the macro that should be executed, and I intend to invoke it from this:

<assign|raize|<\macro|x>
  <quasi|<compound|<get-razor|<arg|x>>|<unquote*|<arg|x>>>>
</macro>>

But it merely emits the name of the function, instead of invoking it with the unquoted arg x

e.g. the document just shows the text: razor-document, instead of evaluating razor-document as it did before.

Strangely this works as get-razor but with repeated text:

<assign|get-razor|<macro|x|<if|<provides|<merge|raize-|<get-label|<arg|x>>>>|<merge|raize-|<get-label|<arg|x>>>|identity>>>

But this does not -- it has the same verbose logic but with a surplus <with|razor computation which seems to make all the different

<assign|get-razor|<macro|x|<with|razor|<merge|raize-|<get-label|<arg|x>>>|<if|<provides|<merge|raize-|<get-label|<arg|x>>>>|<merge|raize-|<get-label|<arg|x>>>|identity>>>>

And yet if I move the computation entirely outside of the with-clause so that with has empty action, it still doesn't work:

<assign|get-razor|<macro|x|<with|razor|<merge|raize-|<get-label|<arg|x>>>|><if|<provides|<merge|raize-|<get-label|<arg|x>>>>|<merge|raize-|<get-label|<arg|x>>>|identity>>>

But if I remove the with-clause (and it's empty clause) it works again. If I replace with with-clause to be unrelated, it stops it working.

<assign|get-razor|<macro|x|<with|dummy||><if|<provides|<merge|raize-|<get-label|<arg|x>>>>|<merge|raize-|<get-label|<arg|x>>>|identity>>>

How did that dummy with-clause stop compound in the caller from working?

I've attached the demo-compound.tm (don't get concerned about the raize-document macro, it's part of a longer series to remove extraneous document tag wrapping that seems to happen each time a document parameter is passed).


<TeXmacs|2.1.2>

<style|<tuple|generic|british>>

<\body>
  <assign|raize-document|<macro|x|[[RAIZE-<get-label|<arg|x>>[<map-args|identity|tuple|x>]
  <arg|x>]]>>

  <assign|get-razor|<macro|x|<with|dummy||><if|<provides|<merge|raize-|<get-label|<arg|x>>>>|<merge|raize-|<get-label|<arg|x>>>|identity>>>

  <assign|raize|<\macro|x>
    [<quasi|<compound|<get-razor|<arg|x>>|<unquote*|<arg|x>>>>]
  </macro>>

  With the dummy, just the name of the macro to apply

  <\raize>
    line 1

    line 2
  </raize>

  Without the dummy, applies the macro:

  <assign|get-razor|<macro|x|<if|<provides|<merge|raize-|<get-label|<arg|x>>>>|<merge|raize-|<get-label|<arg|x>>>|identity>>>

  <\raize>
    line 1

    line 2
  </raize>
</body>

<\initial>
  <\collection>
    <associate|page-medium|paper>
    <associate|preamble|true>
  </collection>
</initial>


  • crazy compound condumdrum, Sam Liddicott, 02/11/2024

Archive powered by MHonArc 2.6.24.

Top of Page