diff options
| author | Alan Mackenzie | 2016-01-08 14:41:58 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2016-01-08 14:41:58 +0000 |
| commit | 8be046f453b3f74eaf41154f28b85d45d2cc3844 (patch) | |
| tree | e633c33d6c6877d21a42690b8443c971ca3022a8 | |
| parent | 4b37cba3d55abf6788768c6017019d1039aa6c2e (diff) | |
| download | emacs-8be046f453b3f74eaf41154f28b85d45d2cc3844.tar.gz emacs-8be046f453b3f74eaf41154f28b85d45d2cc3844.zip | |
Respect fontification region calculated by major mode. Fixes bug #22316.
* lisp/font-lock.el (font-lock-extend-jit-lock-region-after-change): when a
fontification region has been calculated by a function on
font-lock-extend-after-change-region-function use this region rather than
changing the end position to somewhere else.
| -rw-r--r-- | lisp/font-lock.el | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 4a92069b12e..3c1f01d5886 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el | |||
| @@ -1302,15 +1302,18 @@ This function does 2 things: | |||
| 1302 | (point-min)))) | 1302 | (point-min)))) |
| 1303 | (when (< end (point-max)) | 1303 | (when (< end (point-max)) |
| 1304 | (setq end | 1304 | (setq end |
| 1305 | (if (get-text-property end 'font-lock-multiline) | 1305 | (cond |
| 1306 | (or (text-property-any end (point-max) | 1306 | ((get-text-property end 'font-lock-multiline) |
| 1307 | 'font-lock-multiline nil) | 1307 | (or (text-property-any end (point-max) |
| 1308 | (point-max)) | 1308 | 'font-lock-multiline nil) |
| 1309 | (point-max))) | ||
| 1310 | ;; If `end' has been set by the function above, don't corrupt it. | ||
| 1311 | (font-lock-extend-after-change-region-function end) | ||
| 1309 | ;; Rounding up to a whole number of lines should include the | 1312 | ;; Rounding up to a whole number of lines should include the |
| 1310 | ;; line right after `end'. Typical case: the first char of | 1313 | ;; line right after `end'. Typical case: the first char of |
| 1311 | ;; the line was deleted. Or a \n was inserted in the middle | 1314 | ;; the line was deleted. Or a \n was inserted in the middle |
| 1312 | ;; of a line. | 1315 | ;; of a line. |
| 1313 | (1+ end)))) | 1316 | (t (1+ end))))) |
| 1314 | ;; Finally, pre-enlarge the region to a whole number of lines, to try | 1317 | ;; Finally, pre-enlarge the region to a whole number of lines, to try |
| 1315 | ;; and anticipate what font-lock-default-fontify-region will do, so as to | 1318 | ;; and anticipate what font-lock-default-fontify-region will do, so as to |
| 1316 | ;; avoid double-redisplay. | 1319 | ;; avoid double-redisplay. |