500 |
filename) |
filename) |
501 |
(setq filename (substring filename 0 (match-beginning 0)))) |
(setq filename (substring filename 0 (match-beginning 0)))) |
502 |
(setq format-cons (assoc filename preview-dumped-alist)) |
(setq format-cons (assoc filename preview-dumped-alist)) |
503 |
(when (eq (cdr format-cons) 'watch) |
(when (consp (cdr format-cons)) |
504 |
(preview-watch-preamble (current-buffer) format-cons))))) |
(preview-unwatch-preamble format-cons) |
505 |
|
(preview-watch-preamble (current-buffer) |
506 |
|
(cdr format-cons) |
507 |
|
format-cons))))) |
508 |
|
|
509 |
(defvar preview-marker (make-marker) |
(defvar preview-marker (make-marker) |
510 |
"Marker for fake intangibility.") |
"Marker for fake intangibility.") |
633 |
(defun preview-preamble-check-change (beg end) |
(defun preview-preamble-check-change (beg end) |
634 |
"Hook function for change hooks on preamble. |
"Hook function for change hooks on preamble. |
635 |
Reacts to changes between BEG and END." |
Reacts to changes between BEG and END." |
636 |
(when (and preview-preamble-format-cons |
(when (and (consp (cdr preview-preamble-format-cons)) |
637 |
(number-or-marker-p (cdr preview-preamble-format-cons)) |
(cddr preview-preamble-format-cons) |
638 |
(< beg (cdr preview-preamble-format-cons))) |
(< beg (cddr preview-preamble-format-cons))) |
|
(preview-format-kill preview-preamble-format-cons) |
|
639 |
(preview-unwatch-preamble preview-preamble-format-cons) |
(preview-unwatch-preamble preview-preamble-format-cons) |
640 |
|
(preview-format-kill preview-preamble-format-cons) |
641 |
(setcdr preview-preamble-format-cons t))) |
(setcdr preview-preamble-format-cons t))) |
642 |
|
|
643 |
(defun preview-watch-preamble (file format-cons) |
(defun preview-watch-preamble (file command format-cons) |
644 |
"Set up a watch on master file FILE. |
"Set up a watch on master file FILE. |
645 |
FILE can be an associated buffer instead of a filename. |
FILE can be an associated buffer instead of a filename. |
646 |
|
COMMAND is the command that generated the format. |
647 |
FORMAT-CONS contains the format info for the main |
FORMAT-CONS contains the format info for the main |
648 |
format dump handler." |
format dump handler." |
649 |
(let ((buffer (if (bufferp file) |
(let ((buffer (if (bufferp file) |
650 |
file |
file |
651 |
(find-buffer-visiting file)))) |
(find-buffer-visiting file))) ov) |
652 |
(if buffer |
(setq preview-preamble-format-cons nil) |
653 |
(with-current-buffer buffer |
(setcdr |
654 |
(save-excursion |
format-cons |
655 |
(save-restriction |
(cons command |
656 |
(widen) |
(when buffer |
657 |
(goto-char (point-min)) |
(with-current-buffer buffer |
658 |
(unless (re-search-forward preview-dump-threshold nil t) |
(save-excursion |
659 |
(error "Can't find preamble of `%s'" file)) |
(save-restriction |
660 |
(setcdr format-cons (point)) |
(widen) |
661 |
(setq preview-preamble-format-cons format-cons)))) |
(goto-char (point-min)) |
662 |
(setcdr format-cons 'watch)))) |
(unless (re-search-forward preview-dump-threshold nil t) |
663 |
|
(error "Can't find preamble of `%s'" file)) |
664 |
|
(setq preview-preamble-format-cons format-cons) |
665 |
|
(point))))))))) |
666 |
|
|
667 |
(defun preview-unwatch-preamble (format-cons) |
(defun preview-unwatch-preamble (format-cons) |
668 |
"Stop watching a format on FORMAT-CONS. |
"Stop watching a format on FORMAT-CONS. |
669 |
The watch has been set up by `preview-watch-preamble'." |
The watch has been set up by `preview-watch-preamble'." |
670 |
(when (or (number-or-marker-p (cdr format-cons)) |
(when (consp (cdr format-cons)) |
671 |
(eq 'watch (cdr format-cons))) |
(setcdr (cdr format-cons) nil))) |
|
(setcdr format-cons nil))) |
|
672 |
|
|
673 |
(defun preview-register-change (ov map-arg) |
(defun preview-register-change (ov map-arg) |
674 |
"Register not yet changed OV for verification. |
"Register not yet changed OV for verification. |