271 |
(require 'font-lock) |
(require 'font-lock) |
272 |
|
|
273 |
(eval-when-compile |
(eval-when-compile |
274 |
;; We don't do this at the top-level as we only use non-autoloaded macros. |
;; We don't do this at the top-level as we only use non-autoloaded macros. |
275 |
(require 'cl) |
(require 'cl) |
276 |
;; |
;; |
277 |
;; We use this to preserve or protect things when modifying text properties. |
;; We use this to preserve or protect things when modifying text properties. |
278 |
(defmacro save-buffer-state (varlist &rest body) |
(defmacro save-buffer-state (varlist &rest body) |
279 |
"Bind variables according to VARLIST and eval BODY restoring buffer state." |
"Bind variables according to VARLIST and eval BODY restoring buffer state." |
280 |
(` (let* ((,@ (append varlist |
`(let* (,@(append varlist |
281 |
'((modified (buffer-modified-p)) (buffer-undo-list t) |
'((modified (buffer-modified-p)) (buffer-undo-list t) |
282 |
(inhibit-read-only t) (inhibit-point-motion-hooks t) |
(inhibit-read-only t) (inhibit-point-motion-hooks t) |
283 |
before-change-functions after-change-functions |
before-change-functions after-change-functions |
284 |
deactivate-mark buffer-file-name buffer-file-truename)))) |
deactivate-mark buffer-file-name buffer-file-truename))) |
285 |
(,@ body) |
,@body |
286 |
(when (and (not modified) (buffer-modified-p)) |
(when (and (not modified) (buffer-modified-p)) |
287 |
(set-buffer-modified-p nil))))) |
(set-buffer-modified-p nil)))) |
288 |
(put 'save-buffer-state 'lisp-indent-function 1) |
(put 'save-buffer-state 'lisp-indent-function 1) |
289 |
;; |
;; |
290 |
;; We use this for clarity and speed. Naughty but nice. |
;; We use this for clarity and speed. Naughty but nice. |
291 |
(defmacro do-while (test &rest body) |
(defmacro do-while (test &rest body) |
292 |
"(do-while TEST BODY...): eval BODY... and repeat if TEST yields non-nil. |
"(do-while TEST BODY...): eval BODY... and repeat if TEST yields non-nil. |
293 |
The order of execution is thus BODY, TEST, BODY, TEST and so on |
The order of execution is thus BODY, TEST, BODY, TEST and so on |
294 |
until TEST returns nil." |
until TEST returns nil." |
295 |
(` (while (progn (,@ body) (, test))))) |
`(while (progn ,@body ,test))) |
296 |
(put 'do-while 'lisp-indent-function (get 'while 'lisp-indent-function))) |
(put 'do-while 'lisp-indent-function (get 'while 'lisp-indent-function))) |
297 |
|
|
298 |
(defvar lazy-lock-mode nil) ; Whether we are turned on. |
(defvar lazy-lock-mode nil) ; Whether we are turned on. |
299 |
(defvar lazy-lock-buffers nil) ; For deferral. |
(defvar lazy-lock-buffers nil) ; For deferral. |