[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add functions to C-mode?
From: |
Alan Mackenzie |
Subject: |
Re: Add functions to C-mode? |
Date: |
Sun, 20 Apr 2008 12:01:15 +0000 |
User-agent: |
Mutt/1.5.9i |
Hi, Saneman!
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.
OK, just to check, "it" here means "M-;" (or your newly bound C-d), bound
to `comment-dwim', doesn't it?
I'm not sure about "selected" (I don't use delete-selection-mode and
stuff like that), but the "/* */" style of comments is fixed for C.
Somebody asked some while ago for a way to change this to "//", and I'm
planning to add a command to CC Mode (probably C-c C-;) in the next
release to toggle the commenting style.
> I would like to change the function to just insert // even though some
> text might not be selected.
In the meantime, you could use the following workaround. M-; (or your
C-d ;-) will then insert "// ".
(defun sm-do-line-comments ()
(setq comment-start "// ")
(setq comment-end ""))
(add-hook 'c-mode-hook 'sm-do-line-comments)
> Is that possible?
Hey, what sort of a question is that? This is Emacs. :-)
--
Alan Mackenzie (Nuremberg, Germany).
- Re: Add functions to C-mode?, (continued)
- Re: Add functions to C-mode?, Ph . Ivaldi, 2008/04/19
- Re: Add functions to C-mode?, David Hansen, 2008/04/19
- Message not available
- Re: Add functions to C-mode?, Jason Rumney, 2008/04/19
- 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 <=
Message not available