aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2005-10-29 19:45:40 +0000
committerRichard M. Stallman2005-10-29 19:45:40 +0000
commit74614ac6c08f9baf1197e2431dc647c6df3dde7f (patch)
tree12f63f9b407f09cc9bc60c044e405aff8c0d0eac
parentf5b8d5f2636a87337e5174ffcd3fe1e256d97e42 (diff)
downloademacs-74614ac6c08f9baf1197e2431dc647c6df3dde7f.tar.gz
emacs-74614ac6c08f9baf1197e2431dc647c6df3dde7f.zip
(jit-lock-function, jit-lock-stealth-fontify)
(jit-lock-deferred-fontify, jit-lock-context-fontify) (jit-lock-after-change): Test memory-full.
-rw-r--r--lisp/jit-lock.el62
1 files changed, 32 insertions, 30 deletions
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el
index 9e6121c17a1..d3e3be12073 100644
--- a/lisp/jit-lock.el
+++ b/lisp/jit-lock.el
@@ -299,7 +299,7 @@ Only applies to the current buffer."
299 "Fontify current buffer starting at position START. 299 "Fontify current buffer starting at position START.
300This function is added to `fontification-functions' when `jit-lock-mode' 300This function is added to `fontification-functions' when `jit-lock-mode'
301is active." 301is active."
302 (when (and jit-lock-mode (not (memory-full-p))) 302 (when (and jit-lock-mode (not memory-full))
303 (if (null jit-lock-defer-time) 303 (if (null jit-lock-defer-time)
304 ;; No deferral. 304 ;; No deferral.
305 (jit-lock-fontify-now start (+ start jit-lock-chunk-size)) 305 (jit-lock-fontify-now start (+ start jit-lock-chunk-size))
@@ -427,6 +427,7 @@ This functions is called after Emacs has been idle for
427`jit-lock-stealth-time' seconds." 427`jit-lock-stealth-time' seconds."
428 ;; I used to check `inhibit-read-only' here, but I can't remember why. -stef 428 ;; I used to check `inhibit-read-only' here, but I can't remember why. -stef
429 (unless (or executing-kbd-macro 429 (unless (or executing-kbd-macro
430 memory-full
430 (window-minibuffer-p (selected-window))) 431 (window-minibuffer-p (selected-window)))
431 (let ((buffers (buffer-list)) 432 (let ((buffers (buffer-list))
432 (outer-buffer (current-buffer)) 433 (outer-buffer (current-buffer))
@@ -490,7 +491,7 @@ This functions is called after Emacs has been idle for
490 491
491(defun jit-lock-deferred-fontify () 492(defun jit-lock-deferred-fontify ()
492 "Fontify what was deferred." 493 "Fontify what was deferred."
493 (when jit-lock-defer-buffers 494 (when (and jit-lock-defer-buffers (not memory-full))
494 ;; Mark the deferred regions back to `fontified = nil' 495 ;; Mark the deferred regions back to `fontified = nil'
495 (dolist (buffer jit-lock-defer-buffers) 496 (dolist (buffer jit-lock-defer-buffers)
496 (when (buffer-live-p buffer) 497 (when (buffer-live-p buffer)
@@ -517,33 +518,34 @@ This functions is called after Emacs has been idle for
517 518
518(defun jit-lock-context-fontify () 519(defun jit-lock-context-fontify ()
519 "Refresh fontification to take new context into account." 520 "Refresh fontification to take new context into account."
520 (dolist (buffer (buffer-list)) 521 (unless memory-full
521 (with-current-buffer buffer 522 (dolist (buffer (buffer-list))
522 (when jit-lock-context-unfontify-pos 523 (with-current-buffer buffer
523 ;; (message "Jit-Context %s" (buffer-name)) 524 (when jit-lock-context-unfontify-pos
524 (save-restriction 525 ;; (message "Jit-Context %s" (buffer-name))
525 (widen) 526 (save-restriction
526 (when (and (>= jit-lock-context-unfontify-pos (point-min)) 527 (widen)
527 (< jit-lock-context-unfontify-pos (point-max))) 528 (when (and (>= jit-lock-context-unfontify-pos (point-min))
528 ;; If we're in text that matches a complex multi-line 529 (< jit-lock-context-unfontify-pos (point-max)))
529 ;; font-lock pattern, make sure the whole text will be 530 ;; If we're in text that matches a complex multi-line
530 ;; redisplayed eventually. 531 ;; font-lock pattern, make sure the whole text will be
531 ;; Despite its name, we treat jit-lock-defer-multiline here 532 ;; redisplayed eventually.
532 ;; rather than in jit-lock-defer since it has to do with multiple 533 ;; Despite its name, we treat jit-lock-defer-multiline here
533 ;; lines, i.e. with context. 534 ;; rather than in jit-lock-defer since it has to do with multiple
534 (when (get-text-property jit-lock-context-unfontify-pos 535 ;; lines, i.e. with context.
535 'jit-lock-defer-multiline) 536 (when (get-text-property jit-lock-context-unfontify-pos
536 (setq jit-lock-context-unfontify-pos 537 'jit-lock-defer-multiline)
537 (or (previous-single-property-change 538 (setq jit-lock-context-unfontify-pos
538 jit-lock-context-unfontify-pos 539 (or (previous-single-property-change
539 'jit-lock-defer-multiline) 540 jit-lock-context-unfontify-pos
540 (point-min)))) 541 'jit-lock-defer-multiline)
541 (with-buffer-prepared-for-jit-lock 542 (point-min))))
542 ;; Force contextual refontification. 543 (with-buffer-prepared-for-jit-lock
543 (remove-text-properties 544 ;; Force contextual refontification.
544 jit-lock-context-unfontify-pos (point-max) 545 (remove-text-properties
545 '(fontified nil jit-lock-defer-multiline nil))) 546 jit-lock-context-unfontify-pos (point-max)
546 (setq jit-lock-context-unfontify-pos (point-max)))))))) 547 '(fontified nil jit-lock-defer-multiline nil)))
548 (setq jit-lock-context-unfontify-pos (point-max)))))))))
547 549
548(defun jit-lock-after-change (start end old-len) 550(defun jit-lock-after-change (start end old-len)
549 "Mark the rest of the buffer as not fontified after a change. 551 "Mark the rest of the buffer as not fontified after a change.
@@ -553,7 +555,7 @@ is the pre-change length.
553This function ensures that lines following the change will be refontified 555This function ensures that lines following the change will be refontified
554in case the syntax of those lines has changed. Refontification 556in case the syntax of those lines has changed. Refontification
555will take place when text is fontified stealthily." 557will take place when text is fontified stealthily."
556 (when (and jit-lock-mode (not (memory-full-p))) 558 (when (and jit-lock-mode (not memory-full))
557 (save-excursion 559 (save-excursion
558 (with-buffer-prepared-for-jit-lock 560 (with-buffer-prepared-for-jit-lock
559 ;; It's important that the `fontified' property be set from the 561 ;; It's important that the `fontified' property be set from the