aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann <[email protected]>2000-04-09 10:58:27 +0000
committerGerd Moellmann <[email protected]>2000-04-09 10:58:27 +0000
commit9f1a8fb4afe5032aa6f23df520e284cb78d1de99 (patch)
tree6a4e00d5251c0516eabe2f36ee5e0ddadae42704
parent4bcb5a9e5d12ea3650978c57c679d51c9c1cf4d5 (diff)
(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 3881470710..6cd4d0f384 100644
--- a/lisp/jit-lock.el
+++ b/lisp/jit-lock.el
@@ -39,22 +39,21 @@
`(let ((,modified (buffer-modified-p)))
,@body
(unless ,modified)
- ;; Calling set-buffer-modified causes redisplay to consider
- ;; all windows because that function sets update_mode_lines.
- (set-buffer-modified-p nil))))
+ (restore-buffer-modified-p nil))))
(defmacro with-buffer-prepared-for-font-lock (&rest body)
"Execute BODY in current buffer, overriding several variables.
Preserves the `buffer-modified-p' state of the current buffer."
- `(let ((buffer-undo-list t)
- (inhibit-read-only t)
- (inhibit-point-motion-hooks t)
- before-change-functions
- after-change-functions
- deactivate-mark
- buffer-file-name
- buffer-file-truename)
- ,@body)))
+ `(with-buffer-unmodified
+ (let ((buffer-undo-list t)
+ (inhibit-read-only t)
+ (inhibit-point-motion-hooks t)
+ before-change-functions
+ after-change-functions
+ deactivate-mark
+ buffer-file-name
+ buffer-file-truename)
+ ,@body))))
@@ -249,7 +248,7 @@ the variable `jit-lock-stealth-nice' and `jit-lock-stealth-lines'."
This function is added to `fontification-functions' when `jit-lock-mode'
is active."
(when jit-lock-mode
- (with-buffer-unmodified (jit-lock-function-1 start))))
+ (jit-lock-function-1 start)))
(defun jit-lock-function-1 (start)
@@ -394,33 +393,37 @@ This functions is called after Emacs has been idle for
(concat "JIT stealth lock "
(buffer-name)))
- (with-buffer-unmodified
-
- ;; Perform deferred unfontification, if any.
- (when jit-lock-first-unfontify-pos
- (save-restriction
- (widen)
- (when (and (>= jit-lock-first-unfontify-pos (point-min))
- (< jit-lock-first-unfontify-pos (point-max)))
- (with-buffer-prepared-for-font-lock
- (put-text-property jit-lock-first-unfontify-pos
- (point-max) 'fontified nil))
- (setq jit-lock-first-unfontify-pos nil))))
-
- (let (start
- (nice (or jit-lock-stealth-nice 0))
- (point (point)))
- (while (and (setq start (jit-lock-stealth-chunk-start point))
- (sit-for nice))
+ ;; Perform deferred unfontification, if any.
+ (when jit-lock-first-unfontify-pos
+ (save-restriction
+ (widen)
+ (when (and (>= jit-lock-first-unfontify-pos (point-min))
+ (< jit-lock-first-unfontify-pos (point-max)))
+ (with-buffer-prepared-for-font-lock
+ (put-text-property jit-lock-first-unfontify-pos
+ (point-max) 'fontified nil))
+ (setq jit-lock-first-unfontify-pos nil))))
+
+ ;; In the following code, the `sit-for' calls cause a
+ ;; redisplay, so it's required that the
+ ;; buffer-modified flag of a buffer that is displayed
+ ;; has the right value---otherwise the mode line of
+ ;; an unmodified buffer would show a `*'.
+ (let (start
+ (nice (or jit-lock-stealth-nice 0))
+ (point (point)))
+ (while (and (setq start
+ (jit-lock-stealth-chunk-start point))
+ (sit-for nice))
- ;; Wait a little if load is too high.
- (when (and jit-lock-stealth-load
- (> (car (load-average)) jit-lock-stealth-load))
- (sit-for (or jit-lock-stealth-time 30)))
+ ;; Wait a little if load is too high.
+ (when (and jit-lock-stealth-load
+ (> (car (load-average)) jit-lock-stealth-load))
+ (sit-for (or jit-lock-stealth-time 30)))
- ;; Unless there's input pending now, fontify.
- (unless (input-pending-p)
- (jit-lock-function-1 start)))))))))))))
+ ;; Unless there's input pending now, fontify.
+ (unless (input-pending-p)
+ (jit-lock-function-1 start))))))))))))