emacs-devel
[Top][All Lists]
Advanced

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

Re: Need help with search based font-locking


From: Lennart Borgman
Subject: Re: Need help with search based font-locking
Date: Mon, 28 Dec 2009 14:54:51 +0100

On Mon, Dec 28, 2009 at 2:20 PM, Tassilo Horn <address@hidden> wrote:
> Lennart Borgman <address@hidden> writes:
>
> Hi Lennart,


Hi Tassilo,


>> This is slightly better:
>>
>> Index: font-lock.el
>> ===================================================================
>> RCS file: /sources/emacs/emacs/lisp/font-lock.el,v
>> retrieving revision 1.354
>> diff -c -r1.354 font-lock.el
>> *** font-lock.el      2 Oct 2009 03:48:41 -0000       1.354
>> --- font-lock.el      24 Dec 2009 13:47:41 -0000
>> ***************
>> *** 1767,1772 ****
>> --- 1767,1790 ----
>>
>>   (defvar font-lock-set-defaults nil) ; Whether we have set up defaults.
>>
>> + (defun font-lock-refresh-defaults ()
>> +   "Restart fontification in current buffer after recomputing from defaults.
>> + Recompute fontification variables using `font-lock-defaults' (or,
>> + if nil, using `font-lock-defaults-alist') and
>> + `font-lock-maximum-decoration'.  Then restart fontification.
>> +
>> + Use this function when you have changed any of the above
>> + variables directly.
>> +
>> + Note: This function will erase modifications done by
>> + `font-lock-add-keywords' or `font-lock-remove-keywords', but will
>> + preserve `hi-lock-mode' highlighting patterns \(and any other
>> + setting set up in `fontlock-mode-hook')."
>> +   (let (font-lock-mode-hook)
>> +     (font-lock-mode -1))
>> +   (kill-local-variable 'font-lock-set-defaults)
>> +   (font-lock-mode 1))
>> +
>>   (defvar font-lock-mode-major-mode)
>>   (defun font-lock-set-defaults ()
>>     "Set fontification defaults appropriately for this mode.
>
> What's the reason for disabling `font-lock-mode-hook' while deactivating
> `font-lock-mode', but not while enabling it again?


Oh, thanks. I should have commented on that in the code.

It is just because hi-lock is turned off otherwise. But there is a variable

  hi-lock--inhibit-font-lock-hook

I could have used too. However I thought there might be other things
behaving similar to hi-lock in this respect.



> Bye,
> Tassilo
>
>
>




reply via email to

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