all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* customizing syntax highlighting of variable and function usage in C and C++ mode
@ 2009-02-03 15:38 Geralt
  2009-02-05 13:53 ` Geralt
  0 siblings, 1 reply; 4+ messages in thread
From: Geralt @ 2009-02-03 15:38 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

is it possible to customize the syntax highlighting of function calls
and the usage of variables in C and C++ mode? By setting
(font-lock-variable-name-face ((t (:foreground "#eeeeec" :italic t))))
(font-lock-function-name-face ((t (:foreground "#edd400" :bold t
:underline t))))

in my color-theme only the declarations/definitions are affected.

In shell-script-mode all variables are affected (i.e. in every
context), but functions not at all (i.e. not even in their
definitons).



Thanks.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: customizing syntax highlighting of variable and function usage in C and C++ mode
  2009-02-03 15:38 customizing syntax highlighting of variable and function usage in C and C++ mode Geralt
@ 2009-02-05 13:53 ` Geralt
  2009-02-05 14:25   ` Joe Schafer
  0 siblings, 1 reply; 4+ messages in thread
From: Geralt @ 2009-02-05 13:53 UTC (permalink / raw)
  To: help-gnu-emacs

Since nobody has replied I suppose that this is not possible, am I correct?




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: customizing syntax highlighting of variable and function usage in C and C++ mode
  2009-02-05 13:53 ` Geralt
@ 2009-02-05 14:25   ` Joe Schafer
  2009-02-05 15:06     ` tyler
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Schafer @ 2009-02-05 14:25 UTC (permalink / raw)
  To: help-gnu-emacs

Geralt <usr.gentoo@googlemail.com> writes:

> Since nobody has replied I suppose that this is not possible, am I
> correct?

The default font-lock faces might not be affecting the text.  You can
check to see what face font-lock uses on some text by typing \C-x= at
the point of the text.  This runs `what-cursor-position'.  But what you
have is similar to what I have.  Are you sure the rest your color-theme
definition is correct?

(font-lock-function-name-face ((t ( :foreground "palegreen3"))))





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: customizing syntax highlighting of variable and function usage in C and C++ mode
  2009-02-05 14:25   ` Joe Schafer
@ 2009-02-05 15:06     ` tyler
  0 siblings, 0 replies; 4+ messages in thread
From: tyler @ 2009-02-05 15:06 UTC (permalink / raw)
  To: help-gnu-emacs

Joe Schafer <joesmoe10@gmail.com> writes:

> Geralt <usr.gentoo@googlemail.com> writes:
>
>> Since nobody has replied I suppose that this is not possible, am I
>> correct?
>
> The default font-lock faces might not be affecting the text.  You can
> check to see what face font-lock uses on some text by typing \C-x= at
> the point of the text.  This runs `what-cursor-position'.  But what you
> have is similar to what I have.  Are you sure the rest your color-theme
> definition is correct?
>
> (font-lock-function-name-face ((t ( :foreground "palegreen3"))))
>

I can confirm the OP's observation on Emacs 23. Running emacs -Q and
opening a .c file, with a code snippet like the following:

  int minrow, mincol, majrow, majcol, i; /*counters*/
  int inputvalue, outputvalue, changecount;

  changecount = 0;

The declaration rows are nicely coloured, but the following line
('changecount = 0') is not. Variable names in the declaration lines are
subject to font-lock-variable-name-face, while the variable name outside
of the declaration is given the default font. So, at least on my setup,
you can modify the font-lock for declarations, but not for subsequent
occurrences of the variable (or function). At least, not without some
further modification of the color-theme.


Tyler


-- 
There is something fascinating about science. One gets such wholesale 
returns of conjecture out of such a trifling investment of fact.
                                       --Mark Twain





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-02-05 15:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-03 15:38 customizing syntax highlighting of variable and function usage in C and C++ mode Geralt
2009-02-05 13:53 ` Geralt
2009-02-05 14:25   ` Joe Schafer
2009-02-05 15:06     ` tyler

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.