can't say i'm 100% sure what this does, but it works:
(global-set-key [(control c) (c)]
(lambda()
(interactive)
(comment-region (region-beginning) (region-end) '(4))
(c-region-is-active-p)))
i believe i copied the lisp that uncomments of the cc-mode library (it's the code behind the uncomment menu item in your c/c++/java menu).
> -----Original Message-----
> From: Yaroslav Bulatov [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 29, 2000 9:24 PM
> To: Taber H. Smith
> Cc: Jde@Sunsite. Auc. Dk
> Subject: Re: Auto-indentation of commented region?
>
>
> The proper way is to do it through Lisp. I wrote a function
> that tries to
> accomplish this:
>
> (defun comment-and-indent-region (beg end &optional arg)
> "Runs comment-region and then indent-region on a region"
> (interactive "r\nP")
> (if (null arg)
> (comment-region beg end)
> (comment-region beg end arg))
> (indent-region beg end nil))
>
> Just put it in your .emacs file and bind it to \C-c\C-c.
> The problem with it is that it works only one way.
> It doesn't work to uncomment the code because uncommenting
> will only work
> if line starts with a comment, so I would have to remove whitespace on
> every line in selection, and that's beyond my current
> knowledge of Lisp.
> Perhaps somebody on this mailing list is good enough with
> lisp to solve
> this problem?
>
> Yaroslav
>
> On Tue, 29 Aug 2000, Taber H. Smith wrote:
>
> > Hi,
> >
> > I'm wondering if there is a way to automatically
> > indent a region that has just been commented out, i.e.
> >
> > mark region
> > C-c C-c
> >
> > then automatically run
> > C-x indent-region
> >
> > Also, after you uncomment out a region, it would be
> > nice if the jde automatically indented the uncommented region.
> >
> > Any suggestions?
> >
> > Thanks!
> > Taber
> >
> >
>
