help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: font-lock-keywords: matcher function not working


From: Stefan Monnier
Subject: Re: font-lock-keywords: matcher function not working
Date: Thu, 27 Jun 2013 13:32:57 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> (defun rr-match-indented-paren (^end)
>   "Matcher for `font-lock-keywords' that matches a parenthesis made
>  redundant by indentation."
>   (if (and (eql (char-after) ?\()
>            (rr-first-non-blank?))
>       (re-search-forward "(" ^end)
>       nil))

> (font-lock-add-keywords 'lisp-interaction-mode
>                         '(
>                           (rr-match-indented-paren
> . 'font-lock-warning-face)
>                           ))

Your rr-match-indented-paren should *search* rather than only check the
current position.

While I'm here, I recommend you (setq font-lock-support-mode nil) then
disable&enable font-lock so that jit-lock won't be used: this makes it
much easier to debug the code, especially when it signals errors (or
course, you also want to set debug-on-error to t).


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]