[ESS] M-; makes double hash in R files

Martin Maechler maechler at stat.math.ethz.ch
Fri Apr 8 14:42:17 CEST 2005


>>>>> "tony" == A J Rossini <blindglobe at gmail.com>
>>>>>     on Fri, 8 Apr 2005 12:04:38 +0200 writes:

    tony> On Apr 8, 2005 11:11 AM, Stephen Eglen
    tony> <S.J.Eglen at damtp.cam.ac.uk> wrote:
    >> > When I open an R file with ess, typing M-; on a line
    >> which has > something on it puts a ## comment mark like
    >> this:
    >> >
    >> > a <- 1 ##
    >> >
    >> > If I delete one of the hash marks and type M-; again,
    >> the comment is > correctly positioned, eg
    >> >
    >> > a <- 1 #
    >> >
    >> > What can I do to get the single hash mark (correctly
    >> positioned) by > simply typing M-;?  I am using Ess
    >> 5.2.6-1 in Emacs 21.4a-1 (both > debian testing).
    >> 
    >> This is a good point.  ESS tries to follow elisp for
    >> indentation of comments if ess-fancy-comments is non-nil,
    >> so presumably it would be good to follow the elisp mode
    >> for adding comments as in elisp code (which is bascially
    >> above).  [If you type M-; at the start of a line in
    >> foo.el, you get two semicolons at the start of the line,
    >> indented appropriately, which I think is nice.
    >> 
    >> ESS core: I think the approach would be to set
    >> comment-char to "#" rather than "##" and then set
    >> `comment-add' to 1, rather than default of 0 (as is for
    >> elisp mode).  There may be other changes needed, but I
    >> can take a look if this is the desired approach.

    tony> I think we just introduced this "fix" recently,
    tony> without thinking of Tamas's use case.  The point is
    tony> that we need to consider the context better.  (it was
    tony> just "#" until recently).

yes.  
In other words,  (:-) ;-)
  "please go ahead and take the look" you mentioned above, Stephen!

Martin




More information about the ESS-help mailing list