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: Tassilo Horn
Subject: Re: Need help with search based font-locking
Date: Mon, 28 Dec 2009 14:20:54 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux)

Lennart Borgman <address@hidden> writes:

Hi Lennart,

> 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?

Bye,
Tassilo




reply via email to

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