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: Thu, 9 Oct 2008 14:40:13 -0700 (PDT) Organization: http://groups.google.com Message-ID: <5f116baa-33e0-48ed-a27e-8446a7791c1d@a18g2000pra.googlegroups.com> References: <13173afe-f51c-4c67-b738-1949f2b28b5f@f40g2000pri.googlegroups.com> <296d3d40-598c-4ea4-8394-c69975c0399f@a3g2000prm.googlegroups.com> 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 1223592051 29269 80.91.229.12 (9 Oct 2008 22:40:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 9 Oct 2008 22:40:51 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 10 00:41:49 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 1Ko4CY-0007qJ-K7 for geh-help-gnu-emacs@m.gmane.org; Fri, 10 Oct 2008 00:41:46 +0200 Original-Received: from localhost ([127.0.0.1]:45696 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ko4BU-0000mg-Gl for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Oct 2008 18:40:40 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newsfeed.stanford.edu!postnews.google.com!a18g2000pra.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 66 Original-NNTP-Posting-Host: 24.6.185.159 Original-X-Trace: posting.google.com 1223588414 3122 127.0.0.1 (9 Oct 2008 21:40:14 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 9 Oct 2008 21:40:14 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: a18g2000pra.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:163298 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:58641 Archived-At: On Oct 9, 10:16 am, Nikolaj Schumacher wrote: > Here's a complete, working example: > > (setq myKeywordsLevel1 > '(("Sin\\|Cos" . font-lock-function-name-face) > ("=CF=80\\|=E2=88=9E" . font-lock-constant-face) > ("x\\|y" . font-lock-variable-name-face))) > > (define-derived-mode foo-mode fundamental-mode > (setq font-lock-defaults '(myKeywordsLevel1))) > > > Its value is > > (t > > (myKeywordsLevel1) > > (myKeywordsLevel1 > > (0 font-lock-keyword-face))) > > > Local in buffer untitled<3>; > > =C2=BB > > > Where did all the extra came from? > > The list has been "compiled". The t marks it as such, so it isn't > processed twice. Due to this kind of voodoo, I avoid touching > `font-lock-keywords'. I use `font-lock-add-keywords'. Thanks a lot. That's helpful and much info in this thread. possibly begging, is it possible to get this to work with using font- lock-keywords? Here's what i have now based on all the info in this thread. I couldn't see where it went wrong. ; Sin[x]^2 + Cos[y]^2 =3D 1 ; =CF=80^2/6 =3D=3D Sum[1/x^2,{x,1,=E2=88=9E}] (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) In the =E2=80=9Csetq font-lock-keywords=E2=80=9D, block, i tried various qu= oting and nesting but no go. Xah =E2=88=91 http://xahlee.org/ =E2=98=84