Mercurial > emacs
comparison lisp/textmodes/enriched.el @ 56323:a712704c769c
(enriched-encode): Bind inhibit-read-only.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 02 Jul 2004 23:47:44 +0000 |
parents | 695cf19ef79e |
children | 049bdfb5d92f 6f6e9fe4658b |
comparison
equal
deleted
inserted
replaced
56322:f597c982349e | 56323:a712704c769c |
---|---|
280 ;;; | 280 ;;; |
281 | 281 |
282 ;;;###autoload | 282 ;;;###autoload |
283 (defun enriched-encode (from to orig-buf) | 283 (defun enriched-encode (from to orig-buf) |
284 (if enriched-verbose (message "Enriched: encoding document...")) | 284 (if enriched-verbose (message "Enriched: encoding document...")) |
285 (save-restriction | 285 (let ((inhibit-read-only t)) |
286 (narrow-to-region from to) | 286 (save-restriction |
287 (delete-to-left-margin) | 287 (narrow-to-region from to) |
288 (unjustify-region) | 288 (delete-to-left-margin) |
289 (goto-char from) | 289 (unjustify-region) |
290 (format-replace-strings '(("<" . "<<"))) | 290 (goto-char from) |
291 (format-insert-annotations | 291 (format-replace-strings '(("<" . "<<"))) |
292 (format-annotate-region from (point-max) enriched-translations | 292 (format-insert-annotations |
293 'enriched-make-annotation enriched-ignore)) | 293 (format-annotate-region from (point-max) enriched-translations |
294 (goto-char from) | 294 'enriched-make-annotation enriched-ignore)) |
295 (insert (if (stringp enriched-initial-annotation) | 295 (goto-char from) |
296 enriched-initial-annotation | 296 (insert (if (stringp enriched-initial-annotation) |
297 (save-excursion | 297 enriched-initial-annotation |
298 ;; Eval this in the buffer we are annotating. This | 298 (save-excursion |
299 ;; fixes a bug which was saving incorrect File-Width | 299 ;; Eval this in the buffer we are annotating. This |
300 ;; information, since we were looking at local | 300 ;; fixes a bug which was saving incorrect File-Width |
301 ;; variables in the wrong buffer. | 301 ;; information, since we were looking at local |
302 (if orig-buf (set-buffer orig-buf)) | 302 ;; variables in the wrong buffer. |
303 (funcall enriched-initial-annotation)))) | 303 (if orig-buf (set-buffer orig-buf)) |
304 (enriched-map-property-regions 'hard | 304 (funcall enriched-initial-annotation)))) |
305 (lambda (v b e) | 305 (enriched-map-property-regions 'hard |
306 (if (and v (= ?\n (char-after b))) | 306 (lambda (v b e) |
307 (progn (goto-char b) (insert "\n")))) | 307 (if (and v (= ?\n (char-after b))) |
308 (point) nil) | 308 (progn (goto-char b) (insert "\n")))) |
309 (if enriched-verbose (message nil)) | 309 (point) nil) |
310 ;; Return new end. | 310 (if enriched-verbose (message nil)) |
311 (point-max))) | 311 ;; Return new end. |
312 (point-max)))) | |
312 | 313 |
313 (defun enriched-make-annotation (internal-ann positive) | 314 (defun enriched-make-annotation (internal-ann positive) |
314 "Format an annotation INTERNAL-ANN. | 315 "Format an annotation INTERNAL-ANN. |
315 INTERNAL-ANN may be a string, for a flag, or a list of the form (PARAM VALUE). | 316 INTERNAL-ANN may be a string, for a flag, or a list of the form (PARAM VALUE). |
316 If POSITIVE is non-nil, this is the opening annotation; | 317 If POSITIVE is non-nil, this is the opening annotation; |