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

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

Re: How to make a new mode based on c++-mode


From: Robert Thorpe
Subject: Re: How to make a new mode based on c++-mode
Date: 4 Dec 2006 08:10:54 -0800
User-agent: G2/1.0

Helfer Thomas wrote:
> following awk.el i have tried the following :
>
> ;;; -*-emacs-lisp-*-
> ;;; castfront.el --- ELisp package for making castfront related stuff
> easier.
>
> (provide 'castfront)
>
> (defconst castfront-keywords
>   (list
>    (list
>     "\\(@\\(Coef\\)\\)\\>"
>     '(0 font-lock-warning-face prepend))
>    ))
>
> ;;;###autoload
> (define-derived-mode castfront-mode c++-mode "CASTFRONT"
>   "Major mode for editing castfront code."
>   (setq font-lock-defaults '(castfront-keywords)))
>
> This make @Coef to be highlighted by not standard c++-keywords. What I
> am doing wrong ?

What you have written probably works.  However your new mode is not in
font-lock-global-modes so turning on global-font-lock mode doesn't turn
it on.  The common solution is to add a hook to turn font-lock on for
your new mode in .emacs for example.

This applies whether or not you're using a derived mode.



reply via email to

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