Editing macros in an extracted style file

I have extracted my preamble to a .ts file in order to make my big macro collection a bit more maintainable. But now I am noticing that there is a difference in the way that TeXmacs behaves when I am editing the style file, vs. when I was editing the preamble.

In particular, the macros that I define earlier in the style file are not “understood” later in the file. Here’s an example to illustrate what I mean; suppose I define a macro in the .ts file like so:


Then in another macro definition, I might try to call this definition; I type \con <RET> and what I expect to happen is that it enters something like <con|> with my cursor in the argument slot. Instead, it enters <con>. This behavior makes macro editing very time-consuming in comparison to the really smooth experience of editing within the preamble.

Does anyone have some suggestions for how I can get the best of both worlds? Thank you!

This works for me. If I edit a .ts style file with the following contents:

<assign|test|<macro|x|test <con|<arg|x>>>>

I get the behaviour you describe, with the cursor moving into <con|>.
If I edit this macro in a preamble, I get the same behaviour, given that the con macro is available in the document (i.e. it is either defined in the same preamble or the style file where it is defined is loaded in the document).

How are you editing the second macro? In the same style file or in a preamble?

Hmm, I am editing in the style file… I’m happy to share the style file if that would help with diagnosis: https://gist.github.com/jonsterling/e53c8beed3d656bdf9a253039a390e51

I do not find the definition of con in your style file.

BTW I did not try the style file, but I think that potentially JvdH would like to have a copy (he is looking for style files contributed by users) and it would be also potentially a good contribution to tm-forge

1 Like

Yes, I see. It doesn’t work when I simply open your macros.ts. Some macros become “active” only if I delete everything before the macro itself.

1 Like

Ok, I found it. Then I agree that typing \con <RET> should give <con|> but it does not.

1 Like

I can also reproduce it in other style files. It almost seems as if there is a hard limit of about 10 macros after which this stops working :confused: I suppose it is a bug.


Thanks for checking into this and reproducing it! I’m amazed that nobody has triggered this before…

bug -> bug report


1 Like

I have noticed this before, but I had ignored it. Now I don’t touch my macros that much anymore :slight_smile:

Do we have a bug report for this? @jonsterling @jeroen ?

For reference:

1 Like