[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
font-lock-keywords: matcher function not working
From: |
Raffaele Ricciardi |
Subject: |
font-lock-keywords: matcher function not working |
Date: |
Thu, 27 Jun 2013 14:39:17 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 |
Hello everybody,
I'm trying to highlight the first parenthesis of each line in Lisp code.
After having read the documentation of `font-lock-keywords', I've
written a matcher function which behaves as required (I've tested it
with `eval-expression'). However, first parentheses are not
highlighted.
Here is my code, tested on GNU Emacs 24.3
;; Tested in the *scratch* buffer after "emacs -Q".
(require 'cl)
(defun* rr-first-non-blank? (&optional (point (point)))
"Return non-NIL if POINT is on the first non-blank character of the
current line."
(= point
(save-excursion
(back-to-indentation)
(point))))
(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)
))
(font-lock-fontify-buffer)
- font-lock-keywords: matcher function not working,
Raffaele Ricciardi <=
- Re: font-lock-keywords: matcher function not working, Raffaele Ricciardi, 2013/06/27
- Re: font-lock-keywords: matcher function not working, Stefan Monnier, 2013/06/27
- Message not available
- Re: font-lock-keywords: matcher function not working, rfflrccrd, 2013/06/28
- Re: font-lock-keywords: matcher function not working, Stefan Monnier, 2013/06/28
- Message not available
- Re: font-lock-keywords: matcher function not working, Raffaele Ricciardi, 2013/06/28
- Re: font-lock-keywords: matcher function not working, Stefan Monnier, 2013/06/28
- Message not available
- Re: font-lock-keywords: matcher function not working, Raffaele Ricciardi, 2013/06/29
- Re: font-lock-keywords: matcher function not working, Raffaele Ricciardi, 2013/06/29