[Top][All Lists]
[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: |
Thu, 24 Dec 2009 04:45:35 +0100 |
On Thu, Dec 24, 2009 at 4:07 AM, Stefan Monnier
<address@hidden> wrote:
>> (let (font-lock-set-defaults) (font-lock-set-defaults))
>> (jit-lock-refontify (point-min) (point-max))
>> (redisplay t)
>
> This assumes lots of things about font-lock's implementation (including
> the use of jit-lock).
> A slightly less invasive implementation would be:
>
> (font-lock-mode -1)
> (kill-local-variable 'font-lock-set-defaults)
> (font-lock-mode 1)
>
> tho the `font-lock-set-defaults' bit is still ugly.
>
> So, I'd recommend you submit a patch which adds a new function that does
> the above 3 steps (call it `font-lock-refresh-all' or something), and
> then use that one.
I think you meant Tassilo should do that but I might as well right the
patch so here it is:
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 03:44:49 -0000
***************
*** 1767,1772 ****
--- 1767,1780 ----
(defvar font-lock-set-defaults nil) ; Whether we have set up defaults.
+ (defun lock-font-refresh-defaults ()
+ "Refresh defaults and restart fontification.
+ Set defaults again as if function `font-lock-defaults' had not
+ been called and then restart fontification."
+ (before-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.
- Need help with search based font-locking, Tassilo Horn, 2009/12/22
- Re: Need help with search based font-locking, Lennart Borgman, 2009/12/22
- Re: Need help with search based font-locking, Tassilo Horn, 2009/12/23
- Re: Need help with search based font-locking, Tassilo Horn, 2009/12/23
- Re: Need help with search based font-locking, Stefan Monnier, 2009/12/23
- Re: Need help with search based font-locking,
Lennart Borgman <=
- Re: Need help with search based font-locking, Stefan Monnier, 2009/12/23
- Re: Need help with search based font-locking, Lennart Borgman, 2009/12/24
- Re: Need help with search based font-locking, Tassilo Horn, 2009/12/28
- Re: Need help with search based font-locking, Lennart Borgman, 2009/12/28
- Re: Need help with search based font-locking, Tassilo Horn, 2009/12/28
- Re: Need help with search based font-locking, Tassilo Horn, 2009/12/30
- Re: Need help with search based font-locking, Stefan Monnier, 2009/12/30