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.
30 ;;; @ fix coding-system definition
33 ;; It seems not bug, but I can not permit it...
34 (and (coding-system-property 'iso-2022-jp 'input-charset-conversion)
35 (copy-coding-system 'iso-2022-7bit 'iso-2022-jp))
37 (and (coding-system-property 'iso-2022-jp-dos 'input-charset-conversion)
38 (copy-coding-system 'iso-2022-7bit-dos 'iso-2022-jp-dos))
40 ;; Redefine if -{dos|mac|unix} is not found.
41 (or (find-coding-system 'raw-text-dos)
42 (copy-coding-system 'no-conversion-dos 'raw-text-dos))
43 (or (find-coding-system 'raw-text-mac)
44 (copy-coding-system 'no-conversion-mac 'raw-text-mac))
45 (or (find-coding-system 'raw-text-unix)
46 (copy-coding-system 'no-conversion-unix 'raw-text-unix))
48 (or (find-coding-system 'ctext-dos)
51 "Coding-system used in X as Compound Text Encoding."
52 '(charset-g0 ascii charset-g1 latin-iso8859-1
56 (or (find-coding-system 'iso-2022-jp-2-dos)
58 'iso-2022-jp-2 'iso2022
59 "ISO-2022 coding system using SS2 for 96-charset in 7-bit code."
61 charset-g2 t ;; unspecified but can be used later.
67 (or (find-coding-system 'gb2312-dos)
68 (copy-coding-system 'cn-gb-2312-dos 'gb2312-dos))
69 (or (find-coding-system 'gb2312-mac)
70 (copy-coding-system 'cn-gb-2312-mac 'gb2312-mac))
71 (or (find-coding-system 'gb2312-unix)
72 (copy-coding-system 'cn-gb-2312-unix 'gb2312-unix))
74 (or (find-coding-system 'euc-kr-dos)
77 "Coding-system of Korean EUC (Extended Unix Code)."
78 '(charset-g0 ascii charset-g1 korean-ksc5601
82 ;; (when (= (function-max-args 'coding-system-list) 0)
83 ;; (or (fboundp 'coding-system-list-internal)
84 ;; (fset 'coding-system-list-internal
85 ;; (symbol-function 'coding-system-list)))
86 ;; (defun coding-system-list (&optional base-only)
87 ;; "Return a list of all existing coding systems.
88 ;; If optional arg BASE-ONLY is non-nil, only base coding systems are listed."
91 ;; (rest (coding-system-list-internal))
94 ;; (setq cs (coding-system-name (coding-system-base (pop rest))))
99 ;; (coding-system-list-internal)))
103 ;;; @ without code-conversion
106 (defun insert-file-contents-as-binary (filename
107 &optional visit beg end replace)
108 "Like `insert-file-contents', but only reads in the file literally.
109 A buffer may be modified in several ways after reading into the buffer,
110 to Emacs features such as format decoding, character code
111 conversion, find-file-hooks, automatic uncompression, etc.
113 This function ensures that none of these modifications will take place."
114 (let ((format-alist nil)
115 (after-insert-file-functions nil)
116 (coding-system-for-read 'binary)
117 (coding-system-for-write 'binary)
118 (jka-compr-compression-info-list nil)
119 (jam-zcat-filename-list nil)
120 (find-buffer-file-type-function
121 (if (fboundp 'find-buffer-file-type)
122 (symbol-function 'find-buffer-file-type)
126 (fset 'find-buffer-file-type (lambda (filename) t))
127 (insert-file-contents filename visit beg end replace))
128 (if find-buffer-file-type-function
129 (fset 'find-buffer-file-type find-buffer-file-type-function)
130 (fmakunbound 'find-buffer-file-type)))))
133 ;;; @ buffer representation
136 (defsubst-maybe set-buffer-multibyte (flag)
137 "Set the multibyte flag of the current buffer to FLAG.
138 If FLAG is t, this makes the buffer a multibyte buffer.
139 If FLAG is nil, this makes the buffer a single-byte buffer.
140 The buffer contents remain unchanged as a sequence of bytes
141 but the contents viewed as characters do change.
142 \[Emacs 20.3 emulating function]"
149 ;; avoid bug of XEmacs
150 (or (integerp (cdr (split-char ?a)))
151 (defun split-char (char)
152 "Return list of charset and one or two position-codes of CHAR."
153 (let ((charset (char-charset char)))
154 (if (eq charset 'ascii)
155 (list charset (char-int char))
157 (len (charset-dimension charset))
158 (code (if (integerp char)
163 (setq dest (cons (logand code 127) dest)
166 (cons charset dest)))))
169 (defmacro char-next-index (char index)
170 "Return index of character succeeding CHAR whose index is INDEX."
177 (defun-maybe string-to-int-list (str)
178 (mapcar #'char-int str))
180 (defalias 'looking-at-as-unibyte 'looking-at)
188 ;;; poem-xm.el ends here