There are plenty of options that ess respects on startup. So emacs dynamic scope really helps here:
(defun jb-so ()
"Start R for StackOverflow layout"
(interactive)
(find-file "/tmp/so.R")
(let ((ess-ask-for-ess-directory nil)
(inferior-ess-same-window nil)
(ess-gen-proc-buffer-name-function (lambda (nm) "*RSO*")))
(R)
(pop-to-buffer "so.R")))
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-x rename-buffer
.