1 ;;; poem-xm.el --- poem module for XEmacs-mule; -*-byte-compile-dynamic: t;-*-
3 ;; Copyright (C) 1998 Free Software Foundation, Inc.
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: emulation, compatibility, Mule
8 ;; This file is part of APEL (A Portable Emacs Library).
10 ;; This program is free software; you can redistribute it and/or
11 ;; modify it under the terms of the GNU General Public License as
12 ;; published by the Free Software Foundation; either version 2, or (at
13 ;; your option) any later version.
15 ;; This program is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ;; General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
32 ;;; @ fix coding-system definition
35 ;; It seems not bug, but I can not permit it...
36 (and (coding-system-property 'iso-2022-jp 'input-charset-conversion)
37 (copy-coding-system 'iso-2022-7bit 'iso-2022-jp))
39 (and (coding-system-property 'iso-2022-jp-dos 'input-charset-conversion)
40 (copy-coding-system 'iso-2022-7bit-dos 'iso-2022-jp-dos))
42 ;; Redefine if -{dos|mac|unix} is not found.
43 (or (find-coding-system 'raw-text-dos)
44 (copy-coding-system 'no-conversion-dos 'raw-text-dos))
45 (or (find-coding-system 'raw-text-mac)
46 (copy-coding-system 'no-conversion-mac 'raw-text-mac))
47 (or (find-coding-system 'raw-text-unix)
48 (copy-coding-system 'no-conversion-unix 'raw-text-unix))
50 (or (find-coding-system 'ctext-dos)
53 "Coding-system used in X as Compound Text Encoding."
54 '(charset-g0 ascii charset-g1 latin-iso8859-1
58 (or (find-coding-system 'iso-2022-jp-2-dos)
60 'iso-2022-jp-2 'iso2022
61 "ISO-2022 coding system using SS2 for 96-charset in 7-bit code."
63 charset-g2 t ;; unspecified but can be used later.
69 (or (find-coding-system 'gb2312-dos)
70 (copy-coding-system 'cn-gb-2312-dos 'gb2312-dos))
71 (or (find-coding-system 'gb2312-mac)
72 (copy-coding-system 'cn-gb-2312-mac 'gb2312-mac))
73 (or (find-coding-system 'gb2312-unix)
74 (copy-coding-system 'cn-gb-2312-unix 'gb2312-unix))
76 (or (find-coding-system 'euc-kr-dos)
79 "Coding-system of Korean EUC (Extended Unix Code)."
80 '(charset-g0 ascii charset-g1 korean-ksc5601
84 ;; (when (= (function-max-args 'coding-system-list) 0)
85 ;; (or (fboundp 'coding-system-list-internal)
86 ;; (fset 'coding-system-list-internal
87 ;; (symbol-function 'coding-system-list)))
88 ;; (defun coding-system-list (&optional base-only)
89 ;; "Return a list of all existing coding systems.
90 ;; If optional arg BASE-ONLY is non-nil, only base coding systems are listed."
93 ;; (rest (coding-system-list-internal))
96 ;; (setq cs (coding-system-name (coding-system-base (pop rest))))
101 ;; (coding-system-list-internal)))
105 ;;; @ without code-conversion
108 (defun insert-file-contents-as-binary (filename
109 &optional visit beg end replace)
110 "Like `insert-file-contents', but only reads in the file literally.
111 A buffer may be modified in several ways after reading into the buffer,
112 to Emacs features such as format decoding, character code
113 conversion, find-file-hooks, automatic uncompression, etc.
115 This function ensures that none of these modifications will take place."
116 (let ((format-alist nil)
117 (after-insert-file-functions nil)
118 (coding-system-for-read 'binary)
119 (coding-system-for-write 'binary)
120 (jka-compr-compression-info-list nil)
121 (jam-zcat-filename-list nil)
122 (find-buffer-file-type-function
123 (if (fboundp 'find-buffer-file-type)
124 (symbol-function 'find-buffer-file-type)
128 (fset 'find-buffer-file-type (lambda (filename) t))
129 (insert-file-contents filename visit beg end replace))
130 (if find-buffer-file-type-function
131 (fset 'find-buffer-file-type find-buffer-file-type-function)
132 (fmakunbound 'find-buffer-file-type)))))
135 ;;; @ buffer representation
138 (defsubst-maybe set-buffer-multibyte (flag)
139 "Set the multibyte flag of the current buffer to FLAG.
140 If FLAG is t, this makes the buffer a multibyte buffer.
141 If FLAG is nil, this makes the buffer a single-byte buffer.
142 The buffer contents remain unchanged as a sequence of bytes
143 but the contents viewed as characters do change.
144 \[Emacs 20.3 emulating function]"
151 ;; avoid bug of XEmacs
152 (or (integerp (cdr (split-char ?a)))
153 (defun split-char (char)
154 "Return list of charset and one or two position-codes of CHAR."
155 (let ((charset (char-charset char)))
156 (if (eq charset 'ascii)
157 (list charset (char-int char))
159 (len (charset-dimension charset))
160 (code (if (integerp char)
165 (setq dest (cons (logand code 127) dest)
168 (cons charset dest)))))
171 (defmacro char-next-index (char index)
172 "Return index of character succeeding CHAR whose index is INDEX."
179 (defun-maybe string-to-int-list (str)
180 (mapcar #'char-int str))
182 (defalias 'looking-at-as-unibyte 'looking-at)
190 ;;; poem-xm.el ends here