From: Alex Schroeder <alex@emacswiki.org>
Subject: font-lock-keywords uses only facename
Date: Fri, 04 Jun 2004 01:48:10 +0200 [thread overview]
Message-ID: <87oeo0i4p1.fsf@emacswiki.org> (raw)
Today I wrote a very small generic mode for lists of emails.
define-generic-mode's parameter font-lock-list is used to set
font-lock-keywords, eventually.
My problem was that I didn't know that font-lock-keywords doesn't
take faces. It only takes expressions that evaluate to faces.
Therefore, the following font-lock-list doesn't work. Only the
keyword regexp is shown:
(defface mail-list-whitespace '((t (:background "orange"))) "For whitespace.")
(defface mail-list-empty-lines '((t (:background "red"))) "For empty lines.")
(define-generic-mode 'mail-list-mode
nil
nil
'(("^[a-z]+@[a-z.]+\\.[a-z][a-z]+$" . font-lock-keyword-face)
("[ \t]+" . mail-list-whitespace)
("^\n" . mail-list-empty-lines))
'("\\blist\\'")
nil
"Mode used for Minimalist lists: One email per line.")
I must either use variables:
(setq mail-list-whitespace 'mail-list-whitespace)
(setq mail-list-empty-lines 'mail-list-empty-lines)
Or I must use quotes inside the list:
(define-generic-mode 'mail-list-mode
nil
nil
'(("^[a-z]+@[a-z.]+\\.[a-z][a-z]+$" . font-lock-keyword-face)
("[ \t]+" . 'mail-list-whitespace)
("^\n" . 'mail-list-empty-lines))
'("\\blist\\'")
nil
"Mode used for Minimalist lists: One email per line.")
Is this on purpose? Would it break anything if using faces were
allowed directly?
Alex.
--
.O. http://www.emacswiki.org/alex/
..O Schroeder's fourth law:
OOO None of your friends and coworkers share your taste in music.
next reply other threads:[~2004-06-03 23:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-03 23:48 Alex Schroeder [this message]
2004-06-03 23:55 ` font-lock-keywords uses only facename Miles Bader
2004-06-04 3:33 ` Stefan Monnier
2004-06-04 3:41 ` Miles Bader
2004-06-04 3:58 ` Stefan Monnier
2004-06-04 4:08 ` Miles Bader
2004-06-05 15:58 ` Stefan
2004-06-05 13:47 ` Richard Stallman
2004-06-05 23:03 ` Miles Bader
2004-06-06 22:33 ` Richard Stallman
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=87oeo0i4p1.fsf@emacswiki.org \
--to=alex@emacswiki.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.