unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Robert Thorpe" <rthorpe@realworldtech.com>
Subject: Re: How to make a new mode based on c++-mode
Date: 4 Dec 2006 08:10:54 -0800	[thread overview]
Message-ID: <1165248654.455807.262380@l12g2000cwl.googlegroups.com> (raw)
In-Reply-To: <mailman.1412.1165007734.2155.help-gnu-emacs@gnu.org>

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	other threads:[~2006-12-04 16:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1412.1165007734.2155.help-gnu-emacs@gnu.org>
2006-12-04 16:10 ` Robert Thorpe [this message]
2006-12-01 21:15 How to make a new mode based on c++-mode Helfer Thomas
     [not found] <mailman.1403.1164993075.2155.help-gnu-emacs@gnu.org>
2006-12-01 17:32 ` Robert Thorpe
  -- strict thread matches above, loose matches on Subject: below --
2006-12-01 17:11 Helfer Thomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1165248654.455807.262380@l12g2000cwl.googlegroups.com \
    --to=rthorpe@realworldtech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).