Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.

This commit is contained in:
Simon Marshall 1997-04-28 09:41:02 +00:00
parent fc8d560107
commit 54d893e33b

View file

@ -4,7 +4,7 @@
;; Author: Simon Marshall <simon@gnu.ai.mit.edu>
;; Keywords: faces files
;; Version: 2.08
;; Version: 2.08.01
;;; This file is part of GNU Emacs.
@ -193,6 +193,70 @@
;; Currently XEmacs does not have the features to support this version of
;; lazy-lock.el. Maybe it will one day.
;; History:
;;
;; 1.15--2.00:
;; - Rewrite for Emacs 19.30 and the features rms added to support lazy-lock.el
;; so that it could work correctly and efficiently.
;; - Many thanks to those who reported bugs, fixed bugs, made suggestions or
;; otherwise contributed in the version 1 cycle; Jari Aalto, Kevin Broadey,
;; Ulrik Dickow, Bill Dubuque, Bob Glickstein, Boris Goldowsky,
;; Jonas Jarnestrom, David Karr, Michael Kifer, Erik Naggum, Rick Sladkey,
;; Jim Thompson, Ben Wing, Ilya Zakharevich, and Richard Stallman.
;; 2.00--2.01:
;; - Made `lazy-lock-fontify-after-command' always `sit-for' and so redisplay
;; - Use `buffer-name' not `buffer-live-p' (Bill Dubuque hint)
;; - Made `lazy-lock-install' do `add-to-list' not `setq' of `current-buffer'
;; - Made `lazy-lock-fontify-after-install' loop over buffer list
;; - Made `lazy-lock-arrange-before-change' to arrange `window-end' triggering
;; - Made `lazy-lock-let-buffer-state' wrap both `befter-change-functions'
;; - Made `lazy-lock-fontify-region' do `condition-case' (Hyman Rosen report)
;; 2.01--2.02:
;; - Use `buffer-live-p' as `buffer-name' can barf (Richard Stanton report)
;; - Made `lazy-lock-install' set `font-lock-fontified' (Kevin Davidson report)
;; - Made `lazy-lock-install' add hooks only if needed
;; - Made `lazy-lock-unstall' add `font-lock-after-change-function' if needed
;; 2.02--2.03:
;; - Made `lazy-lock-fontify-region' do `condition-case' for `quit' too
;; - Made `lazy-lock-mode' respect the value of `font-lock-inhibit-thing-lock'
;; - Added `lazy-lock-after-unfontify-buffer'
;; - Removed `lazy-lock-fontify-after-install' hack
;; - Made `lazy-lock-fontify-after-scroll' not `set-buffer' to `window-buffer'
;; - Made `lazy-lock-fontify-after-trigger' not `set-buffer' to `window-buffer'
;; - Made `lazy-lock-fontify-after-idle' be interruptible (Scott Burson hint)
;; 2.03--2.04:
;; - Rewrite for Emacs 19.31 idle timers
;; - Renamed `buffer-windows' to `get-buffer-window-list'
;; - Removed `buffer-live-p'
;; - Made `lazy-lock-defer-after-change' always save `current-buffer'
;; - Made `lazy-lock-fontify-after-defer' just process buffers
;; - Made `lazy-lock-install-hooks' add hooks correctly (Kevin Broadey report)
;; - Made `lazy-lock-install' cope if `lazy-lock-defer-time' is a list
;; 2.04--2.05:
;; - Rewrite for Common Lisp macros
;; - Added `do-while' macro
;; - Renamed `lazy-lock-let-buffer-state' macro to `save-buffer-state'
;; - Returned `lazy-lock-fontify-after-install' hack (Darren Hall hint)
;; - Added `lazy-lock-defer-on-scrolling' functionality (Scott Byer hint)
;; - Made `lazy-lock-mode' wrap `font-lock-support-mode'
;; 2.05--2.06:
;; - Made `lazy-lock-fontify-after-defer' swap correctly (Scott Byer report)
;; 2.06--2.07:
;; - Added `lazy-lock-stealth-load' functionality (Rob Hooft hint)
;; - Made `lazy-lock-unstall' call `lazy-lock-fontify-region' if needed
;; - Made `lazy-lock-mode' call `lazy-lock-unstall' only if needed
;; - Made `lazy-lock-defer-after-scroll' do `set-window-redisplay-end-trigger'
;; - Added `lazy-lock-defer-contextually' functionality
;; - Added `lazy-lock-defer-on-the-fly' from `lazy-lock-defer-time'
;; - Renamed `lazy-lock-defer-driven' to `lazy-lock-defer-on-scrolling'
;; - Removed `lazy-lock-submit-bug-report' and bade farewell
;; 2.07--2.08:
;; - Made `lazy-lock-fontify-conservatively' fontify around `window-point'
;; - Made `save-buffer-state' wrap `inhibit-point-motion-hooks'
;; - Added Custom support
;; 2.08--2.09:
;; - Removed `byte-*' variables from `eval-when-compile' (Erik Naggum hint)
;;; Code:
(require 'font-lock)
@ -208,34 +272,47 @@
;; We don't do this at the top-level as idle timers are not necessarily used.
(require 'timer)
;; We don't do this at the top-level as we only use non-autoloaded macros.
(require 'cl))
;; We use this to preserve or protect things when modifying text properties.
(defmacro save-buffer-state (varlist &rest body)
"Bind variables according to VARLIST and eval BODY restoring buffer state."
(` (let* ((,@ (append varlist
'((modified (buffer-modified-p)) (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)
(when (and (not modified) (buffer-modified-p))
(set-buffer-modified-p nil)))))
(put 'save-buffer-state 'lisp-indent-function 1)
;; We use this for clarity and speed. Naughty but nice.
(defmacro do-while (test &rest body)
"(do-while TEST BODY...): eval BODY... and repeat if TEST yields non-nil.
(require 'cl)
;;
;; We use this to preserve or protect things when modifying text properties.
(defmacro save-buffer-state (varlist &rest body)
"Bind variables according to VARLIST and eval BODY restoring buffer state."
(` (let* ((,@ (append varlist
'((modified (buffer-modified-p)) (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)
(when (and (not modified) (buffer-modified-p))
(set-buffer-modified-p nil)))))
(put 'save-buffer-state 'lisp-indent-function 1)
;;
;; We use this for clarity and speed. Naughty but nice.
(defmacro do-while (test &rest body)
"(do-while TEST BODY...): eval BODY... and repeat if TEST yields non-nil.
The order of execution is thus BODY, TEST, BODY, TEST and so on
until TEST returns nil."
(` (while (progn (,@ body) (, test)))))
(put 'do-while 'lisp-indent-function (get 'while 'lisp-indent-function))
(` (while (progn (,@ body) (, test)))))
(put 'do-while 'lisp-indent-function (get 'while 'lisp-indent-function))
;;
;; We use this for clarity and speed. Borrowed from a future Emacs.
(or (fboundp 'with-current-buffer)
(defmacro with-current-buffer (buffer &rest body)
"Execute the forms in BODY with BUFFER as the current buffer.
The value returned is the value of the last form in BODY."
(` (save-excursion (set-buffer (, buffer)) (,@ body)))))
(put 'with-current-buffer 'lisp-indent-function 1)
;;
;; We use this for compatibility with a future Emacs.
(or (fboundp 'defcustom)
(defmacro defcustom (symbol value doc &rest args)
(` (defvar (, symbol) (, value) (, doc))))))
;(defun lazy-lock-submit-bug-report ()
; "Submit via mail a bug report on lazy-lock.el."
; (interactive)
; (let ((reporter-prompt-for-summary-p t))
; (reporter-submit-bug-report "simon@gnu.ai.mit.edu" "lazy-lock 2.08"
; (reporter-submit-bug-report "simon@gnu.ai.mit.edu" "lazy-lock 2.08.01"
; '(lazy-lock-minimum-size lazy-lock-defer-on-the-fly
; lazy-lock-defer-on-scrolling lazy-lock-defer-contextually
; lazy-lock-defer-time lazy-lock-stealth-time
@ -256,11 +333,6 @@ until TEST returns nil."
;; User Variables:
(defgroup lazy-lock nil
"Font Lock support mode to fontify lazily."
:link '(custom-manual "(emacs)Support Modes")
:group 'font-lock)
(defcustom lazy-lock-minimum-size (* 25 1024)
"*Minimum size of a buffer for demand-driven fontification.
On-demand fontification occurs if the buffer size is greater than this value.
@ -392,7 +464,7 @@ See also `lazy-lock-stealth-nice'."
:type (if (condition-case nil (load-average) (error))
'(choice (const :tag "never" nil)
(integer :tag "load"))
'(const :tag "never" nil))
'(const :format "%t: unsupported\n" nil))
:group 'lazy-lock)
(defcustom lazy-lock-stealth-nice