I’m trying to create a small interactive elisp function in order to quickly display a layout suitable for answering a Stackoverflow question about R. The idea is to open a temporary R file, and launch an R session associated to it in another frame.
So far I wrote this very simple thing :
(defun jb-so ()
"Start R for StackOverflow layout"
(interactive)
(find-file "/tmp/so.R")
(new-frame)
(R))
It’s almost ok except for two details :
- There’s a prompt to confirm that I want to launch the R session in
/tmp. Is there a way to accept it automatically ? - The session is called
*R*by default, but I’d like to give it a specific name, such as*RSo*in order to avoid conflicts with other running or future sessions. Is there a way to do it directly from the function ?
Thanks in advance !
There are plenty of options that ess respects on startup. So emacs dynamic scope really helps here:
Note that this will work only in the recent versions of ESS that provide the facility to set custom names for process buffers (see
ess-gen-proc-buffer-name-function). You can also rename inferior buffers with M-xrename-buffer.