* font lock problem in C mode
@ 2007-06-15 17:26 Stephen Eglen
2007-06-15 20:27 ` martin rudalics
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Eglen @ 2007-06-15 17:26 UTC (permalink / raw)
To: bug-gnu-emacs; +Cc: maechler
Put the following C comment into a file, called e.g. "s.c"
/**
* Simple comment.
*/
and then do:
$emacs -q s2.c
The comment is fontified as a "string", rather than a "comment". If I
delete the 2nd asterisk on the first line, the font switches correctly
to be fontified as a comment.
Stephen
In GNU Emacs 22.1.1 (i686-pc-linux-gnu, X toolkit)
of 2007-06-03 on notch.damtp.cam.ac.uk
Windowing system distributor `The XFree86 Project, Inc', version 11.0.40300000
configured using `configure '--prefix=/home/raid/bio/sje30/NOBACKUP/local''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: C
locale-coding-system: nil
default-enable-multibyte-characters: t
Major mode: C/l
Minor modes in effect:
tooltip-mode: t
tool-bar-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
unify-8859-on-encoding-mode: t
utf-translate-cjk-mode: t
auto-compression-mode: t
line-number-mode: t
abbrev-mode: t
Recent input:
<right> C-e <left> C-d C-x u C-x C-s M-x r e p o r
t SPC e m SPC b SPC <return>
Recent messages:
("emacs" "-q" "s2.c")
For information about the GNU Project and its goals, type C-h C-p.
Loading cc-mode...done
For information about the GNU Project and its goals, type C-h C-p.
Undo!
(No changes need to be saved)
Loading emacsbug...done
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: font lock problem in C mode
2007-06-15 17:26 font lock problem in C mode Stephen Eglen
@ 2007-06-15 20:27 ` martin rudalics
2007-06-15 20:56 ` Jason Rumney
2007-06-16 9:37 ` Alan Mackenzie
0 siblings, 2 replies; 4+ messages in thread
From: martin rudalics @ 2007-06-15 20:27 UTC (permalink / raw)
To: Stephen Eglen; +Cc: bug-cc-mode, Alan Mackenzie, bug-gnu-emacs, maechler
> Put the following C comment into a file, called e.g. "s.c"
>
> /**
> * Simple comment.
> */
>
> and then do:
>
> $emacs -q s2.c
>
> The comment is fontified as a "string", rather than a "comment".
It is fontified as a "doc-string" (if you customize `font-lock-doc-face'
you will see the difference).
> If I
> delete the 2nd asterisk on the first line, the font switches correctly
> to be fontified as a comment.
It is a "feature". Alan Mackenzie will explain this carefully and in
full detail ... Alan, good evening, it's me again ;-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: font lock problem in C mode
2007-06-15 20:27 ` martin rudalics
@ 2007-06-15 20:56 ` Jason Rumney
2007-06-16 9:37 ` Alan Mackenzie
1 sibling, 0 replies; 4+ messages in thread
From: Jason Rumney @ 2007-06-15 20:56 UTC (permalink / raw)
To: martin rudalics
Cc: bug-cc-mode, Alan Mackenzie, bug-gnu-emacs, Stephen Eglen,
maechler
martin rudalics wrote:
> It is fontified as a "doc-string" (if you customize `font-lock-doc-face'
> you will see the difference).
Is there a good reason why it only works with javadoc style comments,
and not other commonly used documentation comment indicators?
ie doxygen also recognizes Qt style, C# style and a hybrid style:
/*!
* documentation
*/
/// documentation
//! documentation
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: font lock problem in C mode
2007-06-15 20:27 ` martin rudalics
2007-06-15 20:56 ` Jason Rumney
@ 2007-06-16 9:37 ` Alan Mackenzie
1 sibling, 0 replies; 4+ messages in thread
From: Alan Mackenzie @ 2007-06-16 9:37 UTC (permalink / raw)
To: Stephen Eglen, martin rudalics; +Cc: bug-cc-mode, bug-gnu-emacs, maechler
Hi, Stephen, Hi, Martin!
Stephen, your address wouldn't be "Department of Applied Mathematics and
Theoretical Physics", by any chance?
On Fri, Jun 15, 2007 at 10:27:02PM +0200, martin rudalics wrote:
> > Put the following C comment into a file, called e.g. "s.c"
> >
> > /**
> > * Simple comment.
> > */
> >
> > and then do:
> >
> > $emacs -q s2.c
> >
> > The comment is fontified as a "string", rather than a "comment".
> It is fontified as a "doc-string" (if you customize `font-lock-doc-face'
> you will see the difference).
> > If I delete the 2nd asterisk on the first line, the font switches
> > correctly to be fontified as a comment.
> It is a "feature". Alan Mackenzie will explain this carefully and in
> full detail ... Alan, good evening, it's me again ;-)
OK, OK, OK!
The feature is in CC Mode what a doc-string is in Emacs Lisp. It's
documented in the (new) CC Mode manual on page "Doc Comments". The
default in C Mode is "gtkdoc", the documentation convention used by
Gnomes.
If you don't like it (and I realise here that having an unwanted feature
thrust upon one is far worse than the lack of wanted one), disable it by
setting c-doc-comment-style to nil. This is a CC Mode "style variable",
with all the facilities and hassle that come with these. Basically, set
it to nil AS EARLY AS POSSIBLE in your .emacs (or use the customize-..
facilities), as described on the manual page "Config Basics".
--
Alan Mackenzie (Ittersbach, Germany).
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-06-16 9:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-15 17:26 font lock problem in C mode Stephen Eglen
2007-06-15 20:27 ` martin rudalics
2007-06-15 20:56 ` Jason Rumney
2007-06-16 9:37 ` Alan Mackenzie
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).