How to stop emacs from replacing underbar with <- in ess-mode
From ESS's manual (look under "Changes/New Features in 5.2.0"):
ESS[S]: Pressing underscore ("_") once inserts " <- " (as before); pressing underscore twice inserts a literal underscore. To stop this smart behaviour, add "(ess-toggle-underscore nil)" to your .emacs after ess-site has been loaded
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.
(setq ess-smart-S-assign-key ";")
My version of emacs is 24.3 All-in-one installation file by Vincent Goulet.(Installed on windows 7)
hope this helps
EditIn emacs 25.2 above do not work instead add following in the .emacs file
(setq ess-smart-S-assign-key ";")(ess-toggle-S-assign nil)(ess-toggle-S-assign nil)
From http://www.r-bloggers.com/a-small-customization-of-ess/ andHow 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)
(setq ess-smart-S-assign-key ":")(ess-toggle-S-assign nil)(ess-toggle-S-assign nil)(ess-toggle-underscore nil) ; leave underscore key alone!