;;; jit-lock.el --- just-in-time fontification
;; Copyright (C) 1998, 2000, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
;; Author: Gerd Moellmann <gerd@gnu.org>
;; Keywords: faces files
"Execute BODY in current buffer, overriding several variables.
Preserves the `buffer-modified-p' state of the current buffer."
(declare (debug t))
- `(with-buffer-unmodified
- (let ((buffer-undo-list t)
- (inhibit-read-only t)
- (inhibit-point-motion-hooks t)
- (inhibit-modification-hooks t)
- deactivate-mark
- buffer-file-name
- buffer-file-truename)
- ,@body))))
+ `(let ((buffer-undo-list t)
+ (inhibit-read-only t)
+ (inhibit-point-motion-hooks t)
+ (inhibit-modification-hooks t)
+ deactivate-mark
+ buffer-file-name
+ buffer-file-truename)
+ ;; Do reset the modification status from within the let, since
+ ;; otherwise set-buffer-modified-p may try to unlock the file.
+ (with-buffer-unmodified
+ ,@body))))
\f
:group 'font-lock)
(defcustom jit-lock-chunk-size 500
- "*Jit-lock fontifies chunks of at most this many characters at a time.
+ "Jit-lock fontifies chunks of at most this many characters at a time.
This variable controls both display-time and stealth fontification."
:type 'integer
(defcustom jit-lock-stealth-time nil
- "*Time in seconds to wait before beginning stealth fontification.
+ "Time in seconds to wait before beginning stealth fontification.
Stealth fontification occurs if there is no input within this time.
If nil, stealth fontification is never performed.
(defcustom jit-lock-stealth-nice 0.5
- "*Time in seconds to pause between chunks of stealth fontification.
+ "Time in seconds to pause between chunks of stealth fontification.
Each iteration of stealth fontification is separated by this amount of time,
thus reducing the demand that stealth fontification makes on the system.
If nil, means stealth fontification is never paused.
(defcustom jit-lock-stealth-load
(if (condition-case nil (load-average) (error)) 200)
- "*Load in percentage above which stealth fontification is suspended.
+ "Load in percentage above which stealth fontification is suspended.
Stealth fontification pauses when the system short-term load average (as
returned by the function `load-average' if supported) goes above this level,
thus reducing the demand that stealth fontification makes on the system.
(defcustom jit-lock-stealth-verbose nil
- "*If non-nil, means stealth fontification should show status messages."
+ "If non-nil, means stealth fontification should show status messages."
:type 'boolean
:group 'jit-lock)
(defvaralias 'jit-lock-defer-contextually 'jit-lock-contextually)
(defcustom jit-lock-contextually 'syntax-driven
- "*If non-nil, means fontification should be syntactically true.
+ "If non-nil, means fontification should be syntactically true.
If nil, means fontification occurs only on those lines modified. This
means where modification on a line causes syntactic change on subsequent lines,
those subsequent lines are not refontified to reflect their new context.
;;; Stealth fontification.
(defsubst jit-lock-stealth-chunk-start (around)
- "Return the start of the next chunk to fontify around position AROUND..
+ "Return the start of the next chunk to fontify around position AROUND.
Value is nil if there is nothing more to fontify."
(if (zerop (buffer-size))
nil