2

I am trying to write R scripts in aquamacs, but whenever I type an underscore as part of a variable name "_", the editor automatically changes this to "<-". One answer is to just stop using the underscore, but I'm working with some pre-existing R code, all of which is rife with underscores in the variable names.

How do I stop aquamacs from doing this? I'm using aquamacs 3.0 and OS X 10.7.5.

Thanks!

Spacedman
  • 92,590
  • 12
  • 140
  • 224

2 Answers2

2

Use M-x ess-toggle-underscore to unset this ESS default:

ess-toggle-underscore is an alias for `ess-toggle-S-assign' in
`ess-s-l.el'.

(ess-toggle-underscore FORCE)

Set the `ess-smart-S-assign-key' (by default "_"
[underscore]) key to _ or back to
`ess-smart-S-assign-key'.  Toggle the current definition, unless
FORCE is non-nil, where _ is set
unconditionally.

  If you as per default have `ess-smart-S-assign-key' set to
  underscore, note that using "C-q _" will always just insert the
  underscore character.

You can set/unset this in your ~/.emacs as well.

That being said, underscores are evil in variable names. Don't believe a word Hadley says in the matter -- it is camelCase all the way.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
0

Another walk-around is to type underscore again in emacs, and ESS will switch <- to _.

liuminzhao
  • 2,385
  • 17
  • 28