[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add functions to C-mode?
From: |
Richard G Riley |
Subject: |
Re: Add functions to C-mode? |
Date: |
Mon, 21 Apr 2008 13:49:57 +0200 |
User-agent: |
Gnus/5.110007 (No Gnus v0.7) Emacs/22.2 (gnu/linux) |
Alan Mackenzie <acm@muc.de> writes:
> Morning, Saneman
>
> On Mon, Apr 21, 2008 at 09:36:55AM +0200, saneman wrote:
>> Alan Mackenzie wrote:
>
>> >On Sat, Apr 19, 2008 at 01:04:06PM +0200, saneman wrote:
>> >>I would like to add/change the comment/uncomment function in the
>> >>C-mode for emacs.
>
>> >>Currently it only works when a piece of text is selected and then /* */
>> >>is inserted.
>
> [ .... ]
>
>> But I still have to select the lines that I want to comment out. If the
>> cursor is on a line the I would like to comment out and I press C-d the
>> // get inserted and the end of the line.
>
>> Only when I select the line and then press C-d it works.
>
>> Is there some way to insert // at the start of the line without first
>> selecting it?
>
> I'm not quite sure exactly what you mean, but I don't think so (other
> than typing the two "/"s yourself, but that's boring).
>
> What exactly do you mean by "selecting" and why do you want to avoid
I would assume he means selecting the text. As one does for cut and
paste. Standard region manipulation.
> this? Somehow or other, you've got to indicate to Emacs _which_ lines(s)
> you want commented out (even if it's only one line).
>
> "Selecting" isn't really Emacs jargon. When you drag the mouse over a
Neither is "dragging a mouse" :-;
> buffer, the "mark" is left where you started, and point is put where you
> finish. The "region" is the bit between point and mark, and many
> commands operate on the region. There are lots of ways of setting the
> mark, too. C-<space> is the most basic.
I think it would be fair to say that "selecting the text" is perfectly
clear in this instance.
>
> So, if you want to comment out lines (like all good programming standards
> forbid, yet everybody does ;-), make the region the pertinent lines.
I must admit to never having heard of this - commenting out is a very
common thing to do during development.
> Then do C-c C-c (`comment-region'). If you later want to undo this, put
> the region round these lines again, then do C-u C-c C-c.
In my set up the command is comment-dwim accessed from "M-;". I guess
this is part of emacs-22?
- Re: Add functions to C-mode?, (continued)
- Re: Add functions to C-mode?, David Hansen, 2008/04/20
- Re: Add functions to C-mode?, Eli Zaretskii, 2008/04/20
- Re: Add functions to C-mode?, David Hansen, 2008/04/20
- Re: Add functions to C-mode?, Eli Zaretskii, 2008/04/20
- Re: Add functions to C-mode?, David Hansen, 2008/04/22
- Message not available
- Re: Add functions to C-mode?, Richard G Riley, 2008/04/20
- Re: Add functions to C-mode?, David Hansen, 2008/04/22
Re: Add functions to C-mode?, Alan Mackenzie, 2008/04/20
Message not available