all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Marcin Borkowski <mbork@wmi.amu.edu.pl>
To: help-gnu-emacs@gnu.org
Subject: Re: Help with font-lock-add-keywords
Date: Fri, 13 Mar 2015 04:46:21 +0100	[thread overview]
Message-ID: <87oanxef02.fsf@wmi.amu.edu.pl> (raw)
In-Reply-To: <873859shaa.fsf@debian.uxu>


On 2015-03-13, at 04:33, Emanuel Berg <embe8573@student.uu.se> wrote:

> Marcin Borkowski <mbork@wmi.amu.edu.pl> writes:
>
>> I'm trying to grok the font-lock-add-keywords
>> function. Why doesn't this work (i.e., turn all
>> foo's into italic ones)?
>>
>> (font-lock-add-keywords nil '(("foo" . italic)))
>
> Try this - it should look like this after you put
> Emacs into emacs-lisp-mode:
>
>     http://user.it.uu.se/~embe8573/cols/www/dumps/emacs_faces.png
>
> (font-lock-add-keywords 'emacs-lisp-mode
>   '(
>     ("font-lock-builtin-face"              .  font-lock-builtin-face)
>     ("font-lock-comment-delimiter-face"    .  font-lock-comment-delimiter-face)
>     ("font-lock-comment-face"              .  font-lock-comment-face)
>     ("font-lock-constant-face"             .  font-lock-constant-face)
>     ("font-lock-doc-face"                  .  font-lock-doc-face)
>     ("font-lock-function-name-face"        .  font-lock-function-name-face)
>     ("font-lock-keyword-face"              .  font-lock-keyword-face)
>     ("font-lock-negation-char-face"        .  font-lock-negation-char-face)
>     ("font-lock-preprocessor-face"         .  font-lock-preprocessor-face)
>     ("font-lock-reference-face"            .  font-lock-reference-face)
>     ("font-lock-string-face"               .  font-lock-string-face)
>     ("font-lock-syntactic-face-function"   .  font-lock-syntactic-face-function)
>     ("font-lock-type-face"                 .  font-lock-type-face)
>     ("font-lock-variable-name-face"        .  font-lock-variable-name-face)
>     ("font-lock-warning-face"              .  font-lock-warning-face)
>     ("font-lock-regexp-grouping-construct" . 'font-lock-regexp-grouping-construct)
>     ("font-lock-regexp-grouping-backslash" . 'font-lock-regexp-grouping-backslash)
>     )
>   t)

Thanks!

This works - sort of.  First of all, not all faces are set correctly
until I edit something in the respective line.  And M-x
font-lock-fontify-buffer doesn't help - I don't understand this,
actually.  (Tested on emacs -Q.)

Even worse, if I add ("foo" . italic) to the list above, occurrences of
"foo" don't get italicized.  (M-x describe-face italic shows that my
computer /can/ display this face properly.)

What am I doing wrong?

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



  reply	other threads:[~2015-03-13  3:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1931.1426216826.31049.help-gnu-emacs@gnu.org>
2015-03-13  3:33 ` Help with font-lock-add-keywords Emanuel Berg
2015-03-13  3:46   ` Marcin Borkowski [this message]
2015-03-13  3:20 Marcin Borkowski
2015-03-13  3:47 ` Michael Heerdegen
2015-03-13  6:39   ` Marcin Borkowski
2015-03-13 12:31     ` Robert Thorpe
2015-03-13 14:37     ` Drew Adams
2015-03-13 14:52       ` Marcin Borkowski

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=87oanxef02.fsf@wmi.amu.edu.pl \
    --to=mbork@wmi.amu.edu.pl \
    --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.