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

Stephen Eglen S.J.Eglen at damtp.cam.ac.uk
Fri Apr 8 11:11:50 CEST 2005


 > 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.

Stephen




More information about the ESS-help mailing list