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:04:12 -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.

As opposed to just wanting to highlight something
now, but not have the same highlighting done
automatically just because you revisit the same
text in the same mode later.
 
> The way I've tweaked poker.el makes it (insert) strings that indicate
> player actions and results into a dedicated buffer. I'd like the buffer
> to always display the same style while the buffer exists.
> 
> There are some echo line (message) strings but I'm fine without having
> them styled.

Messages in the echo area are a different story.
Instead of using font lock there, you just use
`propertize' to apply property `face' to the
parts of the message you want to highlight, then
call function `message'.

> >   If the answer is yes then look at using
> >   `font-lock-mode' to define and highlight those
> >   parts.
> 
> So I guess the answer is Yes.

It sounds like it (except for echo-area messaging).

I'm guessing you can find tutorials or videos or
blogs that introduce font-lock.  If not (or even
if so), consult the Elisp manual, starting with
node Font Lock Mode (`C-h i g (elisp)font lock mode').

https://www.gnu.org/software/emacs/manual/html_node/elisp/Font-Lock-Mode.html

Admittedly, that can be heavy going - font lock can
be complicated.  Start with an intro (e.g. blog), if
you find a good one.



reply via email to

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