[ESS] how to deal with underscore in ggplot2 etc

Jeremie Juste jerem|eju@te @end|ng |rom gm@||@com
Fri Sep 4 18:41:22 CEST 2020


Hello,

> My biggest concern is using ggplot2
> where all the geom functions have an underscore: geom_smooth etc?the
> package is authored by the people behind Rstudio who do not care about
> ESS users

If you tweak ggplots for hours every key stroke saved counts.

Here is my work flow. First I remove this smart underscore entirely as
it is not so smart.

(setq ess-smart-S-assign-key nil)

Then I created a dumb one

(defun dumb-assign ()
  (interactive)
  (insert " <- "))

Then to avoid putting too much strain on my muscle memory I use the key-chord
package on melpa. You can find more information [1] here. So my pressing
-= together very quickly, I have the assign key and the fingers go at
the same place. 

(key-chord-define ess-r-mode-map "-=" 'dumb-assign)

I have been struggling with the naming convention with R for a long
time. At some point I considered leaning towards a more lispy way

`test-fun` <- function(s) print(s) but it would not have been very
popular. I now think [2] Camelcase is the way to go.

[1]: http://irreal.org/blog/?p=344
[2] https://jef.works/R-style-guide/

Hope this helps,

Jeremie Juste



More information about the ESS-help mailing list