Comment and uncomment regions

A.J. Rossini rossini at
Fri Oct 11 00:09:20 CEST 2002

Great!  You are the second person to explicitly request this feature
(I'm sure there are others, like me, but I'm fixed with a quick typing
of M-x comment-region or C-u M-x comment-region, the curse of using
Emacs forever) -- while technically, Emacs modes can't bind that
particular key seq (ctrl-c non-escaped/non-control chars are reserved
for the user, supposedly), we could add a function to do this which
you would add somewhere, i.e


to your .emacs, or similar.


>>>>> "michael" == Michael J Manning <mj.manning at> writes:

    michael> Hi Tony
    michael> On 10 Oct 2002, at 14:42, A.J. Rossini wrote:
    >> C-h f comment-region    
    >> suggests that  if you bind "C-c ;" to comment region, that 
    >> "C-u C-c ;" should un comment the region.
    >> So, Rich's suggestions for binding should be useful, then the 
    michael> above
    >> might work (please try it for me and report back!).
    >> best,
    >> -tony

    michael> Yes, this works fine. What I ended up doing, however, was defining 
    michael> my own "uncomment-region" function as suggested by the 
    michael> XEmacs tutorial at 
    michael>, e.g.

    michael> (defun uncomment-region (beg end)
    michael>   "Uncomment a region of text"
    michael>   (interactive "r")
    michael>   (comment-region beg end -1));<--Achtung!

    michael> and bound to a key combo I like via

    michael> (global-set-key "\C-c;"      'comment-region)
    michael> (global-set-key "\C-c:"      'uncomment-region)

    michael> Problem solved. Moral? When in doubt, read the instructions I 
    michael> guess...mea culpa.

    michael> Thanks for your help

    michael> MJM

    michael> Michael J. Manning
    michael> National Institute of Water and Atmospheric Research Ltd
    michael> PO Box 14901, Kilbirnie
    michael> Wellington, New Zealand
    michael> Tel 64 4 386 0581
    michael> Fax 64 4 386 0574

A.J. Rossini				Rsrch. Asst. Prof. of Biostatistics
U. of Washington Biostatistics		rossini at	
FHCRC/SCHARP/HIV Vaccine Trials Net	rossini at
-------------- ----------------
FHCRC: M: 206-667-7025 (fax=4812)|Voicemail is pretty sketchy/use Email
UW:   Th: 206-543-1044 (fax=3286)|Change last 4 digits of phone to FAX
(my tuesday/wednesday/friday locations are completely unpredictable.)

ess-help mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: ess-help-request at

More information about the ESS-help mailing list