From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Newsgroups: gmane.emacs.help Subject: Re: problem understanding font-lock-defaults structure Date: Wed, 8 Oct 2008 17:02:14 -0700 (PDT) Organization: http://groups.google.com Message-ID: <13173afe-f51c-4c67-b738-1949f2b28b5f@f40g2000pri.googlegroups.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1223512837 31755 80.91.229.12 (9 Oct 2008 00:40:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 9 Oct 2008 00:40:37 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Oct 09 02:41:33 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Knjau-0005vT-2g for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Oct 2008 02:41:32 +0200 Original-Received: from localhost ([127.0.0.1]:49076 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KnjZq-0003jx-7N for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Oct 2008 20:40:26 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!f40g2000pri.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 73 Original-NNTP-Posting-Host: 24.6.185.159 Original-X-Trace: posting.google.com 1223510534 5397 127.0.0.1 (9 Oct 2008 00:02:14 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 9 Oct 2008 00:02:14 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: f40g2000pri.googlegroups.com; posting-host=24.6.185.159; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.22, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:163247 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:58590 Archived-At: On Oct 8, 2:22=C2=A0pm, Nikolaj Schumacher wrote: > Xah wrote: > > 2008-01-13 > > ?? > > > After i evaluate the lisp code, i expect, the Sin should be syntax > > highlighted but is not. > > From the doc: "Defaults for Font Lock mode specified by the major mode." > > Setting this variable only works when you define a new major mode. =C2=A0= To > add keywords afterwards, use `font-lock-add-keywords' > > > I'm not sure how many level of list is required, or if the nesting is > > optional... > > Using multiple keywords is optional, i.e. you may leave out the two nils > and one level of parentheses. =C2=A0Your nesting and quoting is correct. > > You might also want to use "\\" instead of "Sin", etc. > > regards, > Nikolaj Schumacher Thanks... am having a headache with this. ;Why does the following works: ; Sin[x]^2 + Cos[y]^2 =3D 1 ; =CF=80^2/6 =3D=3D Sum[1/x^2,{x,1,=E2=88=9E}] (setq font-lock-keywords (quote ( ("Sin\\|Cos" . font-lock-function-name-face) ("=CF=80\\|=E2=88=9E" . font-lock-constant-face) ("x\\|y" . font-lock-variable-name-face) ) nil nil ) ) ;But in the following, i put my keywords into a var, the value of myKeywordsLevel1 is just the first element ("Sin\\|Cos" . font-lock- function-name-face)? (setq myKeywordsLevel1 (quote ("Sin\\|Cos" . font-lock-function-name-face) ("=CF=80\\|=E2=88=9E" . font-lock-constant-face) ("x\\|y" . font-lock-variable-name-face) ) ) (setq font-lock-keywords `( ,myKeywordsLevel1 nil nil ) ) (font-lock-fontify-buffer) Xah =E2=88=91 http://xahlee.org/ =E2=98=84