# HG changeset patch # User Gerd Moellmann # Date 955277907 0 # Node ID 73d4caf44d53412a452e562baf4ed759916d5b82 # Parent afc8a292184c5666d80ef4f3b59ef8f7593c6c04 (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. diff -r afc8a292184c -r 73d4caf44d53 lisp/jit-lock.el --- a/lisp/jit-lock.el Sun Apr 09 10:57:15 2000 +0000 +++ b/lisp/jit-lock.el Sun Apr 09 10:58:27 2000 +0000 @@ -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 @@ 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 @@ (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)))) - ;; 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)) + ;; 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))))))))))))