Mercurial > emacs
comparison lisp/jit-lock.el @ 25395:9d8fff117316
(jit-lock-function): Extend the fontified range
to the beginning of the line containing the range start and
the beginning of the line following the range end.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Wed, 25 Aug 1999 13:03:22 +0000 |
parents | 9295aaade56b |
children | d04b7ce72b4a |
comparison
equal
deleted
inserted
replaced
25394:ed9fe1a2c8ae | 25395:9d8fff117316 |
---|---|
244 (with-buffer-prepared-for-font-lock | 244 (with-buffer-prepared-for-font-lock |
245 (let ((end (min (point-max) (+ start jit-lock-chunk-size))) | 245 (let ((end (min (point-max) (+ start jit-lock-chunk-size))) |
246 (parse-sexp-lookup-properties font-lock-syntactic-keywords) | 246 (parse-sexp-lookup-properties font-lock-syntactic-keywords) |
247 (old-syntax-table (syntax-table)) | 247 (old-syntax-table (syntax-table)) |
248 (font-lock-beginning-of-syntax-function nil) | 248 (font-lock-beginning-of-syntax-function nil) |
249 next) | 249 next font-lock-start font-lock-end) |
250 (when font-lock-syntax-table | 250 (when font-lock-syntax-table |
251 (set-syntax-table font-lock-syntax-table)) | 251 (set-syntax-table font-lock-syntax-table)) |
252 (save-excursion | 252 (save-excursion |
253 (save-restriction | 253 (save-restriction |
254 (widen) | 254 (widen) |
259 ;; before `end' that has already been fontified. | 259 ;; before `end' that has already been fontified. |
260 (while start | 260 (while start |
261 ;; Determine the end of this chunk. | 261 ;; Determine the end of this chunk. |
262 (setq next (or (text-property-any start end 'fontified t) | 262 (setq next (or (text-property-any start end 'fontified t) |
263 end)) | 263 end)) |
264 | 264 |
265 ;; Goto to the start of the chunk. Make sure we | 265 ;; Decide which range of text should be fontified. |
266 ;; start fontifying at the beginning of the line | 266 ;; The problem is that START and NEXT may be in the |
267 ;; containing the chunk start because font-lock | 267 ;; middle of something matched by a font-lock regexp. |
268 ;; functions seem to expects this, if I believe | 268 ;; Until someone has a better idea, let's start |
269 ;; lazy-lock. | 269 ;; at the start of the line containing START and |
270 ;; stop at the start of the line following NEXT. | |
271 (goto-char next) | |
272 (setq font-lock-end (line-beginning-position 2)) | |
270 (goto-char start) | 273 (goto-char start) |
271 (setq start (line-beginning-position)) | 274 (setq font-lock-start (line-beginning-position)) |
272 | 275 |
273 ;; Fontify the chunk, and mark it as fontified. | 276 ;; Fontify the chunk, and mark it as fontified. |
274 (font-lock-fontify-region start end nil) | 277 (font-lock-fontify-region font-lock-start font-lock-end nil) |
275 (add-text-properties start next '(fontified t)) | 278 (add-text-properties start next '(fontified t)) |
276 | 279 |
277 ;; Find the start of the next chunk, if any. | 280 ;; Find the start of the next chunk, if any. |
278 (setq start (text-property-any next end 'fontified nil))) | 281 (setq start (text-property-any next end 'fontified nil))) |
279 | 282 |