[ESS] ESS works but key bindings don't

Brad Friedman friedm at MCB.harvard.edu
Fri Aug 21 17:43:43 CEST 2009


On Fri, 2009-08-21 at 08:58 +0100, Stephen Eglen wrote:
> Hi Brad,
> 
> > to my .emacs file. If I open a .R script in emacs I can start the R
> > process with "M-x R" but "C-c C-n" doesn't seem to work to send lines or
> > regions to the R process. It just says "C-c C-n in undefined" in the
> > minibuffer. I can send lines the hard way using M-x
> > ess-eval-line-and-step. Does anyone know what I might be doing wrong?
> 
> sounds a little odd. when your cursor ('point' in emacs terminology) is
> in a file.R buffer, type 'C-h m'.  This brings up a help buffer,  which
> should look like:
> 
> ----------------------------------------------------------------------
> Enabled minor modes: ...
> 
> (Information about these minor modes follows the major mode info.)
> 
> ESS[S] mode:
> Major mode for editing ESS source.
> Optional arg ALIST describes how to customize the editing mode.
> Optional arg PROC-NAME is name of associated inferior process.
> 
> ...
> 
> ----------------------------------------------------------------------
> 
> then look to see what keybindings are listed in that help buffer
> 
> Stephen

Thanks for your help. I figured out part of the problem. My R script
begins with the line 

#!/bin/sh /home/baf/lib/R/hashbang

(hashbang is my modified version of Greg Louis's setR script that makes
R scripts executable from the command line:
http://www.bgl.nu/~glouis/setR.html)

This confuses emacs into thinking it's a shell script, even though the
filename ends in .R. It didn't confuse earlier versions of emacs and ESS
that I have used. If I add the following as the second line of the
script it tells emacs to use ESS mode after all.

# -*-ESS-*-

This brings me half way there. Now, if I manually start an R process
with M-x R, I can use C-c C-n and other key bindings. However, syntax
highlighting doesn't work, and when I initially open the file I get the
following error in the minibuffer:

File mode specification error: (wrong-type-argument syntax-table-p nil)

If I do C-h m now I see I am in ESS[Initial] mode, whereas opening a
normal (non-hashbang) R script gives me ESS[S] mode.

Any other ideas to force it to start ESS mode normally?

Thanks,

Brad



More information about the ESS-help mailing list