all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Raffaele Ricciardi <rfflrccrd@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: font-lock-keywords: matcher function not working
Date: Sat, 29 Jun 2013 10:53:48 +0200	[thread overview]
Message-ID: <b37lkvFc3u8U1@mid.individual.net> (raw)
In-Reply-To: <mailman.2762.1372473348.22516.help-gnu-emacs@gnu.org>

On 29/06/13 04:35, Stefan Monnier wrote:
>> Thank you again, Stefan.  However, I still don't understand.
>
> Your function should search for the first occurrence of the thing you're
> looking for, between here and ^end and only if there isn't any should it
> return nil.
>
> Instead, your current function only checks whether "here" is a spot that
> matches the thing you're looking for.  Instead, when you find out that
> "here" is not a match, don't return nil: try to look further instead.
> This is typically done with a loop.
>
> In your case, I wouldn't use a function anyway: I'd just use a regexp
> like "^[^ \t]*(".

Thank you for your attention, Stefan.  Now I understand what the font lock
engine requires.

Following your suggestion, this snippet performs the desired highlighting:

(font-lock-add-keywords 'lisp-interaction-mode
                         '(
                           ("^[[:blank:]]*\\((\\)" 1 
'font-lock-warning-face)
                           ))

However, unless I restart `lisp-interaction-mode', no highlighting occurs,
neither it does if I just restart `font-lock-mode'.  Why is it so?  I 
was expecting
`font-lock-fontify-buffer' to apply the new rules.



  parent reply	other threads:[~2013-06-29  8:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-27 12:39 font-lock-keywords: matcher function not working Raffaele Ricciardi
2013-06-27 12:40 ` Raffaele Ricciardi
2013-06-27 17:32 ` Stefan Monnier
     [not found] ` <mailman.2602.1372354403.22516.help-gnu-emacs@gnu.org>
2013-06-28 10:43   ` rfflrccrd
2013-06-28 19:30     ` Stefan Monnier
     [not found]     ` <mailman.2731.1372447819.22516.help-gnu-emacs@gnu.org>
2013-06-28 20:50       ` Raffaele Ricciardi
2013-06-29  2:35         ` Stefan Monnier
     [not found]         ` <mailman.2762.1372473348.22516.help-gnu-emacs@gnu.org>
2013-06-29  8:53           ` Raffaele Ricciardi [this message]
2013-06-29 13:32             ` Raffaele Ricciardi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b37lkvFc3u8U1@mid.individual.net \
    --to=rfflrccrd@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.