[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tutorial on faces ?
From: |
Jean-Christophe Helary |
Subject: |
Re: tutorial on faces ? |
Date: |
Thu, 7 Feb 2019 14:47:56 +0900 |
> On Feb 7, 2019, at 1:45, Drew Adams <drew.adams@oracle.com> wrote:
>
>> Well, I'm tweaking poker.el at the moment and I'm looking for ways to
>> apply style to some parts of the messages.
>>
>> Honestly, the elisp manual gives me no idea how to do that...
>
> OK, good. But what do you mean by "style"?
> Do you mean that you want to apply a face to some
> parts of some messages?
That's correct.
Coming from a HTML+CSS background, I thought that I could find a way to:
1) define some styles (for ex. "poker-action" as an already defined emacs
standard style)
2) select the strings that need style (for ex "folds|calls|checks|raises")
3) apply the "poker-action" style to the defined selected strings
I was thus looking for a way to define styles, a way to select strings (or
positions) and a way to apply the style to the selected strings.
> If so:
>
> 1. Do you want to apply the face to the buffer
> _positions_ of those msg parts, as an _overlay_
> property, or do you want to apply it to the
> _characters_ of those msg parts, as a _text_
> property?
I don't know which is more appropriate to what I have.
> 2. Are those message parts recognizable/definable
> in a regular way, i.e., as something that you
> can define using one or more regexps?
Yes.
> 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.
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.
> If the answer is yes then look at using
> `font-lock-mode' to define and highlight those
> parts. If the answer is no then maybe look
> at using ad hoc highlighting, such as you get
> with library `highlight.el':
>
> https://www.emacswiki.org/emacs/HighlightLibrary
So I guess the answer is Yes.
> Knowing the answers to these, and perhaps other,
> questions might help you direct your search for
> tutorials (e.g. whether to look for tutorials
> that involve font-lock highlighting).
>
> The more you can specify about what you're
> interested in, the more helpful people and search
> can be.
Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune
- tutorial on faces ?, Jean-Christophe Helary, 2019/02/06
- RE: tutorial on faces ?, Drew Adams, 2019/02/06
- Re: tutorial on faces ?, Jean-Christophe Helary, 2019/02/06
- RE: tutorial on faces ?, Drew Adams, 2019/02/06
- Re: tutorial on faces ?,
Jean-Christophe Helary <=
- RE: tutorial on faces ?, Drew Adams, 2019/02/07
- Re: tutorial on faces ?, Jean-Christophe Helary, 2019/02/07
- RE: tutorial on faces ?, Drew Adams, 2019/02/07
- Re: tutorial on faces ?, Jean-Christophe Helary, 2019/02/07
- RE: tutorial on faces ?, Drew Adams, 2019/02/07