Mercurial > emacs
diff lisp/font-lock.el @ 90609:bb0e318b7c53
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 447-459)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 141-144)
- Merge from emacs--devo--0
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-115
author | Miles Bader <miles@gnu.org> |
---|---|
date | Tue, 03 Oct 2006 05:04:21 +0000 |
parents | b5c13d1564a9 57c68ed8bb9c |
children | 95d0cdf160ea |
line wrap: on
line diff
--- a/lisp/font-lock.el Mon Oct 02 08:05:25 2006 +0000 +++ b/lisp/font-lock.el Tue Oct 03 05:04:21 2006 +0000 @@ -1168,7 +1168,12 @@ ;; number of lines. ;; (setq beg (progn (goto-char beg) (line-beginning-position)) ;; end (progn (goto-char end) (line-beginning-position 2))) - ) + (unless (eq end (point-max)) + ;; Rounding up to a whole number of lines should include the + ;; line right after `end'. Typical case: the first char of + ;; the line was deleted. Or a \n was inserted in the middle + ;; of a line. + (setq end (1+ end)))) (font-lock-fontify-region beg end))))) (defvar jit-lock-start) (defvar jit-lock-end) @@ -1205,9 +1210,17 @@ (setq beg (or (previous-single-property-change beg 'font-lock-multiline) (point-min)))) - (setq end (or (text-property-any end (point-max) - 'font-lock-multiline nil) - (point-max))) + (when (< end (point-max)) + (setq end + (if (get-text-property end 'font-lock-multiline) + (or (text-property-any end (point-max) + 'font-lock-multiline nil) + (point-max)) + ;; Rounding up to a whole number of lines should include the + ;; line right after `end'. Typical case: the first char of + ;; the line was deleted. Or a \n was inserted in the middle + ;; of a line. + (1+ end)))) ;; Finally, pre-enlarge the region to a whole number of lines, to try ;; and anticipate what font-lock-default-fontify-region will do, so as to ;; avoid double-redisplay. @@ -1217,11 +1230,11 @@ (when (memq 'font-lock-extend-region-wholelines font-lock-extend-region-functions) (goto-char beg) - (forward-line 0) - (setq jit-lock-start (min jit-lock-start (point))) + (setq jit-lock-start (min jit-lock-start (line-beginning-position))) (goto-char end) - (forward-line 1) - (setq jit-lock-end (max jit-lock-end (point))))))) + (setq jit-lock-end + (max jit-lock-end + (if (bolp) (point) (line-beginning-position 2)))))))) (defun font-lock-fontify-block (&optional arg) "Fontify some lines the way `font-lock-fontify-buffer' would. @@ -1646,9 +1659,11 @@ (cons t (cons keywords (mapcar 'font-lock-compile-keyword keywords)))) (if (and (not syntactic-keywords) - (eq (or syntax-begin-function - font-lock-beginning-of-syntax-function) - 'beginning-of-defun) + (let ((beg-function + (or font-lock-beginning-of-syntax-function + syntax-begin-function))) + (or (eq beg-function 'beginning-of-defun) + (get beg-function 'font-lock-syntax-paren-check))) (not beginning-of-defun-function)) ;; Try to detect when a string or comment contains something that ;; looks like a defun and would thus confuse font-lock.