Mercurial > emacs
diff lisp/jit-lock.el @ 90370:e3bacb89536a
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-46
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 157-163)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 58-61)
- Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sun, 19 Mar 2006 19:43:57 +0000 |
parents | c5406394f567 caf8f09897bc |
children | e6bf73e43cf4 |
line wrap: on
line diff
--- a/lisp/jit-lock.el Tue Mar 14 12:15:08 2006 +0000 +++ b/lisp/jit-lock.el Sun Mar 19 19:43:57 2006 +0000 @@ -557,36 +557,44 @@ in case the syntax of those lines has changed. Refontification will take place when text is fontified stealthily." (when (and jit-lock-mode (not memory-full)) - (save-excursion - (with-buffer-prepared-for-jit-lock - ;; It's important that the `fontified' property be set from the - ;; beginning of the line, else font-lock will properly change the - ;; text's face, but the display will have been done already and will - ;; be inconsistent with the buffer's content. - (goto-char start) - (setq start (line-beginning-position)) + (let ((region (font-lock-extend-region start end old-len))) + (save-excursion + (with-buffer-prepared-for-jit-lock + ;; It's important that the `fontified' property be set from the + ;; beginning of the line, else font-lock will properly change the + ;; text's face, but the display will have been done already and will + ;; be inconsistent with the buffer's content. + ;; + ;; FIXME!!! (Alan Mackenzie, 2006-03-14): If start isn't at a BOL, + ;; expanding the region to BOL might mis-fontify, should the BOL not + ;; be at a "safe" position. + (setq start (if region + (car region) + (goto-char start) + (line-beginning-position))) - ;; If we're in text that matches a multi-line font-lock pattern, - ;; make sure the whole text will be redisplayed. - ;; I'm not sure this is ever necessary and/or sufficient. -stef - (when (get-text-property start 'font-lock-multiline) - (setq start (or (previous-single-property-change - start 'font-lock-multiline) - (point-min)))) + ;; If we're in text that matches a multi-line font-lock pattern, + ;; make sure the whole text will be redisplayed. + ;; I'm not sure this is ever necessary and/or sufficient. -stef + (when (get-text-property start 'font-lock-multiline) + (setq start (or (previous-single-property-change + start 'font-lock-multiline) + (point-min)))) - ;; Make sure we change at least one char (in case of deletions). - (setq end (min (max end (1+ start)) (point-max))) - ;; Request refontification. - (put-text-property start end 'fontified nil)) - ;; Mark the change for deferred contextual refontification. - (when jit-lock-context-unfontify-pos - (setq jit-lock-context-unfontify-pos - ;; Here we use `start' because nothing guarantees that the - ;; text between start and end will be otherwise refontified: - ;; usually it will be refontified by virtue of being - ;; displayed, but if it's outside of any displayed area in the - ;; buffer, only jit-lock-context-* will re-fontify it. - (min jit-lock-context-unfontify-pos start)))))) + (if region (setq end (cdr region))) + ;; Make sure we change at least one char (in case of deletions). + (setq end (min (max end (1+ start)) (point-max))) + ;; Request refontification. + (put-text-property start end 'fontified nil)) + ;; Mark the change for deferred contextual refontification. + (when jit-lock-context-unfontify-pos + (setq jit-lock-context-unfontify-pos + ;; Here we use `start' because nothing guarantees that the + ;; text between start and end will be otherwise refontified: + ;; usually it will be refontified by virtue of being + ;; displayed, but if it's outside of any displayed area in the + ;; buffer, only jit-lock-context-* will re-fontify it. + (min jit-lock-context-unfontify-pos start))))))) (provide 'jit-lock)