[ESS] how to deal with underscore in ggplot2 etc

Lionel Henry ||one|@hry @end|ng |rom gm@||@com
Fri Sep 4 18:56:06 CEST 2020


In the next version of ESS the underscore will no longer insert
assignment by default.  Instead you can use `ess-cycle-assign` with
the `C-c C-=` binding. This cycles through all assign ops on repeated
presses.

To get the previous behaviour, you'll need to opt in by binding "_" to
`ess-insert-assign` in your config. This now works with any key of
your choice. If binded to ";" for instance, one press will insert
assignment, a second press will insert ";".

Best,
Lionel

On 9/4/20, Jeremie Juste via ESS-help <ess-help using r-project.org> wrote:
>
> 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
>
> ______________________________________________
> ESS-help using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>



More information about the ESS-help mailing list