* C and C++ highlighting is not working properly (font-lock)
@ 2007-06-30 1:45 deccard
2007-06-30 8:34 ` Enselic
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: deccard @ 2007-06-30 1:45 UTC (permalink / raw)
To: help-gnu-emacs
I'm using font-lock, but I'm getting quite weird behavior out of it. I
get right colors only for the first word. Even using tab messes it up!
What could be going on? I have not added anything to my .emacs.
Here is a screen shot of my pseudo c++ program:
http://www.helsinki.fi/~ipohjala/Problem.png
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: C and C++ highlighting is not working properly (font-lock)
2007-06-30 1:45 C and C++ highlighting is not working properly (font-lock) deccard
@ 2007-06-30 8:34 ` Enselic
2007-07-01 14:51 ` deccard
2007-06-30 10:13 ` Alan Mackenzie
[not found] ` <mailman.2833.1183193218.32220.help-gnu-emacs@gnu.org>
2 siblings, 1 reply; 6+ messages in thread
From: Enselic @ 2007-06-30 8:34 UTC (permalink / raw)
To: help-gnu-emacs
On 30 Juni, 03:45, deccard <Anima_Draco...@hotmail.com> wrote:
> I'm using font-lock, but I'm getting quite weird behavior out of it. I
> get right colors only for the first word. Even using tab messes it up!
> What could be going on? I have not added anything to my .emacs.
>
> Here is a screen shot of my pseudo c++ program:http://www.helsinki.fi/~ipohjala/Problem.png
First of all, font-lock probably assumes proper syntax and sane
indentation, so fix that first.
Second of all, it might look more wrong than it is if you have the
same color for two different fonts.
When I setup these colors and want full control, I bring up M-x
customize-group font-lock-faces RET and M-x list-colors-display RET.
Then I change a font, save the settings, switch to a C++ buffer, look
at the results, go back to the customization group, change a color,
save changes, look at result in C++ buffer, etc.
This way I find that one gets much control over syntax.
Hope this helps in some way,
- Martin Nordholts
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: C and C++ highlighting is not working properly (font-lock)
2007-06-30 1:45 C and C++ highlighting is not working properly (font-lock) deccard
2007-06-30 8:34 ` Enselic
@ 2007-06-30 10:13 ` Alan Mackenzie
[not found] ` <mailman.2833.1183193218.32220.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 6+ messages in thread
From: Alan Mackenzie @ 2007-06-30 10:13 UTC (permalink / raw)
To: deccard; +Cc: help-gnu-emacs
Hi!
On Fri, Jun 29, 2007 at 06:45:50PM -0700, deccard wrote:
> I'm using font-lock, but I'm getting quite weird behavior out of it. I
> get right colors only for the first word. Even using tab messes it up!
> What could be going on? ....
> Here is a screen shot of my pseudo c++ program:
> http://www.helsinki.fi/~ipohjala/Problem.png
That looks wierd.
OK. To begin with, can you tell me EXACTLY what I have to do to reproduce the
problem, beginning with how you start Emacs? Does it happen as you're
typing the C++ program, or when you load an existing C++ file? It's
always best with problems like this to say explicitly what version of
Emacs you're using (M-x emacs-version). Often, it's good to dump CC
Mode's configuration (C-c C-b); this can be _very_ helpful in diagnosing
bugs.
> I have not added anything to my .emacs.
Hmmm. Since when? What was in it before you didn't add anything to it?
;-) If you start emacs with "emacs -q", does the problem go away?
Do you have a site-start file (M-x locate-library <CR> site-start.el
<CR>)? If so, what happens when you start emacs with "emacs -q
--no-site-file"?
--
Alan Mackenzie (Ittersbach, Germany)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: C and C++ highlighting is not working properly (font-lock)
2007-06-30 8:34 ` Enselic
@ 2007-07-01 14:51 ` deccard
0 siblings, 0 replies; 6+ messages in thread
From: deccard @ 2007-07-01 14:51 UTC (permalink / raw)
To: help-gnu-emacs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 1270 bytes --]
On 30 kesä, 11:34, Enselic <ense...@gmail.com> wrote:
> On 30 Juni, 03:45, deccard <Anima_Draco...@hotmail.com> wrote:
>
> First of all, font-lock probably assumes proper syntax and sane
> indentation, so fix that first.
The problem occurs also with proper syntax and sane indentation. I had
to use improper syntax and unconventional indentation to point out the
problem better.
>
> Second of all, it might look more wrong than it is if you have the
> same color for two different fonts.
>
No, as you can see from the screen shot I use different colors for
font-lock-type-face font-lock-type-face, but for some reason function
highlighting does not appear correctly everywhere.
> When I setup these colors and want full control, I bring up M-x
> customize-group font-lock-faces RET and M-x list-colors-display RET.
> Then I change a font, save the settings, switch to a C++ buffer, look
> at the results, go back to the customization group, change a color,
> save changes, look at result in C++ buffer, etc.
>
> This way I find that one gets much control over syntax.
Well I don't want to customize my syntax highlighting right now, but I
want the highlighting to work properly.
>
> Hope this helps in some way,
> - Martin Nordholts
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: C and C++ highlighting is not working properly (font-lock)
[not found] ` <mailman.2833.1183193218.32220.help-gnu-emacs@gnu.org>
@ 2007-07-01 15:07 ` deccard
2007-07-01 17:50 ` Alan Mackenzie
0 siblings, 1 reply; 6+ messages in thread
From: deccard @ 2007-07-01 15:07 UTC (permalink / raw)
To: help-gnu-emacs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 1863 bytes --]
On 30 kesä, 13:13, Alan Mackenzie <a...@muc.de> wrote:
> Hi!
>
> That looks wierd.
>
> OK. To begin with, can you tell me EXACTLY what I have to do to reproduce the
> problem, beginning with how you start Emacs?
I'm using emacs through ssh connection on my university's server. The
problem may lay on their end of the line. So maybe I should direct my
university's Unix administrator here. I just was wondering if I'm
doing something wrong.
I get the problem very simple way. I start emacs (gemacs myproc.cc)
and enable the "Syntax Highlighting (Global Font Lock mode)" (F10 s o)
> Does it happen as you're
> typing the C++ program, or when you load an existing C++ file?
The problem occurs in both cases.
>It's
> always best with problems like this to say explicitly what version of
> Emacs you're using (M-x emacs-version).
As you can see from the screen shot the version is GNU emacs 21.3.4
(x86_64-redhat-linux-gnu, X toolkit, Xaw3d scroll bars).
>Often, it's good to dump CC
> Mode's configuration (C-c C-b); this can be _very_ helpful in diagnosing
> bugs.
huh? dump Mode's configuration? Sorry, but I'm pretty new to emacs
>
> > I have not added anything to my .emacs.
>
> Hmmm. Since when? What was in it before you didn't add anything to it?
> ;-) If you start emacs with "emacs -q", does the problem go away?
>
> Do you have a site-start file (M-x locate-library <CR> site-start.el
> <CR>)? If so, what happens when you start emacs with "emacs -q
> --no-site-file"?
>
I meant that I don't have .emacs file at all. I deleted it when I
noticed the problem, because I wanted to be sure that I had not caused
the problem by goofing around with it.
And No, the problem still comes about with "gemacs -q" as well as
"gemacs -q --no-site-file".
> --
> Alan Mackenzie (Ittersbach, Germany)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: C and C++ highlighting is not working properly (font-lock)
2007-07-01 15:07 ` deccard
@ 2007-07-01 17:50 ` Alan Mackenzie
0 siblings, 0 replies; 6+ messages in thread
From: Alan Mackenzie @ 2007-07-01 17:50 UTC (permalink / raw)
To: help-gnu-emacs
Hi!
On Sun, Jul 01, 2007 at 03:07:29PM -0000, deccard wrote:
> On 30 kes?, 13:13, Alan Mackenzie <a...@muc.de> wrote:
> > Hi!
> >
> > That looks wierd.
> >
> > OK. To begin with, can you tell me EXACTLY what I have to do to
> > reproduce the problem, beginning with how you start Emacs?
> I'm using emacs through ssh connection on my university's server. The
> problem may lay on their end of the line. So maybe I should direct my
> university's Unix administrator here. I just was wondering if I'm
> doing something wrong.
Ah, ssh! I don't think you're doing anything wrong at all. The colours
on your buffer are just so wierd that I don't think it's (solely) Emacs.
However, they're not totally random, either.
> I get the problem very simple way. I start emacs (gemacs myproc.cc)
> and enable the "Syntax Highlighting (Global Font Lock mode)" (F10 s o)
OK.
> > Does it happen as you're
> > typing the C++ program, or when you load an existing C++ file?
> The problem occurs in both cases.
Further evidence that it's possibly not Emacs at fault.
> > It's always best with problems like this to say explicitly what
> > version of Emacs you're using (M-x emacs-version).
> As you can see from the screen shot the version is GNU emacs 21.3.4
> (x86_64-redhat-linux-gnu, X toolkit, Xaw3d scroll bars).
Sorry, yes I missed that.
> > Often, it's good to dump CC Mode's configuration (C-c C-b); this can
> > be _very_ helpful in diagnosing bugs.
> huh? dump Mode's configuration? Sorry, but I'm pretty new to emacs
Sorry again, I should have explained better. Welcome to Emacs!
The "major mode" you're in determines the way Emacs works. For example,
when you're in "Text Mode", Emacs behaves differently from when you're
in "C++ Mode", or "Makefile Mode". The mode you're in is displayed on
the "Modeline", the second bottom line on your screen. In your screen
dump, you were in C++ Mode.
"CC Mode" is a family of seven modes for editing C, C++, Java, Objective
C, IDL, Pike and AWK. In each of them the key binding C-c C-b ("Ctrl-C
followed by Ctrl-B") will create a template bug-report form. This form
contains the values of the (Lisp) variables which are the CC Mode
configuration. For some bugs this is VERY helpful for fixing them. But
I don't think it would help here, though.
> > > I have not added anything to my .emacs.
> >
> > Hmmm. Since when? What was in it before you didn't add anything to it?
> > ;-) If you start emacs with "emacs -q", does the problem go away?
> >
> > Do you have a site-start file (M-x locate-library <CR> site-start.el
> > <CR>)? If so, what happens when you start emacs with "emacs -q
> > --no-site-file"?
> >
> I meant that I don't have .emacs file at all. I deleted it when I
> noticed the problem, because I wanted to be sure that I had not caused
> the problem by goofing around with it.
Ah, OK.
> And No, the problem still comes about with "gemacs -q" as well as
> "gemacs -q --no-site-file".
It looks to me like there's something weird happening on your ssh link.
I think your best bet would be to ask your sysadmin for help - show him
the emails/usenet postings from this thread.
Hope you get it sorted out soon.
--
Alan Mackenzie (Ittersbach, Germany).
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-07-01 17:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-30 1:45 C and C++ highlighting is not working properly (font-lock) deccard
2007-06-30 8:34 ` Enselic
2007-07-01 14:51 ` deccard
2007-06-30 10:13 ` Alan Mackenzie
[not found] ` <mailman.2833.1183193218.32220.help-gnu-emacs@gnu.org>
2007-07-01 15:07 ` deccard
2007-07-01 17:50 ` Alan Mackenzie
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).