Mercurial > hg > xemacs-beta
comparison lisp/modes/lazy-shot.el @ 203:850242ba4a81 r20-3b28
Import from CVS: tag r20-3b28
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:02:21 +0200 |
parents | a2f645c6b9f8 |
children | e45d5e7c476e |
comparison
equal
deleted
inserted
replaced
202:61eefc8fc970 | 203:850242ba4a81 |
---|---|
45 (require 'font-lock) | 45 (require 'font-lock) |
46 | 46 |
47 (defvar lazy-shot-mode nil) | 47 (defvar lazy-shot-mode nil) |
48 | 48 |
49 | 49 |
50 (defvar lazy-shot-step-size (* 1 124)) ;; Please test diffent sizes | 50 (defgroup lazy-shot nil |
51 "Lazy-shot customizations" | |
52 :group 'tools | |
53 :prefix "lazy-shot-") | |
54 | |
55 (defcustom lazy-shot-step-size 1024 ; Please test diffent sizes | |
56 "Minimum size of each fontification shot." | |
57 :type 'integer | |
58 :group 'lazy-shot) | |
51 | 59 |
52 ;;;###autoload | 60 ;;;###autoload |
53 (defun lazy-shot-mode (&optional arg) | 61 (defun lazy-shot-mode (&optional arg) |
54 "Toggle Lazy Lock mode. | 62 "Toggle Lazy Lock mode. |
55 With arg, turn Lazy Lock mode on if and only if arg is positive." | 63 With arg, turn Lazy Lock mode on if and only if arg is positive." |
102 (when extent | 110 (when extent |
103 (set-extent-one-shot-function extent | 111 (set-extent-one-shot-function extent |
104 'lazy-shot-shot-function)) | 112 'lazy-shot-shot-function)) |
105 extent)) | 113 extent)) |
106 | 114 |
115 (defun lazy-shot-next-line (pos &optional buffer) | |
116 "Return the next end-of-line from POS in BUFFER." | |
117 (save-excursion | |
118 (goto-char pos buffer) | |
119 (forward-line 1 buffer) | |
120 (point buffer))) | |
121 | |
107 (defun lazy-shot-install-extents (fontifying) | 122 (defun lazy-shot-install-extents (fontifying) |
108 ;; | 123 ;; |
109 ;; Add hook if lazy-shot.el is deferring or is fontifying on scrolling. | 124 ;; Add hook if lazy-shot.el is deferring or is fontifying on scrolling. |
110 (when fontifying | 125 (when fontifying |
111 (let ((start (point-min))) | 126 (let ((max (point-max))) |
112 (while (< start (point-max)) | 127 (do* ((start (point-min) end) |
113 (lazy-shot-install-extent start | 128 (end (min max (lazy-shot-next-line (+ start lazy-shot-step-size))) |
114 (min (point-max) (+ start lazy-shot-step-size))) | 129 (min max (lazy-shot-next-line (+ start lazy-shot-step-size))))) |
115 (setq start (+ start lazy-shot-step-size)))))) | 130 ((>= start max)) |
131 (lazy-shot-install-extent start end))))) | |
116 | 132 |
117 (defun lazy-shot-install () | 133 (defun lazy-shot-install () |
118 (make-local-variable 'font-lock-fontified) | 134 (make-local-variable 'font-lock-fontified) |
119 (setq font-lock-fontified t) | 135 (setq font-lock-fontified t) |
120 (lazy-shot-install-extents font-lock-fontified)) | 136 (lazy-shot-install-extents font-lock-fontified)) |