Add commented out modification for `coding-system-list'.
[elisp/apel.git] / poem-xm.el
1 ;;; poem-xm.el --- poem implementation for XEmacs-mule
2
3 ;; Copyright (C) 1998 Free Software Foundation, Inc.
4
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: emulation, compatibility, Mule
7
8 ;; This file is part of APEL (A Portable Emacs Library).
9
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.
14
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.
19
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.
24
25 ;;; Code:
26
27 (require 'poem-20)
28
29
30 ;;; @ fix coding-system definition
31 ;;;
32
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))
36
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))
44
45 (or (find-coding-system 'ctext-dos)
46     (make-coding-system
47      'ctext 'iso2022
48      "Coding-system used in X as Compound Text Encoding."
49      '(charset-g0 ascii charset-g1 latin-iso8859-1
50                   eol-type nil
51                   mnemonic "CText")))
52
53 (or (find-coding-system 'iso-2022-jp-2-dos)
54     (make-coding-system
55      'iso-2022-jp-2 'iso2022
56      "ISO-2022 coding system using SS2 for 96-charset in 7-bit code."
57      '(charset-g0 ascii
58        charset-g2 t ;; unspecified but can be used later.
59        seven t
60        short t
61        mnemonic "ISO7/SS2"
62        eol-type nil)))
63
64 (or (find-coding-system 'euc-kr-dos)
65     (make-coding-system
66      'euc-kr 'iso2022
67      "Coding-system of Korean EUC (Extended Unix Code)."
68      '(charset-g0 ascii charset-g1 korean-ksc5601
69                   mnemonic "ko/EUC"
70                   eol-type nil)))
71
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."
79 ;;     (if base-only
80 ;;         (let (dest
81 ;;               (rest (coding-system-list-internal))
82 ;;               cs)
83 ;;           (while rest
84 ;;             (setq cs (coding-system-name (coding-system-base (pop rest))))
85 ;;             (or (memq cs dest)
86 ;;                 (push cs dest))
87 ;;             )
88 ;;           dest)
89 ;;       (coding-system-list-internal)))
90 ;;   )
91
92
93 ;;; @ buffer representation
94 ;;;
95
96 (defsubst-maybe set-buffer-multibyte (flag)
97   "Set the multibyte flag of the current buffer to FLAG.
98 If FLAG is t, this makes the buffer a multibyte buffer.
99 If FLAG is nil, this makes the buffer a single-byte buffer.
100 The buffer contents remain unchanged as a sequence of bytes
101 but the contents viewed as characters do change.
102 \[Emacs 20.3 emulating function]"
103   flag)
104
105
106 ;;; @ character
107 ;;;
108
109 ;; avoid bug of XEmacs
110 (or (integerp (cdr (split-char ?a)))
111     (defun split-char (char)
112       "Return list of charset and one or two position-codes of CHAR."
113       (let ((charset (char-charset char)))
114         (if (eq charset 'ascii)
115             (list charset (char-int char))
116           (let ((i 0)
117                 (len (charset-dimension charset))
118                 (code (if (integerp char)
119                           char
120                         (char-int char)))
121                 dest)
122             (while (< i len)
123               (setq dest (cons (logand code 127) dest)
124                     code (lsh code -7)
125                     i (1+ i)))
126             (cons charset dest)))))
127     )
128
129 (defmacro char-next-index (char index)
130   "Return index of character succeeding CHAR whose index is INDEX."
131   `(1+ ,index))
132
133
134 ;;; @ string
135 ;;;
136
137 (defun string-to-int-list (str)
138   (mapcar #'char-int str))
139
140 (defalias 'looking-at-as-unibyte 'looking-at)
141
142
143 ;;; @ end
144 ;;;
145
146 (provide 'poem-xm)
147
148 ;;; poem-xm.el ends here