ess-mode
is "Emacs speaks statistics." This mode is useful for editing programs for R or Splus (two separate statistics packages).
In my buffer, when ever I type _
the character is replaced with <-
, which is very frustrating. Is there an emacs lisp statement to turn off this behavior?
emacs: 22.1.1 ess-mode release (unknown)
Since the feature is useful. You can assign it to other key which is less used by you in R it will automatically unassign it from underscore. I personally assign it to
";"
by adding following line in .emacs file.My version of emacs is 24.3 All-in-one installation file by Vincent Goulet.(Installed on windows 7)
hope this helps
Edit In emacs 25.2 above do not work instead add following in the .emacs file
A more recent version which seemed to work for me, and is a lot less verbose (you essentially keep normal underscores, but can set your own key for this smart behaviour!):
Insert your shortkey choice instead of
C-;
.From ESS's manual (look under "Changes/New Features in 5.2.0"):
From http://www.r-bloggers.com/a-small-customization-of-ess/ and How to change smart assign key ("_" to "<-") binding in ESS
To assign ":" to "<-" and to stop the assignment of underscore (underbar) "_" to "<-" put the following in .emacs (yes, the repeated line is correct)
Like Michał Marczyk and this R mailing list thread suggested, add this line to
~/.emacs
:Then reload it with
M-x load-file
and type~/.emacs
.But if you load the file again, e.g. if you add another customization, then it toggles it back to the original state. So toggle it twice, the first one forcing it to the default:
That being said, I like Drummermean's solution better, but it also reverts back to default if you add it to
~/.emacs
and load it twice. So force a toggle to the default before:I bound the smart assignment to
Opt-[minus]
likeRStudio
(on a Mac).