[ESS] Ever consider changing indentation on #?
Mathieu Basille
b@@|||e@web @end|ng |rom @@e-re@e@rch@org
Mon May 8 03:06:55 CEST 2017
Using 'formatR' to reformat code is relatively easy. I wrote a function,
with the help of Walmes Zeviani, to do exactly that:
https://github.com/basille/.emacs.d/blob/master/functions/ess-indent-region-r.el
It can be bound to the indent function (C-M-\) with:
(add-hook 'ess-mode-hook
(lambda ()
(load-library "ess-indent-region-r")
(set (make-local-variable 'indent-region-function)
'ess-indent-region-with-formatr)))
Now, if you want to use that style while coding, that would require a new
indentation style in ESS, which is essentially similar to the R engine
formating style. However, ESS indentation does not currently allow for all
of the perks of R style, notably with respect to call continuation and
indentation after the 5th level.
See this issue in ESS:
https://github.com/emacs-ess/ESS/issues/395
Let's say that following the R engine indentation style has been coldly
received.
Mathieu.
On 05/06/2017 05:10 PM, Stephen Eglen wrote:
>
> On Sat, May 06 2017, Stephen Eglen wrote:
>
>> since we are throwing ideas out there... perhaps what the R universe
>> could do with is something similar to "gofmt" for the go language. All
>> Go code looks the same, because there is a formatting tool, and everyone
>> uses it. How about something similar for R...?!?
>
> Replying to myself again:
>
> https://yihui.name/formatr/
>
> does pretty much what gofmt does (I think).
>
> Stephen
>
> ______________________________________________
> ESS-help using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>
--
Mathieu Basille
basille using ufl.edu | http://ase-research.org/basille
+1 954-577-6314 | University of Florida FLREC
« Le tout est de tout dire, et je manque de mots
Et je manque de temps, et je manque d'audace. »
— Paul Éluard
This message is signed to guarantee its authenticity.
For a true private correspondence, use my public key
to encrypt your messages:
http://mathieu.basille.net/pub.asc
Learn more: http://mzl.la/1BsOGiZ
More information about the ESS-help
mailing list