[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem when optimizing font-lock-keywords
From: |
Nordlöw |
Subject: |
Problem when optimizing font-lock-keywords |
Date: |
Tue, 21 Oct 2008 07:06:13 -0700 (PDT) |
User-agent: |
G2/1.0 |
I am trying to optimize my extra calls to font-lock-add-keywords() by
concatenating the MATCHERs like follows:
(defun pnw-fancy/sh-mode-font-locking ()
"Fancy Shell Script Syntax Highlighting."
(font-lock-add-keywords
nil
(list
(cons (concat "\\((\\|)\\)" "?"
"\\(\\[\\|]\\|{\\|}\\)" "?"
"\\(,\\|;\\)")
'((1 'font-lock-parens-face keep)
(2 'font-lock-braces-face keep)
(3 'font-lock-separator-face keep)))
)
t))
(add-hook 'sh-mode-hook 'pnw-fancy/sh-mode-font-locking t)
I believe this idea is used in emacs-lisp-mode() but I can't make it
work --- I get the error:
Error during redisplay: (error No match 1 in highlight (1 (quote font-
lock-parens-face) keep)) [5 times]
What have I missed?
Many thanks in advance,
Nordlöw
- Problem when optimizing font-lock-keywords,
Nordlöw <=