unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Dieter Wilhelm <dieter@duenenhof-wilhelm.de>
Cc: help-gnu-emacs@gnu.org
Subject: Re: fontifying of user defined variables
Date: Sat, 16 Sep 2006 09:42:05 +0200	[thread overview]
Message-ID: <877j04ntpu.fsf@hans.local.net> (raw)
In-Reply-To: <1158245236.678432.310180@m73g2000cwd.googlegroups.com> (rgb's message of "14 Sep 2006 07\:47\:16 -0700")

"rgb" <rbielaws@i1.net> 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

      reply	other threads:[~2006-09-16  7:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-12 10:00 fontifying of user defined variables dieter
2006-09-13 21:54 ` Dieter Wilhelm
     [not found] ` <mailman.6912.1158195722.9609.help-gnu-emacs@gnu.org>
2006-09-14 14:47   ` rgb
2006-09-16  7:42     ` Dieter Wilhelm [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877j04ntpu.fsf@hans.local.net \
    --to=dieter@duenenhof-wilhelm.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).