aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann2000-04-09 10:58:27 +0000
committerGerd Moellmann2000-04-09 10:58:27 +0000
commit9f1a8fb4afe5032aa6f23df520e284cb78d1de99 (patch)
tree6a4e00d5251c0516eabe2f36ee5e0ddadae42704
parent4bcb5a9e5d12ea3650978c57c679d51c9c1cf4d5 (diff)
downloademacs-9f1a8fb4afe5032aa6f23df520e284cb78d1de99.tar.gz
emacs-9f1a8fb4afe5032aa6f23df520e284cb78d1de99.zip
(with-buffer-unmodified): Use
restore-buffer-modified-p. (with-buffer-prepared-for-font-lock): Use with-buffer-unmodified. (jit-lock-function, jit-lock-stealth-fontify): Don't use with-buffer-unmodified.
-rw-r--r--lisp/jit-lock.el79
1 files changed, 41 insertions, 38 deletions
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el
index 38814707104..6cd4d0f3843 100644
--- a/lisp/jit-lock.el
+++ b/lisp/jit-lock.el
@@ -39,22 +39,21 @@
39 `(let ((,modified (buffer-modified-p))) 39 `(let ((,modified (buffer-modified-p)))
40 ,@body 40 ,@body
41 (unless ,modified) 41 (unless ,modified)
42 ;; Calling set-buffer-modified causes redisplay to consider 42 (restore-buffer-modified-p nil))))
43 ;; all windows because that function sets update_mode_lines.
44 (set-buffer-modified-p nil))))
45 43
46 (defmacro with-buffer-prepared-for-font-lock (&rest body) 44 (defmacro with-buffer-prepared-for-font-lock (&rest body)
47 "Execute BODY in current buffer, overriding several variables. 45 "Execute BODY in current buffer, overriding several variables.
48Preserves the `buffer-modified-p' state of the current buffer." 46Preserves the `buffer-modified-p' state of the current buffer."
49 `(let ((buffer-undo-list t) 47 `(with-buffer-unmodified
50 (inhibit-read-only t) 48 (let ((buffer-undo-list t)
51 (inhibit-point-motion-hooks t) 49 (inhibit-read-only t)
52 before-change-functions 50 (inhibit-point-motion-hooks t)
53 after-change-functions 51 before-change-functions
54 deactivate-mark 52 after-change-functions
55 buffer-file-name 53 deactivate-mark
56 buffer-file-truename) 54 buffer-file-name
57 ,@body))) 55 buffer-file-truename)
56 ,@body))))
58 57
59 58
60 59
@@ -249,7 +248,7 @@ the variable `jit-lock-stealth-nice' and `jit-lock-stealth-lines'."
249This function is added to `fontification-functions' when `jit-lock-mode' 248This function is added to `fontification-functions' when `jit-lock-mode'
250is active." 249is active."
251 (when jit-lock-mode 250 (when jit-lock-mode
252 (with-buffer-unmodified (jit-lock-function-1 start)))) 251 (jit-lock-function-1 start)))
253 252
254 253
255(defun jit-lock-function-1 (start) 254(defun jit-lock-function-1 (start)
@@ -394,33 +393,37 @@ This functions is called after Emacs has been idle for
394 (concat "JIT stealth lock " 393 (concat "JIT stealth lock "
395 (buffer-name))) 394 (buffer-name)))
396 395
397 (with-buffer-unmodified 396 ;; Perform deferred unfontification, if any.
398 397 (when jit-lock-first-unfontify-pos
399 ;; Perform deferred unfontification, if any. 398 (save-restriction
400 (when jit-lock-first-unfontify-pos 399 (widen)
401 (save-restriction 400 (when (and (>= jit-lock-first-unfontify-pos (point-min))
402 (widen) 401 (< jit-lock-first-unfontify-pos (point-max)))
403 (when (and (>= jit-lock-first-unfontify-pos (point-min)) 402 (with-buffer-prepared-for-font-lock
404 (< jit-lock-first-unfontify-pos (point-max))) 403 (put-text-property jit-lock-first-unfontify-pos
405 (with-buffer-prepared-for-font-lock 404 (point-max) 'fontified nil))
406 (put-text-property jit-lock-first-unfontify-pos 405 (setq jit-lock-first-unfontify-pos nil))))
407 (point-max) 'fontified nil)) 406
408 (setq jit-lock-first-unfontify-pos nil)))) 407 ;; In the following code, the `sit-for' calls cause a
409 408 ;; redisplay, so it's required that the
410 (let (start 409 ;; buffer-modified flag of a buffer that is displayed
411 (nice (or jit-lock-stealth-nice 0)) 410 ;; has the right value---otherwise the mode line of
412 (point (point))) 411 ;; an unmodified buffer would show a `*'.
413 (while (and (setq start (jit-lock-stealth-chunk-start point)) 412 (let (start
414 (sit-for nice)) 413 (nice (or jit-lock-stealth-nice 0))
414 (point (point)))
415 (while (and (setq start
416 (jit-lock-stealth-chunk-start point))
417 (sit-for nice))
415 418
416 ;; Wait a little if load is too high. 419 ;; Wait a little if load is too high.
417 (when (and jit-lock-stealth-load 420 (when (and jit-lock-stealth-load
418 (> (car (load-average)) jit-lock-stealth-load)) 421 (> (car (load-average)) jit-lock-stealth-load))
419 (sit-for (or jit-lock-stealth-time 30))) 422 (sit-for (or jit-lock-stealth-time 30)))
420 423
421 ;; Unless there's input pending now, fontify. 424 ;; Unless there's input pending now, fontify.
422 (unless (input-pending-p) 425 (unless (input-pending-p)
423 (jit-lock-function-1 start))))))))))))) 426 (jit-lock-function-1 start))))))))))))
424 427
425 428
426 429