I'm using EmacsForMacOsX, v23.3.1, and I wonder how I can change the color for floating point values celsiusFloat = (5.0/9.0);
to be a different color than those I get from my current color-theme-billw
theme for integers age = 23;
.
I doubt that StackOverflow colours them differently.
EDIT: My initial approach to add a regex for the floating point
d*\.d*
in cc-mode.el
was apparently not the way Emacs work with syntax highlighting (also known as font locking) - further research has led me to the following website: http://www.gnu.org/software/emacs/elisp/html_node/Customizing-Keywords.html
Edit 2:
I seem to have found my answer at http://www.emacswiki.org/emacs/AddKeywords and
http://www.gnu.org/software/emacs/manual/html_node/emacs/Font-Lock.html#Font-Lock
(add-hook 'c-mode-hook
(lambda ()
(font-lock-add-keywords nil
'(("[0-9]+\\.[0-9]+" 1 font-lock-warning-face t)))))