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 08:29:02 -0700 (PDT) Organization: http://groups.google.com Message-ID: <296d3d40-598c-4ea4-8394-c69975c0399f@a3g2000prm.googlegroups.com> References: <13173afe-f51c-4c67-b738-1949f2b28b5f@f40g2000pri.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 1223567249 26048 80.91.229.12 (9 Oct 2008 15:47:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 9 Oct 2008 15:47:29 +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 17:48:23 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 1Knxhh-00088S-VO for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Oct 2008 17:45:30 +0200 Original-Received: from localhost ([127.0.0.1]:60235 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Knxgd-0002Ua-8S for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Oct 2008 11:44:23 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!news-out.readnews.com!transit3.readnews.com!postnews.google.com!a3g2000prm.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 67 Original-NNTP-Posting-Host: 24.6.185.159 Original-X-Trace: posting.google.com 1223566142 25113 127.0.0.1 (9 Oct 2008 15:29:02 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 9 Oct 2008 15:29:02 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: a3g2000prm.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:163286 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:58627 Archived-At: (setq myKeywordsLevel1 (list ("Sin\\|Cos" . font-lock-function-name-face) ("=CF=80\\|=E2=88=9E" . 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 =3D 1 ; =CF=80^2/6 =3D=3D Sum[1/x^2,{x,1,=E2=88=9E}] (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) ) ) (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: =C2=AB 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? I tried various quoting, like =E2=80=9C'((...) ...)=E2=80=9D, =E2=80=9C(quo= te (list ...))=E2=80=9D, =E2=80=9C`( ,...)=E2=80=9D 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 =E2=88=91 http://xahlee.org/ =E2=98=84