remacsess

Pop-up windows in R & Emacs


I am using ESS in order to stay in Emacs when working with R. Whenever I create a plot a new pop-up appears with the graph. This new window seems to be a part of the R process called inside Emacs. As such the new window is not part of the buffer-list and seems to lie outside the Emacs environment.

Can a new window created by R, containing e.g. graphs called by plot() or respective functions in ggplot2/lattice, be forced to stay inside the Emacs environment? So that the plot is available as a new buffer.

Thanks!


Solution

  • No, sorry, it cannot. Emacs buffers are text. Graphics windows are graphics devices.

    But you can do this yourself. Before plotting, or even at the begin of a session, say

    pdf(file="/tmp/myplotfile.pdf")
    

    and now plots will go there. You can then open the pdf file in Emacs, and recent versions include a pdf preview inside Emacs (at least on my Linux boxen, not sure if I needed extra modes for that). That would come close to your requirements.