egg-980402.
[elisp/egg.git] / egg-com.el
index a45871f..12d9cc4 100644 (file)
@@ -10,7 +10,7 @@
 ;;        KATAYAMA Yoshio <kate@pfu.co.jp>  ; Korean, Chinese support.
 ;; Maintainer: NIIBE Yutaka <gniibe@mri.co.jp>
 
-;; This file will be part of GNU Emacs (in future).
+;; This file is part of EGG.
 
 ;; EGG is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -689,6 +689,10 @@ v means 8-bit vector."
      'progn
      result)))
 \f
+(if (not (fboundp 'string-as-multibyte))
+    (defsubst string-as-multibyte (str)
+      str))
+
 ;; Do not move the point, leave it where it was.
 (defun comm-accept-process-output (proc)
   (let ((p (point)))
@@ -744,20 +748,22 @@ v means 8-bit vector."
   (let ((start (point)))
     (while (not (search-forward "\0\0" nil t))
       (comm-accept-process-output proc))
-    (set s (buffer-substring start
-                            (+ start
-                               (decode-coding-region start (- (point) 2)
-                                                     egg-fixed-euc))))))
+    (set s  (string-as-multibyte
+            (buffer-substring start
+                              (+ start
+                                 (decode-coding-region start (- (point) 2)
+                                                       egg-fixed-euc)))))))
 
 ;;; XXX should support other conversion (euc-kr, cns)
 (defsubst comm-unpack-mb-string (proc s)
   (let ((start (point)))
     (while (not (search-forward "\0" nil t))
       (comm-accept-process-output proc))
-    (set s (buffer-substring start
-                            (+ start
-                               (decode-coding-region start (- (point) 1)
-                                                     egg-mb-euc))))))
+    (set s (string-as-multibyte
+           (buffer-substring start
+                             (+ start
+                                (decode-coding-region start (- (point) 1)
+                                                      egg-mb-euc)))))))
 
 (defsubst comm-unpack-u8-string (proc s)
   (let ((start (point)))