texmacs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Texmacs-dev] 2nd try: (Semi)automatic recalculations of plugin sess


From: Henri Lesourd
Subject: Re: [Texmacs-dev] 2nd try: (Semi)automatic recalculations of plugin session?
Date: Tue, 07 Mar 2006 11:44:48 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02

Stephan Mucha wrote:

Same question, other mailing list, maybe I have more luck on the
dev-list:

Is there any way (or a workaround with guile or whatever) to achieve
automatic recalculation? A manual command that forces recalculation of
all output fields would be perfect too.

Maybe someone can tell me (Joris?) what had do be done to achieve
this? Is the mutator concept able to do this? Maybe with some extra
efforts, hopefully only in Scheme?

The simplest way (i.e. a way that can be done and understood using
only usual concepts of programming) is to traverse the tree that
constitutes the session in the document. As far as markup is concerned,
your session looks something like that, in TeXmacs markup :
[[
<with|prog-language|LANG|prog-session|SESSION|
  <session|
     <input|PROMPT|INPUT1>
<output|OUTPUT1> <input|PROMPT|INPUT2>
     <output|OUTPUT2>
     ................
  >>
]]

This being known, using the TeXmacs tree API, it should be fairly
easy to write a Scheme program that traverses the <session|...>
tree, collects all the INPUT(i), and also the positions of all
the OUTPUT(i).

As soon as you have it, what remains to be done is (informally) :
[[
  foreach INPUT(i)
     OUTPUT(i) := call-plugin (INPUT(i))
]]

In practice, there is a function called (plugin-eval) that
does exactly the job of calling the plugin and getting the
result, its prototype is :
[[
  (plugin-eval NAME SESSION INPUT)
]]

e.g. : (plugin-eval "macaulay2" "default" "p1 = (x+y)^5")

On the other-hand, using the TeXmacs tree API in Scheme, the ':=' can
be performed using (path-assign).


Best, Henri

P.S. : Feel free to raise other questions
      if something remains unclear.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]