[ESS] Ever consider changing indentation on #?

Martin Maechler m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Mon May 15 16:17:09 CEST 2017


>>>>> Lionel Henry <lionel.hry using gmail.com>
>>>>>     on Sat, 6 May 2017 12:30:40 +0200 writes:

    > I don't use it either (though I tried at some point).
    > Any objection to change the default Martin?

Yes !!

    > Lionel


    >> On 6 mai 2017, at 11:44, Vitalie Spinu <spinuvit using gmail.com> wrote:
    >> 
    >> 
    >> I would add here that other modes in emacs except lisp don't usually respect
    >> this convention.
    >> 
    >> Vitalie
    >> 
    >>>> On Fri, May 05 2017 23:52, Steven McKinney wrote:
    >> 
    >>> As an old lisp programmer I use # and ## and ### in all my code.
    >> 
    >>> ### ####################################
    >>> ### for code block and function headers
    >>> ### (this was actually functional in 
    >>> ###  SPLUS for auto-generating help)
    >>> ### ####################################
    >> 
    >>> ## for inline comments in code, and       # brief margin notes
    >> 
    >>> I find it useful, but all things change over time.
    >> 
    >>> Steven McKinney
    >> 
    >>>> -----Original Message-----
    >>>> From: ESS-help [mailto:ess-help-bounces using r-project.org] On Behalf Of Paul
    >>>> Johnson
    >>>> Sent: May-04-17 7:50 PM
    >>>> To: ess-help
    >>>> Subject: Re: [ESS] Ever consider changing indentation on #?
    >>>> 
    >>>> Please raise your hand if you have EVER used # to document R code in
    >>>> the way mentioned on the LISP coding standards page.
    >>>> 
    >>>> 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
    >>>>> 
    >>>> 123456789012345678901234567890123456789012345678901234567890123456789012345
    >>>> 6789012345678901234567
    >>>>> 
    >>>>> -- 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:
    >>>>> 
>>>>> On Thu, May 4, 2017 at 10:25 AM, Lionel Henry <lionel.hry using gmail.com>
    >>>> wrote:
    >>>>>>> 
    >>>>>>>> On 4 mai 2017, at 16:22, Paul Johnson <pauljohn32 using gmail.com> wrote:
    >>>>>>>> 
    >>>>>>>> I understand I can fix my init.el go avoid this, but it would be nicer
    >>>>>>>> for my purpose
    >>>>>>>> if this were in ESS itself, because I keep telling students to use it
    >>>>>>>> and they are put off/discouraged
    >>>>>>>> by this.
    >>>>>>> 
    >>>>>>> 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.
>>>>> 
    >>>>> 
    >>>>> And there are a bunch of styles from which to choose a personal default.
    >>>>> See below.
    >>>>> 
>>>>> Yes, IMO Emacs/ESS isn't going to compete with Rstudio on
>>>>> out-of-the-box convenience. But we can compete on features! Put this
>>>>> in your config file
>>>>> 
>>>>> (add-hook 'ess-mode-hook
>>>>>         (lambda()
>>>>>           ;; don't indent comments
>>>>>           (setq ess-indent-with-fancy-comments nil)
>>>>>           ;; turn on outline mode
>>>>>           (setq-local outline-regexp "[# ]+")
>>>>>           (outline-minor-mode t)))
>>>>> 
>>>>> and not only will single # comments not be aligned at comment-column,
>>>>> but code folder will work too!
>>>>> 
>>>>> 
    >>>>> 
    >>>>> 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
    >> 
    >> ______________________________________________
    >> 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




More information about the ESS-help mailing list