[Top][All Lists]

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

Re: problem understanding font-lock-defaults structure

From: Xah
Subject: Re: problem understanding font-lock-defaults structure
Date: Thu, 9 Oct 2008 08:29:02 -0700 (PDT)
User-agent: G2/1.0

(setq myKeywordsLevel1
    ("Sin\\|Cos" . font-lock-function-name-face)
    ("π\\|∞" . font-lock-constant-face)
    ("x\\|y" . font-lock-variable-name-face)))

Are you sure? It gives (invalid-function "Sin\\|Cos").

> There's no need to use `, here.  `font-lock-keywords' accepts symbols.
> (setq font-lock-keywords '((myKeywordsLevel1 nil nil)))


I tried the following but still not working:

; Sin[x]^2 + Cos[y]^2 = 1
; π^2/6 == Sum[1/x^2,{x,1,∞}]

(setq myKeywordsLevel1
   ("Sin\\|Cos" . font-lock-function-name-face)
   ("π\\|∞" . font-lock-constant-face)
   ("x\\|y" . font-lock-variable-name-face)

(setq font-lock-keywords


... quite frustrated by this.

after eval that form, than i looked at the value of font-lock-keywords
using describe-variable, it says:
Its value is
  (0 font-lock-keyword-face)))

Local in buffer untitled<3>;

Where did all the extra came from?

I tried various quoting, like “'((...) ...)”, “(quote (list ...))”,
“`( ,...)” in one or the other code block, and also tried a deeper
nested for the value of the value for font-lock-keywords ... (... some
background: am trying to write lsl-mode (yes i know existing ones) and
meanwhile write a simple tutorial about writing mode from the ground
up. I have read the chapters on major mode and font lock mode, also
have taken apart few lang modes. I have a working mode but want
understanding and a simple example.)



reply via email to

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