[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: /* */ style comments in C++ sources

From: Alan Mackenzie
Subject: Re: /* */ style comments in C++ sources
Date: Wed, 24 May 2017 20:53:16 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

Hello, Eli.

On Wed, May 24, 2017 at 05:27:54 +0300, Eli Zaretskii wrote:
> > Date: Tue, 23 May 2017 20:31:44 +0000
> > Cc: address@hidden
> > From: Alan Mackenzie <address@hidden>

> > On Tue, May 23, 2017 at 21:57:17 +0300, Eli Zaretskii wrote:
> > > Is there a way to tell Emacs to use the C-style comments in C++
> > > sources?  (I couldn't find that in the CC Mode manual.)

> > No, there is no (reasonable) way to tell CC Mode what style of comments
> > one prefers.

> > People have asked about this before.  It seems like it would be a useful
> > facility to add.

> Indeed, it would.  The rationale for me is projects like GDB, which
> switched from C to C++, but still prefer C-style comments for some
> reason.  (Maybe GCC also prefers that, I don't know.)

OK.  Give me a little time, and it will be implemented.

> > Though it might take a surprisingly large amount of work to
> > implement.

> I'm surprised.  Why is that?

There are quite a few (CC Mode) "language variables" to do with comment
delimiters, which are set statically at build-time.  They will need to be
amended to be ordinary variables which can be set at run-time, or the
functions which use them will need to be enhanced to selected between two
pairs of comment delimiters at run-time, or whatever.

> > I'll think about it.

What do you think of the following:

(i) There would be a new "CC Mode minor mode" with an interactive
function called `c-toggle-comment-style', which would toggle a new buffer
local variable, c-comment-style.  This variable could be set in local
variables, or in .emacs in the same way as any other CC Mode buffer
(ii) `c-toggle-comment-style' would be bound to an unused CC Mode
binding, possibly C-c C-k.
(iii) I'm also thinking about putting it on C-c C-;, though terminal
keyboards tend not to have C-; (mine doesn't (yet)).
(iv) The major mode mode line entry, which currently looks something
like "C/l" would be amended to "C/*l" or "C//l", with the obvious meaning.
(v) The new buffer-local variable `c-comment-style' would influence all
standard Emacs commands which create comments.


> Thank you.

Alan Mackenzie (Nuremberg, Germany).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]