comparison lisp/jit-lock.el @ 73135:365ddb09e339

(jit-lock-fontify-now): Don't fontify the empty text. (jit-lock-fontify-again): Don't refontify text that's not displayed.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 26 Sep 2006 15:35:34 +0000
parents 1ba9cc2a8b76
children db20c4c0a56f
comparison
equal deleted inserted replaced
73134:b7b3deb46c6a 73135:365ddb09e339
347 (let ((orig-start start) next) 347 (let ((orig-start start) next)
348 (save-match-data 348 (save-match-data
349 ;; Fontify chunks beginning at START. The end of a 349 ;; Fontify chunks beginning at START. The end of a
350 ;; chunk is either `end', or the start of a region 350 ;; chunk is either `end', or the start of a region
351 ;; before `end' that has already been fontified. 351 ;; before `end' that has already been fontified.
352 (while start 352 (while (and start (< start end))
353 ;; Determine the end of this chunk. 353 ;; Determine the end of this chunk.
354 (setq next (or (text-property-any start end 'fontified t) 354 (setq next (or (text-property-any start end 'fontified t)
355 end)) 355 end))
356 356
357 ;; Decide which range of text should be fontified. 357 ;; Decide which range of text should be fontified.
403 ;; Find the start of the next chunk, if any. 403 ;; Find the start of the next chunk, if any.
404 (setq start (text-property-any next end 'fontified nil)))))))) 404 (setq start (text-property-any next end 'fontified nil))))))))
405 405
406 (defun jit-lock-fontify-again (buf start end) 406 (defun jit-lock-fontify-again (buf start end)
407 "Fontify in buffer BUF from START to END." 407 "Fontify in buffer BUF from START to END."
408 (with-current-buffer buf 408 ;; Don't bother refontifying text that's not even displayed.
409 (with-buffer-prepared-for-jit-lock 409 (when (setq start (text-property-not-all start end 'fontified nil buf))
410 (put-text-property start end 'fontified t)))) 410 (with-current-buffer buf
411 (with-buffer-prepared-for-jit-lock
412 (put-text-property start end 'fontified nil)))))
411 413
412 414
413 415
414 ;;; Stealth fontification. 416 ;;; Stealth fontification.
415 417