282 |
;;;###autoload |
;;;###autoload |
283 |
(defun enriched-encode (from to orig-buf) |
(defun enriched-encode (from to orig-buf) |
284 |
(if enriched-verbose (message "Enriched: encoding document...")) |
(if enriched-verbose (message "Enriched: encoding document...")) |
285 |
(save-restriction |
(let ((inhibit-read-only t)) |
286 |
(narrow-to-region from to) |
(save-restriction |
287 |
(delete-to-left-margin) |
(narrow-to-region from to) |
288 |
(unjustify-region) |
(delete-to-left-margin) |
289 |
(goto-char from) |
(unjustify-region) |
290 |
(format-replace-strings '(("<" . "<<"))) |
(goto-char from) |
291 |
(format-insert-annotations |
(format-replace-strings '(("<" . "<<"))) |
292 |
(format-annotate-region from (point-max) enriched-translations |
(format-insert-annotations |
293 |
'enriched-make-annotation enriched-ignore)) |
(format-annotate-region from (point-max) enriched-translations |
294 |
(goto-char from) |
'enriched-make-annotation enriched-ignore)) |
295 |
(insert (if (stringp enriched-initial-annotation) |
(goto-char from) |
296 |
enriched-initial-annotation |
(insert (if (stringp enriched-initial-annotation) |
297 |
(save-excursion |
enriched-initial-annotation |
298 |
;; Eval this in the buffer we are annotating. This |
(save-excursion |
299 |
;; fixes a bug which was saving incorrect File-Width |
;; Eval this in the buffer we are annotating. This |
300 |
;; information, since we were looking at local |
;; fixes a bug which was saving incorrect File-Width |
301 |
;; variables in the wrong buffer. |
;; information, since we were looking at local |
302 |
(if orig-buf (set-buffer orig-buf)) |
;; variables in the wrong buffer. |
303 |
(funcall enriched-initial-annotation)))) |
(if orig-buf (set-buffer orig-buf)) |
304 |
(enriched-map-property-regions 'hard |
(funcall enriched-initial-annotation)))) |
305 |
(lambda (v b e) |
(enriched-map-property-regions 'hard |
306 |
(if (and v (= ?\n (char-after b))) |
(lambda (v b e) |
307 |
(progn (goto-char b) (insert "\n")))) |
(if (and v (= ?\n (char-after b))) |
308 |
(point) nil) |
(progn (goto-char b) (insert "\n")))) |
309 |
(if enriched-verbose (message nil)) |
(point) nil) |
310 |
;; Return new end. |
(if enriched-verbose (message nil)) |
311 |
(point-max))) |
;; Return new end. |
312 |
|
(point-max)))) |
313 |
|
|
314 |
(defun enriched-make-annotation (internal-ann positive) |
(defun enriched-make-annotation (internal-ann positive) |
315 |
"Format an annotation INTERNAL-ANN. |
"Format an annotation INTERNAL-ANN. |