Loading Scheme functions

(adapting this from the message I posted in the mailing list earlier today - “A set of Scheme functions and TeXmacs macros for formatting references”)

I do not understand how to load automatically Scheme functions into a TeXmacs document, which then I will use with the “extern” macro command. At the moment I do it by calling them in a Scheme session (I can placed them in files and load those, but I still have to do it in a Scheme session); this is not a good thing for a document, where only what the user writes must appear, but I do not know how to do the automatic loading. Suggestions?

(Adapting from the message I wrote in the mailing list).

I have been able to do the automatic loading. It is described in the help files, it took me a bit of time to follow the thread.

The right instruction is <use-module|([dir1 [dir2 … dirn]] filename)> where the Scheme list indicates the path, which as far as I understood must be a subpath of one of the paths that TeXmacs know about (~/.TeXmacs/progs is one of them, so if dir1 is a subdirectory of ~/.TeXmacs/progs, TeXmacs will find and load the Scheme files).

The style file itself can be put in the “user” directory of TeXmacs, that is again ~/.TeXmacs, under /packages, and it will appear in the “Document->Style-> Add package” menu.

I have not yet understood how to execute a macro only once inside TeXmacs (there is an update mechanism that I do not understand but I guess it is the general update mechanism of TeXmacs). Sometimes it is useful to have a macro run only once; the case I have in mind is if I use to update variables which I use elsewhere (I know that this may be against the principle of functional programming that data are immutable, but on the one hand I do not know the principle well … and on the other I do not use it at least for the moment :slight_smile: ). I If anyone has a suggestion, thanks in advance.