From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: font-lock-keywords: matcher function not working Date: Thu, 27 Jun 2013 13:32:57 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1372354411 30581 80.91.229.3 (27 Jun 2013 17:33:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 27 Jun 2013 17:33:31 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 27 19:33:31 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UsG4Y-0002qA-Bd for geh-help-gnu-emacs@m.gmane.org; Thu, 27 Jun 2013 19:33:30 +0200 Original-Received: from localhost ([::1]:56665 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsG4X-00070l-W4 for geh-help-gnu-emacs@m.gmane.org; Thu, 27 Jun 2013 13:33:29 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51432) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsG4K-00070O-V3 for help-gnu-emacs@gnu.org; Thu, 27 Jun 2013 13:33:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UsG4G-0005rD-Bp for help-gnu-emacs@gnu.org; Thu, 27 Jun 2013 13:33:16 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:42976) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsG4G-0005r0-5W for help-gnu-emacs@gnu.org; Thu, 27 Jun 2013 13:33:12 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UsG4E-0002Vi-D4 for help-gnu-emacs@gnu.org; Thu, 27 Jun 2013 19:33:10 +0200 Original-Received: from 76-10-154-64.dsl.teksavvy.com ([76-10-154-64.dsl.teksavvy.com]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 27 Jun 2013 19:33:10 +0200 Original-Received: from monnier by 76-10-154-64.dsl.teksavvy.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 27 Jun 2013 19:33:10 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 24 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 76-10-154-64.dsl.teksavvy.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:fP8jJlbCNmZbTR2K1N7cj0px72w= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:91790 Archived-At: > (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