comparison lisp/prim/overlay.el @ 167:85ec50267440 r20-3b10

Import from CVS: tag r20-3b10
author cvs
date Mon, 13 Aug 2007 09:45:46 +0200
parents 0132846995bd
children
comparison
equal deleted inserted replaced
166:7a77eb660975 167:85ec50267440
149 "Return a list of the overlays that overlap the region BEG ... END. 149 "Return a list of the overlays that overlap the region BEG ... END.
150 Overlap means that at least one character is contained within the overlay 150 Overlap means that at least one character is contained within the overlay
151 and also contained within the specified region. 151 and also contained within the specified region.
152 Empty overlays are included in the result if they are located at BEG 152 Empty overlays are included in the result if they are located at BEG
153 or between BEG and END." 153 or between BEG and END."
154 (mapcar-extents #'identity nil nil beg end nil 'overlay)) 154 (mapcar-extents #'identity nil nil beg end
155 'all-extents-closed-open 'overlay))
155 156
156 (defun next-overlay-change (pos) 157 (defun next-overlay-change (pos)
157 "Return the next position after POS where an overlay starts or ends. 158 "Return the next position after POS where an overlay starts or ends.
158 If there are no more overlay boundaries after POS, return (point-max)." 159 If there are no more overlay boundaries after POS, return (point-max)."
159 (let ((next (point-max)) 160 (let ((next (point-max))
164 (> tmp pos)) 165 (> tmp pos))
165 (and (< (setq tmp (extent-end-position overlay)) next) 166 (and (< (setq tmp (extent-end-position overlay)) next)
166 (> tmp pos))) 167 (> tmp pos)))
167 (setq next tmp)) 168 (setq next tmp))
168 nil) 169 nil)
169 nil pos nil nil nil 'overlay) 170 nil pos nil nil 'all-extents-closed-open 'overlay)
170 next)) 171 next))
171 172
172 (defun previous-overlay-change (pos) 173 (defun previous-overlay-change (pos)
173 "Return the previous position before POS where an overlay starts or ends. 174 "Return the previous position before POS where an overlay starts or ends.
174 If there are no more overlay boundaries before POS, return (point-min)." 175 If there are no more overlay boundaries before POS, return (point-min)."
180 (< tmp pos)) 181 (< tmp pos))
181 (and (> (setq tmp (extent-start-position overlay)) prev) 182 (and (> (setq tmp (extent-start-position overlay)) prev)
182 (< tmp pos))) 183 (< tmp pos)))
183 (setq prev tmp)) 184 (setq prev tmp))
184 nil) 185 nil)
185 nil nil pos nil nil 'overlay) 186 nil nil pos nil 'all-extents-closed-open 'overlay)
186 prev)) 187 prev))
187 188
188 (defun overlay-lists () 189 (defun overlay-lists ()
189 "Return a pair of lists giving all the overlays of the current buffer. 190 "Return a pair of lists giving all the overlays of the current buffer.
190 The car has all the overlays before the overlay center; 191 The car has all the overlays before the overlay center;
199 (map-extents (lambda (overlay ignore) 200 (map-extents (lambda (overlay ignore)
200 (if (> pos (extent-end-position overlay)) 201 (if (> pos (extent-end-position overlay))
201 (push overlay before) 202 (push overlay before)
202 (push overlay after)) 203 (push overlay after))
203 nil) 204 nil)
204 nil nil nil nil nil 'overlay) 205 nil nil nil nil 'all-extents-closed-open 'overlay)
205 (cons (nreverse before) (nreverse after)))) 206 (cons (nreverse before) (nreverse after))))
206 207
207 (defun overlay-recenter (pos) 208 (defun overlay-recenter (pos)
208 "Recenter the overlays of the current buffer around position POS." 209 "Recenter the overlays of the current buffer around position POS."
209 (set (make-local-variable 'xemacs-internal-overlay-center-pos) pos)) 210 (set (make-local-variable 'xemacs-internal-overlay-center-pos) pos))