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 'euc-kr-dos)
70 "Coding-system of Korean EUC (Extended Unix Code)."
71 '(charset-g0 ascii charset-g1 korean-ksc5601
75 ;; (when (= (function-max-args 'coding-system-list) 0)
76 ;; (or (fboundp 'coding-system-list-internal)
77 ;; (fset 'coding-system-list-internal
78 ;; (symbol-function 'coding-system-list)))
79 ;; (defun coding-system-list (&optional base-only)
80 ;; "Return a list of all existing coding systems.
81 ;; If optional arg BASE-ONLY is non-nil, only base coding systems are listed."
84 ;; (rest (coding-system-list-internal))
87 ;; (setq cs (coding-system-name (coding-system-base (pop rest))))
92 ;; (coding-system-list-internal)))
96 ;;; @ without code-conversion
99 (defun insert-file-contents-as-binary (filename
100 &optional visit beg end replace)
101 "Like `insert-file-contents', but only reads in the file literally.
102 A buffer may be modified in several ways after reading into the buffer,
103 to Emacs features such as format decoding, character code
104 conversion, find-file-hooks, automatic uncompression, etc.
106 This function ensures that none of these modifications will take place."
107 (let ((format-alist nil)
108 (after-insert-file-functions nil)
109 (coding-system-for-read 'binary)
110 (coding-system-for-write 'binary)
111 (jka-compr-compression-info-list nil)
112 (jam-zcat-filename-list nil)
113 (find-buffer-file-type-function
114 (if (fboundp 'find-buffer-file-type)
115 (symbol-function 'find-buffer-file-type)
119 (fset 'find-buffer-file-type (lambda (filename) t))
120 (insert-file-contents filename visit beg end replace))
121 (if find-buffer-file-type-function
122 (fset 'find-buffer-file-type find-buffer-file-type-function)
123 (fmakunbound 'find-buffer-file-type)))))
126 ;;; @ buffer representation
129 (defsubst-maybe set-buffer-multibyte (flag)
130 "Set the multibyte flag of the current buffer to FLAG.
131 If FLAG is t, this makes the buffer a multibyte buffer.
132 If FLAG is nil, this makes the buffer a single-byte buffer.
133 The buffer contents remain unchanged as a sequence of bytes
134 but the contents viewed as characters do change.
135 \[Emacs 20.3 emulating function]"
142 ;; avoid bug of XEmacs
143 (or (integerp (cdr (split-char ?a)))
144 (defun split-char (char)
145 "Return list of charset and one or two position-codes of CHAR."
146 (let ((charset (char-charset char)))
147 (if (eq charset 'ascii)
148 (list charset (char-int char))
150 (len (charset-dimension charset))
151 (code (if (integerp char)
156 (setq dest (cons (logand code 127) dest)
159 (cons charset dest)))))
162 (defmacro char-next-index (char index)
163 "Return index of character succeeding CHAR whose index is INDEX."
170 (defun-maybe string-to-int-list (str)
171 (mapcar #'char-int str))
173 (defalias 'looking-at-as-unibyte 'looking-at)
181 ;;; poem-xm.el ends here