1 ;;; emu-e20.el --- emu API implementation for Emacs 20.1 and 20.2
3 ;; Copyright (C) 1996,1997,1998 Free Software Foundation, Inc.
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: emulation, compatibility, Mule
8 ;; This file is part of emu.
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.
27 ;; This module requires Emacs 20.1 and 20.2.
33 (defun fontset-pixel-size (fontset)
34 (let* ((info (fontset-info fontset))
35 (height (aref info 1))
37 (cond ((> height 0) height)
38 ((string-match "-\\([0-9]+\\)-" fontset)
40 (substring fontset (match-beginning 1)(match-end 1))
50 ;; (defalias 'charset-columns 'charset-width)
52 (defun find-non-ascii-charset-string (string)
53 "Return a list of charsets in the STRING except ascii."
54 (delq 'ascii (find-charset-string string))
57 (defun find-non-ascii-charset-region (start end)
58 "Return a list of charsets except ascii
59 in the region between START and END."
60 (delq 'ascii (find-charset-string (buffer-substring start end)))
67 (defsubst-maybe find-coding-system (obj)
68 "Return OBJ if it is a coding-system."
69 (if (coding-system-p obj)
72 (defalias 'set-process-input-coding-system 'set-process-coding-system)
78 (defun insert-binary-file-contents (filename &optional visit beg end replace)
79 "Like `insert-file-contents', q.v., but don't code and format conversion."
80 (let ((flag enable-multibyte-characters)
81 (coding-system-for-read 'binary)
83 (insert-file-contents filename visit beg end replace)
84 (setq enable-multibyte-characters flag)
87 (defalias 'insert-binary-file-contents-literally
88 'insert-file-contents-literally)
94 (defsubst encode-mime-charset-region (start end charset)
95 "Encode the text between START and END as MIME CHARSET."
97 (if (and enable-multibyte-characters
98 (setq cs (mime-charset-to-coding-system charset)))
99 (encode-coding-region start end cs)
102 (defsubst decode-mime-charset-region (start end charset)
103 "Decode the text between START and END as MIME CHARSET."
105 (if (and enable-multibyte-characters
106 (setq cs (mime-charset-to-coding-system charset)))
107 (decode-coding-region start end cs)
110 (defsubst encode-mime-charset-string (string charset)
111 "Encode the STRING as MIME CHARSET."
113 (if (and enable-multibyte-characters
114 (setq cs (mime-charset-to-coding-system charset)))
115 (encode-coding-string string cs)
118 (defsubst decode-mime-charset-string (string charset)
119 "Decode the STRING as MIME CHARSET."
121 (if (and enable-multibyte-characters
122 (setq cs (mime-charset-to-coding-system charset)))
123 (decode-coding-string string cs)
127 (defvar charsets-mime-charset-alist
128 '(((ascii) . us-ascii)
129 ((ascii latin-iso8859-1) . iso-8859-1)
130 ((ascii latin-iso8859-2) . iso-8859-2)
131 ((ascii latin-iso8859-3) . iso-8859-3)
132 ((ascii latin-iso8859-4) . iso-8859-4)
133 ;;; ((ascii cyrillic-iso8859-5) . iso-8859-5)
134 ((ascii cyrillic-iso8859-5) . koi8-r)
135 ((ascii arabic-iso8859-6) . iso-8859-6)
136 ((ascii greek-iso8859-7) . iso-8859-7)
137 ((ascii hebrew-iso8859-8) . iso-8859-8)
138 ((ascii latin-iso8859-9) . iso-8859-9)
139 ((ascii latin-jisx0201
140 japanese-jisx0208-1978 japanese-jisx0208) . iso-2022-jp)
141 ((ascii korean-ksc5601) . euc-kr)
142 ((ascii chinese-gb2312) . cn-gb-2312)
143 ((ascii chinese-big5-1 chinese-big5-2) . cn-big5)
144 ((ascii latin-iso8859-1 greek-iso8859-7
145 latin-jisx0201 japanese-jisx0208-1978
146 chinese-gb2312 japanese-jisx0208
147 korean-ksc5601 japanese-jisx0212) . iso-2022-jp-2)
148 ((ascii latin-iso8859-1 greek-iso8859-7
149 latin-jisx0201 japanese-jisx0208-1978
150 chinese-gb2312 japanese-jisx0208
151 korean-ksc5601 japanese-jisx0212
152 chinese-cns11643-1 chinese-cns11643-2) . iso-2022-int-1)
153 ((ascii latin-iso8859-1 latin-iso8859-2
154 cyrillic-iso8859-5 greek-iso8859-7
155 latin-jisx0201 japanese-jisx0208-1978
156 chinese-gb2312 japanese-jisx0208
157 korean-ksc5601 japanese-jisx0212
158 chinese-cns11643-1 chinese-cns11643-2
159 chinese-cns11643-3 chinese-cns11643-4
160 chinese-cns11643-5 chinese-cns11643-6
161 chinese-cns11643-7) . iso-2022-int-1)
168 (defalias 'char-length 'char-bytes)
170 (defalias 'char-columns 'char-width)
173 ;;; @@ Mule emulating aliases
175 ;;; You should not use them.
177 (defun char-category (character)
178 "Return string of category mnemonics for CHAR in TABLE.
179 CHAR can be any multilingual character
180 TABLE defaults to the current buffer's category table."
181 (category-set-mnemonics (char-category-set character))
188 (defalias 'string-columns 'string-width)
190 (defalias 'sset 'store-substring)
192 (defun string-to-char-list (string)
193 "Return a list of which elements are characters in the STRING."
194 (let* ((len (length string))
198 (setq chr (sref string i))
199 (setq l (cons chr l))
200 (setq i (+ i (char-bytes chr)))
205 (defalias 'string-to-int-list 'string-to-char-list)
215 ;;; emu-e20.el ends here