emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

read-only text in enriched mode


From: Oliver Scholz
Subject: read-only text in enriched mode
Date: Thu, 24 Jun 2004 12:18:44 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (windows-nt)

This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the address@hidden mailing list.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

When trying to save an ERC buffer (this is an IRC client written in
Elisp) with enriched-mode turned on, I get the error message "Text is
read-only" and the buffer is not saved.

This patch seems to fix this:

--- enriched.el 01 Sep 2003 17:45:39 +0200      1.3
+++ enriched.el 19 Jun 2004 07:53:10 +0200      
@@ -282,33 +282,34 @@
 ;;;###autoload
 (defun enriched-encode (from to orig-buf)
   (if enriched-verbose (message "Enriched: encoding document..."))
-  (save-restriction
-    (narrow-to-region from to)
-    (delete-to-left-margin)
-    (unjustify-region)
-    (goto-char from)
-    (format-replace-strings '(("<" . "<<")))
-    (format-insert-annotations
-     (format-annotate-region from (point-max) enriched-translations
-                            'enriched-make-annotation enriched-ignore))
-    (goto-char from)
-    (insert (if (stringp enriched-initial-annotation)
-               enriched-initial-annotation
-             (save-excursion
-               ;; Eval this in the buffer we are annotating.  This
-               ;; fixes a bug which was saving incorrect File-Width
-               ;; information, since we were looking at local
-               ;; variables in the wrong buffer.
-               (if orig-buf (set-buffer orig-buf))
-               (funcall enriched-initial-annotation))))
-    (enriched-map-property-regions 'hard
-      (lambda (v b e)
-       (if (and v (= ?\n (char-after b)))
-           (progn (goto-char b) (insert "\n"))))
-      (point) nil)
-    (if enriched-verbose (message nil))
-    ;; Return new end.
-    (point-max)))
+  (let ((inhibit-read-only t))
+    (save-restriction
+      (narrow-to-region from to)
+      (delete-to-left-margin)
+      (unjustify-region)
+      (goto-char from)
+      (format-replace-strings '(("<" . "<<")))
+      (format-insert-annotations
+       (format-annotate-region from (point-max) enriched-translations
+                              'enriched-make-annotation enriched-ignore))
+      (goto-char from)
+      (insert (if (stringp enriched-initial-annotation)
+                 enriched-initial-annotation
+               (save-excursion
+                 ;; Eval this in the buffer we are annotating.  This
+                 ;; fixes a bug which was saving incorrect File-Width
+                 ;; information, since we were looking at local
+                 ;; variables in the wrong buffer.
+                 (if orig-buf (set-buffer orig-buf))
+                 (funcall enriched-initial-annotation))))
+      (enriched-map-property-regions 'hard
+       (lambda (v b e)
+         (if (and v (= ?\n (char-after b)))
+             (progn (goto-char b) (insert "\n"))))
+       (point) nil)
+      (if enriched-verbose (message nil))
+      ;; Return new end.
+      (point-max))))
 
 (defun enriched-make-annotation (internal-ann positive)
   "Format an annotation INTERNAL-ANN.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]