$ME macro tag
Posted: Thu Aug 21, 2008 3:01 pm
I'm confused about using $ME in a particular situation. I'd like to write a macro to extract compile switches from a text file and run that macro via $ME from the compile command line. The macro would simply return a string with the necessary compile command line switches. Use of $ME would cause the switches to be substituted on the command line.
Is this a valid use case for $ME, or is $ME only useful in a template?
I'm having trouble getting a proof of concept of this to work. I've written a simple macro that returns a string literal. I then wrote another simple macro that uses macro_tag("$ME<testmacro.lua>"). Finally, I switch to another (empty) document. When I execute the second macro, I get an error on the status line "Database is currently lock. Please try again later!".
Am I doing something wrong or misunderstanding what $ME does? I realize I could write a macro to build the command line, use system to run the compile and hook it to F10, but somehow this seems preferable. This started off as an experiment to figure out how $ME would deal with multiple return values, but it appears now that the return values aren't what's important, only what it does to the current document.
Is this a valid use case for $ME, or is $ME only useful in a template?
I'm having trouble getting a proof of concept of this to work. I've written a simple macro that returns a string literal. I then wrote another simple macro that uses macro_tag("$ME<testmacro.lua>"). Finally, I switch to another (empty) document. When I execute the second macro, I get an error on the status line "Database is currently lock. Please try again later!".
Am I doing something wrong or misunderstanding what $ME does? I realize I could write a macro to build the command line, use system to run the compile and hook it to F10, but somehow this seems preferable. This started off as an experiment to figure out how $ME would deal with multiple return values, but it appears now that the return values aren't what's important, only what it does to the current document.