[ESS] Sending keystrokes to Emacs & ESS at startup

Erik Iverson eriki at ccbr.umn.edu
Wed May 12 03:37:44 CEST 2010


david.luckett at industry.nsw.gov.au wrote:
> I'd like to be able to automatically send or pass some keystrokes to Emacs 
> and ESS at start-up.
> It's not clear to me from the documentation how to do this, either in the 
> .emacs init file, or in
> a Lisp function called from the command line.
> 
> The (simple) keystrokes are:
> C-x 2                         (split-screen)
> C-x o                        (other-window)
> M-x R <RET>        invoke R
> <RET>                     accept default directory - in minibuffer
> 
> Can the keystrokes themselves be passed or only their primitive functions?

You should just call the emacs lisp functions!  That's why they are there, you 
are using Emacs as it is intended to be used.  All you have to do is put the 
commands in your .emacs file (Warning, this can become very addicting!).  What 
OS are you on?  That will determine where your .emacs has to go.  Say you're on 
Linux or any UNIX-like OS, then you can just create a .emacs in your home 
directory.

In my version of Emacs (GNU Emacs 23), C-x 2:

C-x 2 runs the command split-window-vertically, which is an
interactive compiled Lisp function in `window.el'.

So I'm not sure what 'split-screen' is?

Try very simple things first, put one function call in your .emacs, and start it 
up, see what happens.

I have something very similar to the following in my .emacs

   (delete-other-windows)
   (split-window-horizontally)
   (other-window 1)
   (R)

Mine is actually wrapped up in a function, so I can, within Emacs, do M-x myR 
<RET> and it will do everything I want to happen to get an R session in usable 
format.

Good luck!



More information about the ESS-help mailing list