unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* commentting problem when coding in c
@ 2006-12-06 12:52 Ronald
  2006-12-06 13:03 ` Rud1ger Sch1erz
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ronald @ 2006-12-06 12:52 UTC (permalink / raw)


For example:

for () {                       //comment a
        int i=0;               //comment b
}

but in emacs, I can't use tab to indent the comment, and the code will like:
for () {//comment a
        int i=0;//comment b
}

Howerver, C-q [tab] works, but it is not convenient. So does spaces.

Is there any more convenient way? 

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

* Re: commentting problem when coding in c
  2006-12-06 12:52 commentting problem when coding in c Ronald
@ 2006-12-06 13:03 ` Rud1ger Sch1erz
  2006-12-06 13:40   ` Ronald
  2006-12-11 13:42 ` Ken Goldman
  2006-12-11 14:56 ` Robert Thorpe
  2 siblings, 1 reply; 5+ messages in thread
From: Rud1ger Sch1erz @ 2006-12-06 13:03 UTC (permalink / raw)


"Ronald" <followait@163.com> writes:

> Is there any more convenient way? 

You're looking for:

`M-;' (`indent-for-comment')

Lookup: Info -  ccmode  - Indentation Commands

Cheers,
Rudiger

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

* Re: commentting problem when coding in c
  2006-12-06 13:03 ` Rud1ger Sch1erz
@ 2006-12-06 13:40   ` Ronald
  0 siblings, 0 replies; 5+ messages in thread
From: Ronald @ 2006-12-06 13:40 UTC (permalink / raw)


> You're looking for:
>
> `M-;' (`indent-for-comment')
> Lookup: Info -  ccmode  - Indentation Commands

I use:
setq c-tab-always-incdent nil

It's ok. I don't understand why it is not by default.

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

* Re: commentting problem when coding in c
  2006-12-06 12:52 commentting problem when coding in c Ronald
  2006-12-06 13:03 ` Rud1ger Sch1erz
@ 2006-12-11 13:42 ` Ken Goldman
  2006-12-11 14:56 ` Robert Thorpe
  2 siblings, 0 replies; 5+ messages in thread
From: Ken Goldman @ 2006-12-11 13:42 UTC (permalink / raw)


Ronald wrote:
> For example:
> 
> for () {                       //comment a
>         int i=0;               //comment b
> }
> 
> but in emacs, I can't use tab to indent the comment, and the code will like:
> for () {//comment a
>         int i=0;//comment b
> }
> 
> Howerver, C-q [tab] works, but it is not convenient. So does spaces.
> 
> Is there any more convenient way? 

tab-always-indent's value is t

Documentation:
*Controls the operation of the TAB key.
If t, hitting TAB always just indents the current line.
If nil, hitting TAB indents the current line if point is at the left margin
   or in the line's indentation, otherwise it insert a `real' tab character.

What's strange is that, for me, the variable is t, but
I'm getting the nil behavior I think you want.

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

* Re: commentting problem when coding in c
  2006-12-06 12:52 commentting problem when coding in c Ronald
  2006-12-06 13:03 ` Rud1ger Sch1erz
  2006-12-11 13:42 ` Ken Goldman
@ 2006-12-11 14:56 ` Robert Thorpe
  2 siblings, 0 replies; 5+ messages in thread
From: Robert Thorpe @ 2006-12-11 14:56 UTC (permalink / raw)


Ronald wrote:
> For example:
>
> for () {                       //comment a
>         int i=0;               //comment b
> }
>
> but in emacs, I can't use tab to indent the comment, and the code will like:
> for () {//comment a
>         int i=0;//comment b
> }
>
> Howerver, C-q [tab] works, but it is not convenient. So does spaces.

Another possibility is to use M-i rather than C-q TAB.

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

end of thread, other threads:[~2006-12-11 14:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-06 12:52 commentting problem when coding in c Ronald
2006-12-06 13:03 ` Rud1ger Sch1erz
2006-12-06 13:40   ` Ronald
2006-12-11 13:42 ` Ken Goldman
2006-12-11 14:56 ` Robert Thorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).