all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* I cannot find how to comment a block
@ 2006-04-09 19:29 volunteers
  2006-04-09 21:01 ` Colin S. Miller
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: volunteers @ 2006-04-09 19:29 UTC (permalink / raw)


Hi,
I know this is a basic question but I just didn't find the solution: in
cc-mode (I was writing C++ codes), how can I comment a block? I tried
'M-;' and it just adds comments behind that line. What I want is to
comment this line or several lines (add // in front of every line, or
/* ... */) . Thanks.

Vol.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: I cannot find how to comment a block
  2006-04-09 19:29 I cannot find how to comment a block volunteers
@ 2006-04-09 21:01 ` Colin S. Miller
  2006-04-09 21:06 ` Robert D. Crawford
  2006-04-10  5:16 ` Stefan Monnier
  2 siblings, 0 replies; 4+ messages in thread
From: Colin S. Miller @ 2006-04-09 21:01 UTC (permalink / raw)


volunteers@gmail.com wrote:
> Hi,
> I know this is a basic question but I just didn't find the solution: in
> cc-mode (I was writing C++ codes), how can I comment a block? I tried
> 'M-;' and it just adds comments behind that line. What I want is to
> comment this line or several lines (add // in front of every line, or
> /* ... */) . Thanks.
> 
> Vol.
> 

Volunteers,

`comment-region' is an interactive compiled Lisp function
   -- loaded from "/home/mohura/packages/build-area/xemacs21-21.4.17/lisp/simple.elc"
(comment-region START END &optional ARG)

Documentation:
Comment or uncomment each line in the region.
With just C-u prefix arg, uncomment each line in region.
Numeric prefix arg ARG means use ARG comment characters.
If ARG is negative, delete that many comment characters instead.
Comments are terminated on each line, even for syntax in which newline does
not end the comment.  Blank lines do not get comments.

It's not bound to a key by default.

BTW,
C-h a  can be helpful to find functionality if you can guess
part of the name of the function.

HTH,
Colin S. Miller


-- 
Replace the obvious in my email address with the first three letters of the hostname to reply.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: I cannot find how to comment a block
  2006-04-09 19:29 I cannot find how to comment a block volunteers
  2006-04-09 21:01 ` Colin S. Miller
@ 2006-04-09 21:06 ` Robert D. Crawford
  2006-04-10  5:16 ` Stefan Monnier
  2 siblings, 0 replies; 4+ messages in thread
From: Robert D. Crawford @ 2006-04-09 21:06 UTC (permalink / raw)


volunteers@gmail.com writes:

> Hi, I know this is a basic question but I just didn't find the
> solution: in cc-mode (I was writing C++ codes), how can I comment a
> block? I tried 'M-;' and it just adds comments behind that line. What
> I want is to comment this line or several lines (add // in front of
> every line, or /* ... */) . Thanks.

Try C-c C-c or M-x comment-region.  To find these things where you think
you might have an idea of the command name, try M-x apropos or C-h a.  I
found this by using the command C-h a comment in a C++ file.

rdc
-- 
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Robert D. Crawford                                      rdc1x@comcast.net

You are magnetic in your bearing.
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: I cannot find how to comment a block
  2006-04-09 19:29 I cannot find how to comment a block volunteers
  2006-04-09 21:01 ` Colin S. Miller
  2006-04-09 21:06 ` Robert D. Crawford
@ 2006-04-10  5:16 ` Stefan Monnier
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2006-04-10  5:16 UTC (permalink / raw)


> I know this is a basic question but I just didn't find the solution: in
> cc-mode (I was writing C++ codes), how can I comment a block? I tried
> 'M-;' and it just adds comments behind that line.  What I want is to
> comment this line or several lines (add // in front of every line, or
> /* ... */) . Thanks.

Just use M-; (yes, it does work for that purpose).
But make sure the region is active and highlighted: i.e. turn on
transient-mark-mode.


        Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-04-10  5:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-09 19:29 I cannot find how to comment a block volunteers
2006-04-09 21:01 ` Colin S. Miller
2006-04-09 21:06 ` Robert D. Crawford
2006-04-10  5:16 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.