Move `split-char' check and repair code to emu-x20.el; require 'emu.
[elisp/apel.git] / emu-mule.el
index eed2bd7..4a69172 100644 (file)
@@ -29,7 +29,7 @@
 ;;;
 
 (cond (running-emacs-19
-       (require 'emu-19)
+       (require 'emu-e19)
        
        ;; Suggested by SASAKI Osamu <osamu@shuugr.bekkoame.or.jp>
        ;; (cf. [os2-emacs-ja:78])
 (defalias 'charset-columns     'char-width)
 (defalias 'charset-direction   'char-direction)
 
+(defun charset-chars (charset)
+  "Return the number of characters per dimension of CHARSET."
+  (if (= (logand (nth 2 (character-set charset)) 1) 1)
+      96
+    94))
+
 
 ;;; @ coding system
 ;;;
@@ -220,6 +226,14 @@ find-file-hooks, etc.
        (decode-coding-string string cs)
       string)))
 
+(defun write-region-as-mime-charset (charset start end filename)
+  "Like `write-region', q.v., but code-convert by MIME CHARSET."
+  (let ((file-coding-system
+        (or (mime-charset-to-coding-system charset)
+            *noconv*)))
+    (write-region start end filename append visit)
+    ))
+
 
 ;;; @@ to coding-system
 ;;;
@@ -312,6 +326,20 @@ It must be symbol.")
    (cons lc-ascii (find-charset-region start end))))
 
 
+;;; @ buffer representation
+;;;
+
+(defsubst-maybe set-buffer-multibyte (flag)
+  "Set the multibyte flag of the current buffer to FLAG.
+If FLAG is t, this makes the buffer a multibyte buffer.
+If FLAG is nil, this makes the buffer a single-byte buffer.
+The buffer contents remain unchanged as a sequence of bytes
+but the contents viewed as characters do change.
+\[Emacs 20.3 emulating function]"
+  (setq mc-flag flag)
+  )
+
+
 ;;; @ character
 ;;;
 
@@ -319,14 +347,14 @@ It must be symbol.")
 
 (defmacro char-next-index (char index)
   "Return index of character succeeding CHAR whose index is INDEX."
-  (` (+ index (char-bytes char))))
+  (` (+ (, index) (char-bytes (, char)))))
 
 ;;; @@ obsoleted aliases
 ;;;
 ;;; You should not use them.
 
 (defalias 'char-length 'char-bytes)
-(defalias 'char-columns 'char-width)
+;;(defalias 'char-columns 'char-width)
 
 
 ;;; @ string
@@ -370,6 +398,8 @@ Optional non-nil arg START-COLUMN specifies the starting column.
 ;;;
   )
 
+(defalias 'looking-at-as-unibyte 'looking-at)
+
 
 ;;; @ regulation
 ;;;