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 ;; Redefine if -{dos|mac|unix} is not found.
38 (or (find-coding-system 'raw-text-dos)
39 (copy-coding-system 'no-conversion-dos 'raw-text-dos))
40 (or (find-coding-system 'raw-text-mac)
41 (copy-coding-system 'no-conversion-mac 'raw-text-mac))
42 (or (find-coding-system 'raw-text-unix)
43 (copy-coding-system 'no-conversion-unix 'raw-text-unix))
45 (or (find-coding-system 'ctext-dos)
48 "Coding-system used in X as Compound Text Encoding."
49 '(charset-g0 ascii charset-g1 latin-iso8859-1
53 (or (find-coding-system 'iso-2022-jp-2-dos)
55 'iso-2022-jp-2 'iso2022
56 "ISO-2022 coding system using SS2 for 96-charset in 7-bit code."
58 charset-g2 t ;; unspecified but can be used later.
64 (or (find-coding-system 'euc-kr-dos)
67 "Coding-system of Korean EUC (Extended Unix Code)."
68 '(charset-g0 ascii charset-g1 korean-ksc5601
72 ;; (when (= (function-max-args 'coding-system-list) 0)
73 ;; (or (fboundp 'coding-system-list-internal)
74 ;; (fset 'coding-system-list-internal
75 ;; (symbol-function 'coding-system-list)))
76 ;; (defun coding-system-list (&optional base-only)
77 ;; "Return a list of all existing coding systems.
78 ;; If optional arg BASE-ONLY is non-nil, only base coding systems are listed."
81 ;; (rest (coding-system-list-internal))
84 ;; (setq cs (coding-system-name (coding-system-base (pop rest))))
89 ;; (coding-system-list-internal)))
93 ;;; @ without code-conversion
96 (defun insert-file-contents-as-binary (filename
97 &optional visit beg end replace)
98 "Like `insert-file-contents', but only reads in the file literally.
99 A buffer may be modified in several ways after reading into the buffer,
100 to Emacs features such as format decoding, character code
101 conversion, find-file-hooks, automatic uncompression, etc.
103 This function ensures that none of these modifications will take place."
104 (let ((format-alist nil)
105 (after-insert-file-functions nil)
106 (coding-system-for-read 'binary)
107 (coding-system-for-write 'binary)
108 (jka-compr-compression-info-list nil)
109 (find-buffer-file-type-function
110 (if (fboundp 'find-buffer-file-type)
111 (symbol-function 'find-buffer-file-type)
115 (fset 'find-buffer-file-type (lambda (filename) t))
116 (insert-file-contents filename visit beg end replace))
117 (if find-buffer-file-type-function
118 (fset 'find-buffer-file-type find-buffer-file-type-function)
119 (fmakunbound 'find-buffer-file-type)))))
122 ;;; @ buffer representation
125 (defsubst-maybe set-buffer-multibyte (flag)
126 "Set the multibyte flag of the current buffer to FLAG.
127 If FLAG is t, this makes the buffer a multibyte buffer.
128 If FLAG is nil, this makes the buffer a single-byte buffer.
129 The buffer contents remain unchanged as a sequence of bytes
130 but the contents viewed as characters do change.
131 \[Emacs 20.3 emulating function]"
138 ;; avoid bug of XEmacs
139 (or (integerp (cdr (split-char ?a)))
140 (defun split-char (char)
141 "Return list of charset and one or two position-codes of CHAR."
142 (let ((charset (char-charset char)))
143 (if (eq charset 'ascii)
144 (list charset (char-int char))
146 (len (charset-dimension charset))
147 (code (if (integerp char)
152 (setq dest (cons (logand code 127) dest)
155 (cons charset dest)))))
158 (defmacro char-next-index (char index)
159 "Return index of character succeeding CHAR whose index is INDEX."
166 (defun-maybe string-to-int-list (str)
167 (mapcar #'char-int str))
169 (defalias 'looking-at-as-unibyte 'looking-at)
177 ;;; poem-xm.el ends here