unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* font-lock-keywords uses only facename
@ 2004-06-03 23:48 Alex Schroeder
  2004-06-03 23:55 ` Miles Bader
  0 siblings, 1 reply; 10+ messages in thread
From: Alex Schroeder @ 2004-06-03 23:48 UTC (permalink / 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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-06-06 22:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-03 23:48 font-lock-keywords uses only facename Alex Schroeder
2004-06-03 23:55 ` 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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).