From: Xah <xahlee@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: problem understanding font-lock-defaults structure
Date: Thu, 9 Oct 2008 08:29:02 -0700 (PDT) [thread overview]
Message-ID: <296d3d40-598c-4ea4-8394-c69975c0399f@a3g2000prm.googlegroups.com> (raw)
In-Reply-To: mailman.677.1223550826.25473.help-gnu-emacs@gnu.org
(setq myKeywordsLevel1
(list
("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)))
Thanks.
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
'(
myKeywordsLevel1
)
)
(font-lock-fontify-buffer)
... 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
(t
(myKeywordsLevel1)
(myKeywordsLevel1
(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.)
Thanks.
Xah
∑ http://xahlee.org/
☄
next prev parent reply other threads:[~2008-10-09 15:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-08 18:46 problem understanding font-lock-defaults structure Xah
2008-10-08 21:22 ` Nikolaj Schumacher
[not found] ` <mailman.619.1223500981.25473.help-gnu-emacs@gnu.org>
2008-10-09 0:02 ` Xah
2008-10-09 0:54 ` Lennart Borgman (gmail)
2008-10-09 2:25 ` Kevin Rodgers
[not found] ` <mailman.643.1223519147.25473.help-gnu-emacs@gnu.org>
2008-10-09 21:18 ` Xah
2008-10-09 11:13 ` Nikolaj Schumacher
[not found] ` <mailman.637.1223513718.25473.help-gnu-emacs@gnu.org>
2008-10-09 15:04 ` Xah
2008-10-09 15:26 ` harven
2008-10-09 17:17 ` Nikolaj Schumacher
[not found] ` <mailman.677.1223550826.25473.help-gnu-emacs@gnu.org>
2008-10-09 15:29 ` Xah [this message]
2008-10-09 17:16 ` Nikolaj Schumacher
[not found] ` <mailman.719.1223572620.25473.help-gnu-emacs@gnu.org>
2008-10-09 21:40 ` Xah
2008-10-09 23:27 ` Nikolaj Schumacher
[not found] ` <mailman.739.1223594868.25473.help-gnu-emacs@gnu.org>
2008-10-10 0:20 ` Xah
2008-10-10 0:45 ` Tim X
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=296d3d40-598c-4ea4-8394-c69975c0399f@a3g2000prm.googlegroups.com \
--to=xahlee@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.