From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dieter Wilhelm Newsgroups: gmane.emacs.help Subject: Re: fontifying of user defined variables Date: Sat, 16 Sep 2006 09:42:05 +0200 Organization: The Church of Emacs Message-ID: <877j04ntpu.fsf@hans.local.net> References: <10129949.484411158055226421.JavaMail.servlet@kundenserver> <1158245236.678432.310180@m73g2000cwd.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1158403018 24243 80.91.229.2 (16 Sep 2006 10:36:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 16 Sep 2006 10:36:58 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Sep 16 12:36:56 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GOXXW-0003b0-QH for geh-help-gnu-emacs@m.gmane.org; Sat, 16 Sep 2006 12:36:51 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GOXXW-0001E3-9d for geh-help-gnu-emacs@m.gmane.org; Sat, 16 Sep 2006 06:36:50 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GOXXK-0001DO-9s for help-gnu-emacs@gnu.org; Sat, 16 Sep 2006 06:36:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GOXXH-0001B7-Eu for help-gnu-emacs@gnu.org; Sat, 16 Sep 2006 06:36:37 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GOXXH-0001B4-BC for help-gnu-emacs@gnu.org; Sat, 16 Sep 2006 06:36:35 -0400 Original-Received: from [212.227.126.186] (helo=moutng.kundenserver.de) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GOXZe-0000A0-8r for help-gnu-emacs@gnu.org; Sat, 16 Sep 2006 06:39:02 -0400 Original-Received: from [84.167.40.99] (helo=duenenhof-wilhelm.de) by mrelayeu.kundenserver.de (node=mrelayeu5) with ESMTP (Nemesis), id 0ML25U-1GOXX91vZP-0007ib; Sat, 16 Sep 2006 12:36:28 +0200 Original-Received: by duenenhof-wilhelm.de (Postfix, from userid 1000) id A6BDC715BA; Sat, 16 Sep 2006 09:42:05 +0200 (CEST) Original-To: "rgb" In-Reply-To: <1158245236.678432.310180@m73g2000cwd.googlegroups.com> (rgb's message of "14 Sep 2006 07\:47\:16 -0700") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-Provags-ID: kundenserver.de abuse@kundenserver.de login:d7ab225b98a136e1c2910381f940ecb9 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:37407 Archived-At: "rgb" writes: > Dieter Wilhelm wrote: >> dieter@duenenhof-wilhelm.de writes: >> > >> > I'd like to highlight user specified variables in a major mode for a >> > simple macro language (Ansys parametric design language or APDL). >> > All number variables are specified with the following assignment: >> > >> > VARIABEL=VALUE ... >> > > The potential problem is that variables will be highlighted no matter > where they appear. Even before the point they are defined. Right, since Ansys allows variables names which are identical to some command options, for example. > > The only way around that problem (that I know of) is to supply a > function rather than a regexp to font-lock-keywords. The ... > must know what to look for (because it's only argument is > search-limit) whereas re-search-forward gets a regexp argument > that tells it what to look for. I see, thanks for the introduction to the enhanced font-lock capability. > > Your periodic scanning function would still maintain a list of > variable names to highlight but wouldn't update font-lock-keywords. > Instead, it saves them to some other variable of your choosing in > a list that includes a marker to where the definition was detected. > I could use some timer, I've never tried but I guess there is a timer functionality in Emacs which allows such a scanning operation only when Emacs is idling. > The function you provide to font-lock-keywords would then > find keywords (variable names) only if they occured after the ... > it over and over. > > Good luck Thanks for your friendly advice. -- Best wishes H. Dieter Wilhelm Darmstadt, Germany