[ESS] Automating launch of R session and splitting into 2 buffers

Frank E Harrell Jr f.harrell at vanderbilt.edu
Sun Sep 7 18:06:09 CEST 2008


I am looking for a good way to specify something in .emacs for Emacs 
such that when I have a .r source file opened, hitting Esc R will split 
the window into two buffers and start the R process in the lower buffer.
I find myself always doing Cntl-X-2 and then having to put foo.r back 
into the upper buffer.

Tony Rossini outlined the following:

(defun myR ()
   (interactive)
   (if (= (major-mode 'current-buffer) 'R-mode)
            (split-window))
   (R)
   (put-cursor-other-window))

which would be invoked with M-x myR.  If anyone knows how to complete 
that code including the spellings of the correct function calls, or has 
another idea I'd appreciate hearing about it.  I have already put (setq 
ess-ask-for-ess-directory nil) in my .emacs to bypass the selection of 
the working directory.

Thanks
Frank

-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University




More information about the ESS-help mailing list