216 |
See info node `(elisp) Overlay Properties' for |
See info node `(elisp) Overlay Properties' for |
217 |
definition of OV, AFTER-CHANGE, BEG, END and LENGTH." |
definition of OV, AFTER-CHANGE, BEG, END and LENGTH." |
218 |
(let ((format-cons (overlay-get ov 'format-cons))) |
(let ((format-cons (overlay-get ov 'format-cons))) |
|
(preview-format-kill format-cons) |
|
219 |
(preview-unwatch-preamble format-cons) |
(preview-unwatch-preamble format-cons) |
220 |
|
(preview-format-kill format-cons) |
221 |
(setcdr format-cons t))) |
(setcdr format-cons t))) |
222 |
|
|
223 |
(defun preview-watch-preamble (file format-cons) |
(defun preview-watch-preamble (file command format-cons) |
224 |
"Set up a watch on master file FILE. |
"Set up a watch on master file FILE. |
225 |
FILE can be an associated buffer instead of a filename. |
FILE can be an associated buffer instead of a filename. |
226 |
|
COMMAND is the command that generated the format. |
227 |
FORMAT-CONS contains the format info for the main |
FORMAT-CONS contains the format info for the main |
228 |
format dump handler." |
format dump handler." |
229 |
(let ((buffer (if (bufferp file) |
(let ((buffer (if (bufferp file) |
230 |
file |
file |
231 |
(find-buffer-visiting file))) ov) |
(find-buffer-visiting file))) ov) |
232 |
(if buffer |
(setcdr |
233 |
(with-current-buffer buffer |
format-cons |
234 |
(save-excursion |
(cons command |
235 |
(save-restriction |
(when buffer |
236 |
(widen) |
(with-current-buffer buffer |
237 |
(goto-char (point-min)) |
(save-excursion |
238 |
(unless (re-search-forward preview-dump-threshold nil t) |
(save-restriction |
239 |
(error "Can't find preamble of `%s'" file)) |
(widen) |
240 |
(setq ov (make-overlay (point-min) (point))) |
(goto-char (point-min)) |
241 |
(setcdr format-cons ov) |
(unless (re-search-forward preview-dump-threshold nil t) |
242 |
(overlay-put ov 'format-cons format-cons) |
(error "Can't find preamble of `%s'" file)) |
243 |
(overlay-put ov 'insert-in-front-hooks |
(setq ov (make-overlay (point-min) (point))) |
244 |
'(preview-preamble-changed-function)) |
(overlay-put ov 'format-cons format-cons) |
245 |
(overlay-put ov 'modification-hooks |
(overlay-put ov 'insert-in-front-hooks |
246 |
'(preview-preamble-changed-function))))) |
'(preview-preamble-changed-function)) |
247 |
(setcdr format-cons 'watch)))) |
(overlay-put ov 'modification-hooks |
248 |
|
'(preview-preamble-changed-function)) |
249 |
|
ov)))))))) |
250 |
|
|
251 |
(defun preview-unwatch-preamble (format-cons) |
(defun preview-unwatch-preamble (format-cons) |
252 |
"Stop watching a format on FORMAT-CONS. |
"Stop watching a format on FORMAT-CONS. |
253 |
The watch has been set up by `preview-watch-preamble'." |
The watch has been set up by `preview-watch-preamble'." |
254 |
(cond ((overlayp (cdr format-cons)) |
(when (consp (cdr format-cons)) |
255 |
(delete-overlay (cdr format-cons)) |
(when (cddr format-cons) |
256 |
(setcdr format-cons nil)) |
(delete-overlay (cddr format-cons))) |
257 |
((eq 'watch (cdr format-cons)) |
(setcdr (cdr format-cons) nil))) |
|
(setcdr format-cons nil)))) |
|
258 |
|
|
259 |
(defun preview-register-change (ov) |
(defun preview-register-change (ov) |
260 |
"Register not yet changed OV for verification. |
"Register not yet changed OV for verification. |
396 |
filename) |
filename) |
397 |
(setq filename (substring filename 0 (match-beginning 0)))) |
(setq filename (substring filename 0 (match-beginning 0)))) |
398 |
(setq format-cons (assoc filename preview-dumped-alist)) |
(setq format-cons (assoc filename preview-dumped-alist)) |
399 |
(when (eq (cdr format-cons) 'watch) |
(when (cdr format-cons) |
400 |
(preview-watch-preamble (current-buffer) format-cons))))) |
(preview-unwatch-preamble format-cons) |
401 |
|
(preview-watch-preamble (current-buffer) |
402 |
|
(cdr format-cons) |
403 |
|
format-cons))))) |
404 |
|
|
405 |
(defvar preview-marker (make-marker) |
(defvar preview-marker (make-marker) |
406 |
"Marker for fake intangibility.") |
"Marker for fake intangibility.") |