[ESS] Ever consider changing indentation on #?

Mathieu Basille b@@|||e@web @end|ng |rom @@e-re@e@rch@org
Mon May 8 03:08:23 CEST 2017


+1 for the current ESS style, I'm with Vincent on this.

Since Stephen also mentioned 'formatR', let's say here that formatR aligns
any comment line starting with any number of #s (1, 2, 3, more…) to the
current indentation level, and does not affect in-line comments.

For once, Hadley Wickham does not seem to have a very developed opinion on
comment indentation:

http://adv-r.had.co.nz/Style.html (at the very bottom)

Mathieu.


On 05/06/2017 10:30 AM, Vincent Goulet wrote:
>> Le 4 mai 2017 à 22:49, Paul Johnson <pauljohn32 using gmail.com> a écrit :
>>
>> Please raise your hand if you have EVER used # to document R code in
>> the way mentioned on the LISP coding standards page.
> 
> I do, all the time ever since I (more or less by accident) discovered the functionality. Actually, all the code I distribute to my students is commented this way; see e.g.
> 
> 	https://github.com/vigou3/introduction-programmation-r/blob/master/bases.R
> 
> It should be noted that this commenting style also works in LaTeX mode (granted, a single % somewhere on the right being less useful with text). For me, it just makes more sense that the higher the number of comment markers, the stronger the emphasis (or vice versa).
> 
> Call me an old timer ;-), but I would vote against a change to the *default* behaviour. I see this commenting style as pure Emacsism and would expect any programming mode (Markdown excepted for obvious reasons) to respect it by default. Furthermore, I think ESS does not have to play catch up or to adapt to RStudio.
> 
> Now, that said, I'm all in favour to have an easy to toggle ESS option to change Emacs/lisp commenting style to Markdown style (since that's what we're talking about) if someone wants to provide the patch.
> 
> v.
> 
>> pj
>>
>> On Thu, May 4, 2017 at 10:52 AM, Brahm, David
>> <David.Brahm using geodecapital.com> wrote:
>>> Since we're on the topic, is there a style to make the # comments right-justified against
>>> "fill-column" (which is 97 for me, as that makes printouts look good) and/or the window
>>> width?  So as you type the comment, it marches leftward.  E.g.:
>>>
>>> x <- y + z                                                       # This comment ends on column 97
>>> 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567
>>>
>>> -- David Brahm (brahm using alum.mit.edu)
>>>
>>>
>>> -----Original Message-----
>>> From: ESS-help [mailto:ess-help-bounces using r-project.org] On Behalf Of Charles C. Berry
>>> Sent: Thursday, May 04, 2017 11:38 AM
>>> To: Ista Zahn
>>> Cc: Stephen Eglen; ess-help
>>> Subject: Re: [ESS] Ever consider changing indentation on #?
>>>
>>> On Thu, 4 May 2017, Ista Zahn wrote:
>>>
>>>
>>> And there are a bunch of styles from which to choose a personal default.
>>> See below.
>>>
>>>
>>> There are `off-the-shelf' styles like `Rstudio' that might satisfy Paul's
>>> student.
>>>
>>> Setting `ess-default-style' to `Rstudio' gives these settings:
>>>
>>>  (RStudio
>>>   (ess-indent-offset . 2)
>>>   (ess-offset-arguments . open-delim)
>>>   (ess-offset-arguments-newline . prev-line)
>>>   (ess-offset-block . prev-line)
>>>   (ess-offset-continued . straight)
>>>   (ess-align-nested-calls)
>>>   (ess-align-arguments-in-calls "function[     ]*(")
>>>   (ess-align-continuations-in-calls)
>>>   (ess-align-blocks)
>>>   (ess-indent-from-lhs arguments)
>>>   (ess-indent-from-chain-start . t)
>>>   (ess-indent-with-fancy-comments))
>>>
>>>
>>> Or one can customize the `OWN' style and select it. See the
>>> `ess-style-alist' docstring for more details.
>>>
>>> HTH,
>>>
>>> Chuck
>>>
>>> ______________________________________________
>>> ESS-help using r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/ess-help
>>>
>>> ______________________________________________
>>> ESS-help using r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/ess-help
>>
>>
>>
>> -- 
>> Paul E. Johnson   http://pj.freefaculty.org
>> Director, Center for Research Methods and Data Analysis http://crmda.ku.edu
>>
>> To write to me directly, please address me at pauljohn at ku.edu.
>>
>> ______________________________________________
>> ESS-help using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/ess-help
> 
> ______________________________________________
> 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