[ESS] commenting a region

Richard M. Heiberger rmh at temple.edu
Thu Mar 30 02:30:01 CEST 2006

Try using the simpler key sequence

This is a smart sequence.  If the region is not
commented, then it comments it.  If the region is 
commented, then it uncomments it.

comment-dwim is an interactive compiled Lisp function in `newcomment'.
It is bound to M-;.
(comment-dwim arg)

Call the comment command you want (Do What I Mean).
If the region is active and `transient-mark-mode' is on, call
  `comment-region' (unless it only consists of comments, in which
  case it calls `uncomment-region').
Else, if the current line is empty, insert a comment and indent it.
Else if a prefix arg is specified, call `comment-kill'.
Else, call `comment-indent'.

More information about the ESS-help mailing list