[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add functions to C-mode?
From: |
David Hansen |
Subject: |
Re: Add functions to C-mode? |
Date: |
Sat, 19 Apr 2008 19:16:50 +0200 |
User-agent: |
Gnus/5.110009 (No Gnus v0.9) Emacs/23.0.60 (gnu/linux) |
On Sat, 19 Apr 2008 13:04:06 +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.
>
> I would like to change the function to just insert // even though some
> text might not be selected.
>
> Is that possible?
M-; should do just that. Well in c-mode it will insert /* */ if no
region is selected and will wrap the comment delimiters if the region is
active.
If you insist on "//" (which is btw not ANSI C) you have to play around
a bit with the `comment-start' and `comment-end' variables. Not tested:
(defun cxx-comments ()
(set (make-local-variable comment-start) "// ")
(set (make-local-variable comment-end "")))
(add-hook c-mode-hook #'cxx-comments)
David
- Add functions to C-mode?, saneman, 2008/04/19
- Re: Add functions to C-mode?, Ph . Ivaldi, 2008/04/19
- Re: Add functions to C-mode?,
David Hansen <=
- 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, 2008/04/20
Message not available