On May 15, 2009, at 5:09 PM, Steve Revilak wrote:

marc_schwartz> Can you describe the problems that you are having with
marc_schwartz> Emacs/ESS?
marc_schwartz> marc_schwartz> I have played around with the editor in R.app on OSX,
marc_schwartz> but I find the Emacs/ESS combination to be superior. In
marc_schwartz> fact, I build Emacs 23 from CVS to have a 'real' Emacs
marc_schwartz> on OSX, as opposed to the quirky behavior of Aquamacs.

I'd like to ask a tangental question.

I'm running Mac OS X 10.4.11 on a G5 PPC, and I also build Emacs from
source.

GNU Emacs 22.3.1 (powerpc-apple-darwin8.11.0, Carbon Version 1.6.0) of 2009-03-28 on spud.local

I've recently started experimenting with ESS version 5.3.11, which I'm
using in conjunction with R 2.9.0.  About half of my time is spent in
R.app (console and/or built-in editor), and the other half is spent
with ESS.

One thing I miss with ESS is quartz.save().  From ESS, I can open a
quartz() device and plot to it, but quartz.save() gives the error
'could not find function "quartz.save"'.  Here's an example:

  # output starting from M-x R

  R version 2.9.0 (2009-04-17)
  Copyright (C) 2009 The R Foundation for Statistical Computing
  ISBN 3-900051-07-0

  R is free software and comes with ABSOLUTELY NO WARRANTY.
  You are welcome to redistribute it under certain conditions.
  Type 'license()' or 'licence()' for distribution details.

    Natural language support but running in an English locale

  R is a collaborative project with many contributors.
  Type 'contributors()' for more information and
  'citation()' on how to cite R or R packages in publications.

  Type 'demo()' for some demos, 'help()' for on-line help, or
  'help.start()' for an HTML browser interface to help.
  Type 'q()' to quit R.

  [Previously saved workspace restored]

  > options(STERM='iESS', editor='emacsclient')
  > quartz();
  > plot(1:10, type="l")
  > quartz.save("foo.png");
  Error: could not find function "quartz.save"

dev.copy() works, though.

 > dev.copy(device=png, filename="foo.png")
 quartz_off_screen
                 3
 > dev.off()
 quartz
      2

Is there a way to have quartz.save() work from within ESS?


The function quart.save() is defined in a file called GUI-tools.R which is part of R.app and not part of R itself. Thus, it would not be available by default outside of the OSX GUI.

You can see the file here:

  https://svn.r-project.org/R-packages/trunk/Mac-GUI/GUI-tools.R

However, trying it here, if you have R.app installed, you can use:

   source("/Applications/R.app/Contents/Resources/GUI-tools.R")

to make the function available outside of the GUI.

Running R from a regular Terminal:

> source("/Applications/R.app/Contents/Resources/GUI-tools.R")
[R.app GUI  () i386-apple-darwin9.7.0]

> plot(1:10)
> quartz.save("plot.png")
quartz
     2

> quartz.save("plot.pdf", type = "pdf")
quartz
     2


I tried it from Emacs/ESS and as expected, it works there as well.

HTH,

Marc Schwartz

_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Reply via email to