From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lute Kamstra Newsgroups: gmane.emacs.help Subject: Re: Replace regex strings with variables for font-lock Date: Thu, 28 Apr 2005 18:31:02 +0200 Message-ID: <87u0lqq2wp.fsf@xs4all.nl> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1114705876 26219 80.91.229.2 (28 Apr 2005 16:31:16 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 28 Apr 2005 16:31:16 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Apr 28 18:31:14 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DRBss-00062f-IS for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Apr 2005 18:29:02 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DRBz1-0006dO-Vz for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Apr 2005 12:35:24 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!border2.nntp.ams.giganews.com!nntp.giganews.com!transit.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: (Ryan Bowman's message of "Thu, 28 Apr 2005 09:03:02 -0700 (PDT)") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:Of+QNMCp4zzwXDBBDjv4IayJ+fQ= Original-Lines: 34 Original-NNTP-Posting-Host: 80.127.67.124 Original-X-Trace: 1114705862 news.xs4all.nl 151 [::ffff:80.127.67.124]:10009 Original-X-Complaints-To: abuse@xs4all.nl Original-Xref: shelby.stanford.edu gnu.emacs.help:130541 Original-To: help-gnu-emacs@gnu.org 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:26110 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:26110 Ryan Bowman writes: [...] > (setq my-mode-font-lock-keywords > (list > '("^#.*$" 0 'bold) > '("\\(foo\\)\\(bar\\)" ; the word foobar in two faces > (1 'font-lock-warning-face) > (2 'font-lock-type-face)))) > > That second part, being able to font-lock with > multiple faces is awesome. > Anyway, I want to replace the regex strings with > customizable variables, so I used defcustom to define > a variable and then in place of '("&#.*S" 0 'bold) I > tried '(my-var 0 'bold) but it didn't work, meaning to > the face wasn't applied. I tried defining the > variable with defcustom and defvar but neither had the > effect I wanted. Is there a way to use defcustom to > define a variable that contains a regex that will be > recognized by font-lock? (setq my-mode-font-lock-keywords `((,my-var 0 'bold) ("\\(foo\\)\\(bar\\)" (1 'font-lock-warning-face) (2 'font-lock-type-face)))) Lute. -- (spook) => "UOP Agfa computer terrorism" (insert-file-contents "~/.signature") => (error "`~/.signature' too rude")