all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Jean-Christophe Helary <brandelune@gmail.com>,
	help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: RE: tutorial on faces ?
Date: Thu, 7 Feb 2019 07:04:12 -0800 (PST)	[thread overview]
Message-ID: <2105bb15-c923-4887-935d-c3fc8bc4b290@default> (raw)
In-Reply-To: <29567580-B9BC-4942-AA7A-2183C28304E4@gmail.com>

> >  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	other threads:[~2019-02-07 15:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-06 13:38 tutorial on faces ? Jean-Christophe Helary
2019-02-06 15:22 ` Drew Adams
2019-02-06 15:32   ` Jean-Christophe Helary
2019-02-06 16:45     ` Drew Adams
2019-02-07  5:47       ` Jean-Christophe Helary
2019-02-07 15:04         ` Drew Adams [this message]
2019-02-07 15:15           ` Jean-Christophe Helary
2019-02-07 15:44             ` Drew Adams
2019-02-07 15:58               ` Jean-Christophe Helary
2019-02-07 17:54                 ` Drew Adams

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

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

  git send-email \
    --in-reply-to=2105bb15-c923-4887-935d-c3fc8bc4b290@default \
    --to=drew.adams@oracle.com \
    --cc=brandelune@gmail.com \
    --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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.