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

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

Re: font lock woes


From: Stefan Monnier
Subject: Re: font lock woes
Date: Mon, 04 Mar 2013 11:03:42 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> This suggests to me that I should be able to do:
> ,----
> | (font-lock-add-keywords nil `((,(regexp-quote "{++") . '(face 
> cm-addition-face read-only t))) t)
> `----
> but for some reason, the only thing that works is:
> ,----
> | (font-lock-add-keywords nil `((,(regexp-quote "{++") 0 '(face 
> cm-addition-face read-only t))
> `----

In which way does the other one not work?  Did you check the resulting
font-lock-keywords?

> A second thing I don't understand is how to remove the read-only
> property again when the mode is deactivated.  I was thinking I should be
> able to do the following:

> ,----
> | (font-lock-remove-keywords nil `((,(regexp-quote "{++") 0 '(face 
> cm-addition-face read-only t))))
> | (let ((inhibit-read-only t))
> |   (font-lock-fontify-buffer))
> | (setq font-lock-extra-managed-props (delq 'read-only 
> font-lock-extra-managed-props))
> `----

font-lock-fontify-buffer just schedules a refontification, which will be
done later, on-the-fly, piece by piece as text is displayed.

Much simpler is to remove-text-properties by hand.


        Stefan




reply via email to

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