help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: tutorial on faces ?


From: Drew Adams
Subject: RE: tutorial on faces ?
Date: Thu, 7 Feb 2019 07:44:03 -0800 (PST)

> >>> And do you want the face highlighting to be
> >>>  automatically reapplied to those parts when
> >>>  the same text is visited anew (in the same
> >>>  mode), e.g. in a new Emacs session or after
> >>>  reverting the buffer?
> >>
> >> I'm not sure I understand the question.
> >
> > Do you want the highlighting to be inherently
> > associated with particular patterns, so that
> > whenever a buffer with those patterns is visited
> > in a particular mode the patterns get highlighted.
> 
> Yes. But I'm not sure I can call (my tweaked) poker.el a "mode". It is
> just a program that outputs strings based on inputs in a dedicated buffer.

The buffer is in a (major) mode.  You typically
define font-lock patterns for a given mode.
You can define your own major mode using
`define-derived-mode'.

I probably should have mentioned this: To highlight
parts of a string is one thing - use `propertize'
with property `face', for example.

To highlight parts of a buffer is something else.
You typically use font lock for this.  Font lock
periodically updates the highlighting, even as
you change buffer contents.  It applies a set of
highlighting rules (regexp patterns, for example),
in sequence.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]