Pop-up windows in R & Emacs
Oh yes it can...
In ESS, do this:
png(file="tmp.png")
plot(1:10)
dev.off()
# [[tmp.png]]
Nothing. Now do ESC X iimage-mode (yes, two i's there).
This puts your buffer into iimage minor mode, it should spot the [[tmp.png]] and load your image in there. This should be easily automatable. This is the first time I've discovered this for myself so there's probably better ways to do it.
There's clearly been some chatter on the ESS list about this:
https://stat.ethz.ch/pipermail/ess-help/2009-August/005474.html
but I am surprised its not in the ESS core yet...
This is unlikely to be the solution you are looking for as it involves turning Emacs into a window manager (works for Linux and MacOS): the package EXWM (Emacs X Window Manager) is a full-featured tiling window manager that turns all X windows into Emacs buffers.
Here is an example of what that would look like (note the R Graphics window on the right which is now an Emacs buffer):
This allows you to use Emacs keybindings, configuration, etc. to all X windows.
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.
try this:
X11() # starts a X11 graphics device
plot(c(1:10),c(1:10))
savePlot(filename = "try_save_X11.png",type = c("png"))