Mercurial > emacs
diff lisp/font-lock.el @ 69468:0c2790d73955
* font-core.el: New function/variable
font-lock-extend-region\(-function\)?.
* font-lock.el (font-lock-after-change-function): Call
font-lock-extend-region. Obey font-lock-lines-before.
(font-lock-default-fontify-region): Remove reference to
font-lock-lines-before.
* jit-lock.el (jit-lock-after-change): Call
font-lock-extend-region. Obey font-lock-lines-before.
author | Alan Mackenzie <acm@muc.de> |
---|---|
date | Tue, 14 Mar 2006 18:23:47 +0000 |
parents | 322d4f69063b |
children | caf8f09897bc 203c9b24206b |
line wrap: on
line diff
--- a/lisp/font-lock.el Tue Mar 14 15:38:43 2006 +0000 +++ b/lisp/font-lock.el Tue Mar 14 18:23:47 2006 +0000 @@ -1039,7 +1039,7 @@ (when font-lock-syntax-table (set-syntax-table font-lock-syntax-table)) (goto-char beg) - (setq beg (line-beginning-position (- 1 font-lock-lines-before))) + (setq beg (line-beginning-position)) ;; check to see if we should expand the beg/end area for ;; proper multiline matches (when (and (> beg (point-min)) @@ -1090,13 +1090,18 @@ ;; Called when any modification is made to buffer text. (defun font-lock-after-change-function (beg end old-len) (let ((inhibit-point-motion-hooks t) - (inhibit-quit t)) + (inhibit-quit t) + (region (font-lock-extend-region beg end old-len))) (save-excursion (save-match-data - ;; Rescan between start of lines enclosing the region. - (font-lock-fontify-region - (progn (goto-char beg) (forward-line 0) (point)) - (progn (goto-char end) (forward-line 1) (point))))))) + (if region + ;; Fontify the region the major mode has specified. + (setq beg (car region) end (cdr region)) + ;; Fontify the whole lines which enclose the region. + (setq beg (progn (goto-char beg) + (forward-line (- font-lock-lines-before))) + end (progn (goto-char end) (forward-line 1) (point)))) + (font-lock-fontify-region beg end))))) (defun font-lock-fontify-block (&optional arg) "Fontify some lines the way `font-lock-fontify-buffer' would.