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

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

Re: JFlex mode for FSF-Emacs ?


From: Stefan Monnier <address@hidden>
Subject: Re: JFlex mode for FSF-Emacs ?
Date: 22 Jan 2003 15:25:36 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>>>>> "Andreas" == Andreas Wieweg <address@hidden> writes:
> However there is almost no syntax-highligting when using FSF-Emacs, only
> comments and strings are highlighted.

Now you're talking.

> I thought that maybe some function/variable was used in the code,
> and that it was obvious for experienced emacs-lisp users that the
> function/variable was a XEmacs function/variable. But maybe it
> isn't that easy and takes more time and effort.

It's generally easier to find a bug when you know what you're looking for.
Given the lack of info, I didn't even bother to look.

Here's the problem:

XEmacs recommends to set up the font-lock info of a mode by adding
a `font-lock-defaults' property to the symbol of the major mode, as in:

   (put 'jflex-mode 'font-lock-defaults
     '(jflex-font-lock-keywords
       nil nil ((?_ . "w")) beginning-of-defun))

Instead, in Emacs, the recommended way is to set the `font-lock-defaults'
variable (buffer-locally).  So add to the definition of `jflex-mode'
(for example right after the call to `use-local-map' which you can remove
while you're at it since it's redundant):

  (set (make-local-variable 'font-lock-defaults)
       '(jflex-font-lock-keywords
         nil nil ((?_ . "w")) beginning-of-defun))

Note that XEmacs understands Emacs' way of doing things, so you can remove
the (put 'jflex-mode ...) stuff.


        Stefan


reply via email to

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