unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* command to insert comment in c mode
@ 2003-01-04 20:20 kani
  2003-01-04 23:48 ` Tim Haynes
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: kani @ 2003-01-04 20:20 UTC (permalink / raw)


Hi  all,

first of all, execuse the newbie question. is there is a command or to 
insert a comment block in C mode ? that is, when i press key combination, a 
/* and */
 are inserted and cursor left in the middle of comment block.
thanx
mark

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

* Re: command to insert comment in c mode
  2003-01-04 20:20 command to insert comment in c mode kani
@ 2003-01-04 23:48 ` Tim Haynes
  2003-01-04 23:50 ` Alfred M. Szmidt
  2003-01-05  1:46 ` Chmouel Boudjnah
  2 siblings, 0 replies; 4+ messages in thread
From: Tim Haynes @ 2003-01-04 23:48 UTC (permalink / raw)


kani <harazy@telocity.com> writes:

> first of all, execuse the newbie question. is there is a command or to
> insert a comment block in C mode ? that is, when i press key combination,
> a /* and */ are inserted and cursor left in the middle of comment block.

Maybe:

 | M-; runs `indent-for-comment'
 | 
 | Documentation:
 | Indent this line's comment to comment column, or insert an empty
 | comment.  Comments starting in column 0 are not moved.

?

~Tim
-- 
We stood in the moonlight                   |piglet@stirfried.vegetable.org.uk
and the river flowed                        |http://spodzone.org.uk/

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

* Re: command to insert comment in c mode
  2003-01-04 20:20 command to insert comment in c mode kani
  2003-01-04 23:48 ` Tim Haynes
@ 2003-01-04 23:50 ` Alfred M. Szmidt
  2003-01-05  1:46 ` Chmouel Boudjnah
  2 siblings, 0 replies; 4+ messages in thread
From: Alfred M. Szmidt @ 2003-01-04 23:50 UTC (permalink / raw)
  Cc: help-gnu-emacs

   first of all, execuse the newbie question. is there is a command or to 
   insert a comment block in C mode ? that is, when i press key combination, a 
   /* and */
    are inserted and cursor left in the middle of comment block.

Does M-; (comment-dwim) do what you want?

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

* Re: command to insert comment in c mode
  2003-01-04 20:20 command to insert comment in c mode kani
  2003-01-04 23:48 ` Tim Haynes
  2003-01-04 23:50 ` Alfred M. Szmidt
@ 2003-01-05  1:46 ` Chmouel Boudjnah
  2 siblings, 0 replies; 4+ messages in thread
From: Chmouel Boudjnah @ 2003-01-05  1:46 UTC (permalink / raw)


kani <harazy@telocity.com> writes:

> first of all, execuse the newbie question. is there is a command or to 
> insert a comment block in C mode ? that is, when i press key combination, a 
> /* and */
>  are inserted and cursor left in the middle of comment block.

M-; is the tip to make this automatically[1] set this in your .emacs to
auto-fill automatically the comments (but not the code) :

(defun my-c-mode-hook () 
  (set (make-local-variable 'fill-nobreak-predicate)
	   (lambda () (not (eq (get-text-property (point) 'face) 'font-lock-comment-face))))
)
(add-hook 'c-mode-hook 'my-c-mode-hook)


Footnotes: 
[1]  i guess i got this code from somewhere on
http://www.emacswiki.org/

-- 
Chmouel -- http://www.chmouel.com/

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

end of thread, other threads:[~2003-01-05  1:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-04 20:20 command to insert comment in c mode kani
2003-01-04 23:48 ` Tim Haynes
2003-01-04 23:50 ` Alfred M. Szmidt
2003-01-05  1:46 ` Chmouel Boudjnah

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).