changeset 60188:d9ca15a0952c

(ctext-pre-write-conversion): Always use " *code-converting-work*" buffer for work.
author Kenichi Handa <handa@m17n.org>
date Mon, 21 Feb 2005 12:50:06 +0000
parents 63a82f5b98c6
children 67b99e778ada
files lisp/international/mule.el
diffstat 1 files changed, 13 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/mule.el	Mon Feb 21 09:01:04 2005 +0000
+++ b/lisp/international/mule.el	Mon Feb 21 12:50:06 2005 +0000
@@ -1467,18 +1467,20 @@
 by encode-coding-string, generate a new temp buffer, insert the
 text, and convert it in the temporary buffer.  Otherwise, convert in-place."
   (save-match-data
-    ;; Setup a working buffer if necessary.
-    (cond ((stringp from)
-	   (let ((buf (current-buffer)))
-	     (set-buffer (generate-new-buffer " *temp"))
+    (let ((workbuf (get-buffer-create " *code-conversion-work*")))
+      ;; Setup a working buffer if necessary.
+      (cond ((stringp from)
+	     (set-buffer workbuf)
+	     (erase-buffer)
 	     (set-buffer-multibyte (multibyte-string-p from))
-	     (insert from)))
-	  ((not (string= (buffer-name) " *code-converting-work*"))
-	   (let ((buf (current-buffer))
-		 (multibyte enable-multibyte-characters))
-	     (set-buffer (generate-new-buffer " *temp"))
-	     (set-buffer-multibyte multibyte)
-	     (insert-buffer-substring buf from to))))
+	     (insert from))
+	    ((not (eq (current-buffer) workbuf))
+	     (let ((buf (current-buffer))
+		   (multibyte enable-multibyte-characters))
+	       (set-buffer workbuf)
+	       (erase-buffer)
+	       (set-buffer-multibyte multibyte)
+	       (insert-buffer-substring buf from to)))))
 
     ;; Now we can encode the whole buffer.
     (let ((encoding-table (ctext-non-standard-encodings-table))