multi lines commenting

Rodney Sparapani rsparapa at post.its.mcw.edu
Thu Apr 1 17:04:46 CEST 2004


>Hi Fred
>
>I have the following in my init.el file and it appears to work 
>perfectly, i.e. I can comment and uncomment mulitple regions of text in 
>  different modes using the comment character defined for each mode 
>(e.g. "#" for R/S/S+ mode, ";" for lisp mode and so one and so forth).
>
>As noted in an earlier post on this thread, you need to select the 
>region you wish to uncomment (e.g. hit C-spc then use arrow keys or 
>select with mouse) before you apply the uncomment function.
>
>Hope this helps.
>
>MJM
>
>;; Comment and uncomment text
>(defun uncomment-region (beg end)
>   "Uncomment a region of text"
>   (interactive "r")
>   (comment-region beg end -1))
>
>(global-set-key "\C-c;"      'comment-region)
>(global-set-key "\C-c:"      'uncomment-region)
>
>Fred J. wrote:

uncomment-region does not exist in xemacs.  So, for xemacs:
(global-set-key "\C-u\C-c:"      'uncomment-region)

Just for the record, comment-region doesn't work in ESS[SAS].  I've tinkered 
with it, but it seems to be confused by the fact that there are two different 
types of comments; one handled by the syntax table, the other by font-lock 
(actually there are 4, but whose counting).  Of course, it is very easy to 
bracket a region with '/*' and '*/' so I suspect that is why this problem has 
been over-looked.  

Rodney Sparapani              Medical College of Wisconsin
Sr. Biostatistician           Patient Care & Outcomes Research
rsparapa at mcw.edu              http://www.mcw.edu/pcor
Was 'Name That Tune' rigged?  WWLD -- What Would Lombardi Do




More information about the ESS-help mailing list