On Tue, Oct 2, 2012 at 6:29 PM, Massimiliano Gubinelli < [email protected]> wrote:
> Hi, > > >>> However, you have the choice of redefining your nf-chunk macro to set > an > >>> environment variable (say, "current-nf-chunk" to the value you want, > then > >>> read that variable at any point in your document to decide where you > are. > >>> > >> > >> Oh, yes - that is much better! > > > > I tried to implement that, but the environment variable (which I read > > with (get-env ..., and set with <assign|, and defined with <new-env| ) > > ) > > is set to the name of the nf-chunk only within that chunk, whereas I'd > > like to set a variable that will have > > that value in the chunk, or after the chunk, until we hit the next > > chunk. Is that possible? > > > What I meant is to <assign> the variable then use it with <value>. You don't want to define a new environment, but simply a variable, so the calls to new-env and get-env are not needed. > this seems to me a bad idea (even if possible). I think that if you need > that capability for editing then it should be implemented by looking at the > document tree and finding the previous instance of the macro. If the > capability is needed for the document maybe you can use the label > mechanism, since iirc when you redefine a label it take the last value so > that when you use reference it will update it correctly (maybe). AFAIK it's perfectly possible and every time you assign the variable a new value it's overwritten. I see no problem editing or shifting around chunks... (?) I recently wrote a simple macro to have different short section titles in the TOC and used exactly this technique (after trying in scheme with <extern> etc. and failing). I'm attaching the file (I hope it's the right one, it was more than a month ago), but don't expect to work it flawlessly... Best, -- Miguel.
toc.tm
Description: Binary data
_______________________________________________ Texmacs-dev mailing list [email protected] https://lists.gnu.org/mailman/listinfo/texmacs-dev
