unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Problem when optimizing font-lock-keywords
@ 2008-10-21 14:06 Nordlöw
  2008-10-21 21:26 ` Nikolaj Schumacher
  0 siblings, 1 reply; 2+ messages in thread
From: Nordlöw @ 2008-10-21 14:06 UTC (permalink / raw)
  To: help-gnu-emacs

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


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

end of thread, other threads:[~2008-10-21 21:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-21 14:06 Problem when optimizing font-lock-keywords Nordlöw
2008-10-21 21:26 ` Nikolaj Schumacher

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).