aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2006-09-28 20:02:45 +0000
committerStefan Monnier2006-09-28 20:02:45 +0000
commitefa0c0ef0b0a50bcda2791b33c7b089d3a9ce95b (patch)
tree6e94476ade64d338d9aa0eb587ef201154a29175
parentde25ebb8e32cd0ddddda52e2d70df9824c43622d (diff)
downloademacs-efa0c0ef0b0a50bcda2791b33c7b089d3a9ce95b.tar.gz
emacs-efa0c0ef0b0a50bcda2791b33c7b089d3a9ce95b.zip
(font-lock-after-change-function): Refontify next line as well if end is at BOL.
(font-lock-extend-jit-lock-region-after-change): Be more careful to only extend the region as much as needed.
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/font-lock.el29
2 files changed, 30 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3555287724f..0d541307949 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,12 +1,19 @@
12006-09-28 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * font-lock.el (font-lock-after-change-function): Refontify next line
4 as well if end is at BOL.
5 (font-lock-extend-jit-lock-region-after-change): Be more careful to
6 only extend the region as much as needed.
7
12006-09-28 Richard Stallman <rms@gnu.org> 82006-09-28 Richard Stallman <rms@gnu.org>
2 9
3 * comint.el (comint-mode): Bind font-lock-defaults non-nil. 10 * comint.el (comint-mode): Bind font-lock-defaults non-nil.
4 11
5 * subr.el (insert-for-yank-1): Handle `font-lock-face' specially. 12 * subr.el (insert-for-yank-1): Handle `font-lock-face' specially.
6 13
7 * international/mule.el (after-insert-file-set-coding): 14 * international/mule.el (after-insert-file-set-coding):
8 If VISIT, don't let set-buffer-multibyte make undo info. 15 If VISIT, don't let set-buffer-multibyte make undo info.
9 16
102006-09-28 Osamu Yamane <yamane@green.ocn.ne.jp> (tiny change) 172006-09-28 Osamu Yamane <yamane@green.ocn.ne.jp> (tiny change)
11 18
12 * mail/smtpmail.el (smtpmail-try-auth-methods): Do not break long 19 * mail/smtpmail.el (smtpmail-try-auth-methods): Do not break long
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 28577bcdccd..a6f079e608f 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -1168,7 +1168,12 @@ what properties to clear before refontifying a region.")
1168 ;; number of lines. 1168 ;; number of lines.
1169 ;; (setq beg (progn (goto-char beg) (line-beginning-position)) 1169 ;; (setq beg (progn (goto-char beg) (line-beginning-position))
1170 ;; end (progn (goto-char end) (line-beginning-position 2))) 1170 ;; end (progn (goto-char end) (line-beginning-position 2)))
1171 ) 1171 (unless (eq end (point-max))
1172 ;; Rounding up to a whole number of lines should include the
1173 ;; line right after `end'. Typical case: the first char of
1174 ;; the line was deleted. Or a \n was inserted in the middle
1175 ;; of a line.
1176 (setq end (1+ end))))
1172 (font-lock-fontify-region beg end))))) 1177 (font-lock-fontify-region beg end)))))
1173 1178
1174(defvar jit-lock-start) (defvar jit-lock-end) 1179(defvar jit-lock-start) (defvar jit-lock-end)
@@ -1205,9 +1210,17 @@ This function does 2 things:
1205 (setq beg (or (previous-single-property-change 1210 (setq beg (or (previous-single-property-change
1206 beg 'font-lock-multiline) 1211 beg 'font-lock-multiline)
1207 (point-min)))) 1212 (point-min))))
1208 (setq end (or (text-property-any end (point-max) 1213 (when (< end (point-max))
1209 'font-lock-multiline nil) 1214 (setq end
1210 (point-max))) 1215 (if (get-text-property end 'font-lock-multiline)
1216 (or (text-property-any end (point-max)
1217 'font-lock-multiline nil)
1218 (point-max))
1219 ;; Rounding up to a whole number of lines should include the
1220 ;; line right after `end'. Typical case: the first char of
1221 ;; the line was deleted. Or a \n was inserted in the middle
1222 ;; of a line.
1223 (1+ end))))
1211 ;; Finally, pre-enlarge the region to a whole number of lines, to try 1224 ;; Finally, pre-enlarge the region to a whole number of lines, to try
1212 ;; and anticipate what font-lock-default-fontify-region will do, so as to 1225 ;; and anticipate what font-lock-default-fontify-region will do, so as to
1213 ;; avoid double-redisplay. 1226 ;; avoid double-redisplay.
@@ -1217,11 +1230,11 @@ This function does 2 things:
1217 (when (memq 'font-lock-extend-region-wholelines 1230 (when (memq 'font-lock-extend-region-wholelines
1218 font-lock-extend-region-functions) 1231 font-lock-extend-region-functions)
1219 (goto-char beg) 1232 (goto-char beg)
1220 (forward-line 0) 1233 (setq jit-lock-start (min jit-lock-start (line-beginning-position)))
1221 (setq jit-lock-start (min jit-lock-start (point)))
1222 (goto-char end) 1234 (goto-char end)
1223 (forward-line 1) 1235 (setq jit-lock-end
1224 (setq jit-lock-end (max jit-lock-end (point))))))) 1236 (max jit-lock-end
1237 (if (bolp) (point) (line-beginning-position 2))))))))
1225 1238
1226(defun font-lock-fontify-block (&optional arg) 1239(defun font-lock-fontify-block (&optional arg)
1227 "Fontify some lines the way `font-lock-fontify-buffer' would. 1240 "Fontify some lines the way `font-lock-fontify-buffer' would.