ess-smart-underscore.el — Ess Smart Underscore
To use without using a package manager:
- Put the library in a directory in the emacs load path, like ~/.emacs.d
- Add (require ‘ess-smart-underscore) in your ~/.emacs file
This is in emacswiki, so this package can also be installed using el-get.
After installing el-get, Type M-x el-get-install ess-smart-underscore.
Ess-Smart Underscore Package Information
Smart “_” key: insert ess-S-assign, unless:
- in string/comment
- after a $ (like d$one_two) (toggle with ess-S-underscore-after-$)
- when the underscore is part of a variable definition previously defined. (toggle with
- when the underscore is after a “=” or “←” on the same line.
- inside a parenthetical statement () or . (toggle with ess-S-underscore-when-inside-paren)
- At the beginning of a line.
- In a variable that contains underscores already (for example foo_a) (toggle with ess-S-underscore-when-variable-contains-underscores)
- The preceding character is not a tab/space (toggle with ess-S-underscore-when-last-character-is-a-space. Not enabled by default.)
An exception to #4 is in the following situation:
a <- b |
Pressing an underscore here would produce
a <- b <-
However when in the following situation
a <- b|
Pressing an underscore would produce
a <- b_
This behavior can be toggled by ess-S-space-underscore-is-assignment
If the underscore key is pressed a second time, the assignment operator is removed and replaced by the underscore. ess-S-assign, typically “ ← “, can be customized. In ESS modes other than R/S, an underscore is always inserted.
In addition the ess-smart-underscore attempts to work with noweb-mode
- 22-May-2013 – Added more ggplot operators. (Matthew L. Fidler)
- 21-May-2013 – Added math to ggplot’s functions… (Matthew L. Fidler)
- 21-May-2013 – Added hook to R-mode to make it behave a little better. (Matthew L. Fidler)
- 15-May-2013 – Fixed ess-smart-underscore to work in an inferior R process. (Matthew L. Fidler)
- 15-May-2013 – Added ggplot function prefixes. (Matthew L. Fidler)
- 05-Nov-2012 – Better handling of noweb. I think it Came from Denis Haine and Martin Maechler. (Matthew L. Fidler)
- 22-Feb-2012 – Support unbalanced sexps. (Matthew L. Fidler)
- 02-Feb-2012 – Took out auto-installing. Most package managers don’t want you to do this. (Matthew L. Fidler)
- 03-Aug-2011 – Bug fix for parenthetical statement (Matthew L. Fidler)
- 20-Jul-2011 – Changed to allow underscore instead of assign when inside a parenthetical statement. (Matthew L. Fidler)
- 15-Jul-2011 – Bug fix for d[d$CMT 2,“DV”] _ to produce d[d$CMT 2,“DV”] ← (Matthew L. Fidler)* Variables
This was generated with OrgReadme. On updating the library, this page is likely to be replaced with updated content.