On Tue, Sep 7, 2010 at 11:34 AM, Simon Urbanek
<simon.urba...@r-project.org>wrote:

>
> On Sep 7, 2010, at 2:21 PM, ghostwheel wrote:
>
> >
> > Another message about the R to TeXmacs interface.
> >
> > 1. Graphics
> > The TeXmacs interface allows the user to directly insert graphics into
> the
> > session.
> >
> > Since I am not very familiar with programming for R, I implemented the
> > interaction with graphics in a very primitive way. It was two modes of
> > working: with X11, and without (for example when working remotely through
> > ssh without forwarding X11).
> >
> > In both cases the user has to invoke a command, v(), in order to insert
> the
> > current graph into the buffer at the current place.
> >
> > With X11, the way it works is that when v() is invoked I call
> recordPlot(),
> > then open a postscript file, then replayPlot(), and then close the
> > postscript file and insert it into the session.
> >
> > Without X11, I open a postscript file ahead of time, then when v() is
> > called, I close it, and insert it into the session, and then open a new
> > postscript file.
> >
> > Obviously quite primitive.I think ideally would be if everything was
> > transparent to the user - the user does a plot, and the plot is inserted
> > into the buffer right away, and later, updates to the same plot update
> the
> > original plot where it is. But to be able to do that I need to be able to
> > generate the postscript file of the current plot, and be notified somehow
> > whenever the plot changes.
> >
> > Is all that possible? Is there a better way to implement this all?
> >
>
> I don't know the mechanics of the actual "inserting" in TeXmac but it would
> be trivial to simply create a copy of the plot as EPS (or whatever is
> needed) at the time of insertion. See dev.copy2eps() for a function that
> does exactly that.
>
>
>
> > 2. Libraries
> >
> > A remotely related question is this: the interface with TeXmacs generates
> > menus that depend on the currently loaded libraries.
>
> Libraries are not "loaded" (see .libPath() for handling libraries) - but
> chances are that you meant packages...
>
>
> > I'd like to be able to
> > update the menus whenever a new library is loaded. Is there a possibility
> to
> > have a function called whenever this happens? Or would it be advisable to
> > change the global 'library' function?
> >
>
> I would strongly advise against the latter. A reasonably simple way would
> be to check the search path - if it changed a package has been loaded. A
> natural place to do such check would be in a top-level task handler for
> example.
>
>
Another possibility would be the setHook() function.

Michael

Cheers,
> Simon
>
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to