[ESS] Ever consider changing indentation on #?

Tyler Smith tyler at plantarum.ca
Sat May 6 18:53:40 CEST 2017


Richard M. Heiberger writes:

> When people send me code with consistent use of #, I can't read it
> because all the comments fly off to the right and are nowhere near
> what they are talking about.

Does ESS do this automatically, or do you need to explicitly ask it to
reindent the code for this to happen?

Most code I receive is very poorly and inconsistently formatted to begin
with, so applying any conventions usually makes it better, or at least
easier to tweak into a sensible structure.

> On Thu, May 4, 2017 at 10:49 PM, Paul Johnson <pauljohn32 at gmail.com> wrote:
>> Please raise your hand if you have EVER used # to document R code in
>> the way mentioned on the LISP coding standards page.

I learned R and ESS concurrently starting ca. 2004, so this convention
is normal for me. I find it handy to be able to append short noted with
#, and the distinction between ## and ### is intuitively useful.

Once code gets complex enough to warrant sectioning and folding, I
usually switch to Rmd and wrap it in markdown code blocks. Or org-mode,
if I'm going to be mixing multiple code languages.

>>>> On Thu, May 4, 2017 at 10:25 AM, Lionel Henry <lionel.hry at gmail.com> wrote:
>>>>>
>>>>> Emacs is for people willing to put the effort into customisation.
>>>>> Your students are probably better off with RStudio. That said I
>>>>> agree that good defaults are important.

Yes, RStudio has been a boon for teaching. I can demonstrate on Linux
without my students on Mac or Windows noticing the difference, and the
interface is intuitive enough as to not add to the cognitive load of
learning R.

That said, it's kind of entertaining to watch the development of
RStudio: every few months there's another whiz-bang feature added on to
great fanfare, that reproduces, partially, something we've had in ESS
for years. Brings to mind the old quote about reimplmenting Lisp.

It's really too bad that markdown didn't happen before org-mode came
into it's own. If org-mode had built off the markdown syntax, the
potential for cross-pollination between Emacs/Org/ESS and
RStudio/Rmarkdown would have been much stronger. At this point it looks
like RMarkdown will slowly accumulate a subset of org-mode features.

Best,

Tyler



More information about the ESS-help mailing list