help-gnu-emacs
[Top][All Lists]
Advanced

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

Unexpected font face in C mode


From: Rami A
Subject: Unexpected font face in C mode
Date: Fri, 9 Aug 2013 13:35:59 -0700 (PDT)
User-agent: G2/1.0

Greetings,
I am trying to have different font face for #define/#include and the rest of 
preprocessors like #if #endif...etc.

This is what I am including in my .emacs file:

(defconst lconfig-font-lock-faces  
  (list

   '(font-lock-function-name-face
     ((((class color)) (:foreground "DarkBlue"  :bold t))))

   '(font-lock-constant-face
     ((((class color)) (:foreground "Black"     :bold t))))


   '(font-lock-builtin-face
     ((((class color)) (:foreground nil))))

   '(font-lock-preprocessor-face
     ((((class color)) (:foreground nil))))

   )
  )

(autoload 'custom-set-faces "font-lock" "Set the color scheme" t)
(autoload 'font-lock-fontify-buffer "font-lock" "Fontify Buffer" t)
(progn (apply 'custom-set-faces lconfig-font-lock-faces)
       (add-hook 'c-mode-common-hook 'font-lock-fontify-buffer)
       (add-hook 'emacs-lisp-mode-hook 'font-lock-fontify-buffer)
       )
(global-font-lock-mode t)

(font-lock-add-keywords
 'c-mode
 '(
   ("^#[ \t]*\\(ifdef\\|else\\|ifndef\\|if 
!?defined\\|if\\|elif\\|endif\\|ident\\).*$" 1 font-lock-constant-face)         
         ;#defines
   ("\\(^#[ \t]*define\\|^#[ \t]*include\\|^#[ \t]*undef\\).*$" 1 
font-lock-function-name-face)                                     ;other #s
 )
)


Unfortunately when opening a c file I see #include and #define being black 
colored. Although they should match the regular expressions and turn to dark 
blue. 
Also #ifdef and #endif is in light dark color and not bold.

Not sure what I am doing wrong. Any help is highly appreciated.


reply via email to

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