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))
46 (if (and (fboundp 'set-buffer-multibyte)
47 (subrp (symbol-function 'set-buffer-multibyte)))
48 (require 'emu-e20_3) ; for Emacs 20.3
49 (require 'emu-e20_2) ; for Emacs 20.1 and 20.2
56 ;; (defalias 'charset-columns 'charset-width)
58 (defun find-non-ascii-charset-string (string)
59 "Return a list of charsets in the STRING except ascii."
60 (delq 'ascii (find-charset-string string))
63 (defun find-non-ascii-charset-region (start end)
64 "Return a list of charsets except ascii
65 in the region between START and END."
66 (delq 'ascii (find-charset-string (buffer-substring start end)))
73 (defsubst-maybe find-coding-system (obj)
74 "Return OBJ if it is a coding-system."
75 (if (coding-system-p obj)
78 (defalias 'set-process-input-coding-system 'set-process-coding-system)
84 (defun insert-file-contents-as-binary (filename
85 &optional visit beg end replace)
86 "Like `insert-file-contents', q.v., but don't code and format conversion.
87 Like `insert-file-contents-literary', but it allows find-file-hooks,
88 automatic uncompression, etc.
90 Namely this function ensures that only format decoding and character
91 code conversion will not take place."
92 (let ((flag enable-multibyte-characters)
93 (coding-system-for-read 'binary)
95 (insert-file-contents filename visit beg end replace)
96 (set-buffer-multibyte flag)
99 (defalias 'insert-binary-file-contents 'insert-file-contents-as-binary)
100 (make-obsolete 'insert-binary-file-contents 'insert-file-contents-as-binary)
102 (defun insert-file-contents-as-raw-text (filename
103 &optional visit beg end replace)
104 "Like `insert-file-contents', q.v., but don't code and format conversion.
105 Like `insert-file-contents-literary', but it allows find-file-hooks,
106 automatic uncompression, etc.
107 Like `insert-file-contents-as-binary', but it converts line-break
109 (let ((flag enable-multibyte-characters)
110 (coding-system-for-read 'raw-text)
112 (insert-file-contents filename visit beg end replace)
113 (set-buffer-multibyte flag)
116 (defalias 'insert-binary-file-contents-literally
117 'insert-file-contents-literally)
123 (defsubst encode-mime-charset-region (start end charset)
124 "Encode the text between START and END as MIME CHARSET."
126 (if (and enable-multibyte-characters
127 (setq cs (mime-charset-to-coding-system charset)))
128 (encode-coding-region start end cs)
131 (defsubst decode-mime-charset-region (start end charset)
132 "Decode the text between START and END as MIME CHARSET."
134 (if (and enable-multibyte-characters
135 (setq cs (mime-charset-to-coding-system charset)))
136 (decode-coding-region start end cs)
139 (defsubst encode-mime-charset-string (string charset)
140 "Encode the STRING as MIME CHARSET."
142 (if (and enable-multibyte-characters
143 (setq cs (mime-charset-to-coding-system charset)))
144 (encode-coding-string string cs)
147 (defsubst decode-mime-charset-string (string charset)
148 "Decode the STRING as MIME CHARSET."
150 (if (and enable-multibyte-characters
151 (setq cs (mime-charset-to-coding-system charset)))
152 (decode-coding-string string cs)
156 (defvar charsets-mime-charset-alist
157 '(((ascii) . us-ascii)
158 ((ascii latin-iso8859-1) . iso-8859-1)
159 ((ascii latin-iso8859-2) . iso-8859-2)
160 ((ascii latin-iso8859-3) . iso-8859-3)
161 ((ascii latin-iso8859-4) . iso-8859-4)
162 ;;; ((ascii cyrillic-iso8859-5) . iso-8859-5)
163 ((ascii cyrillic-iso8859-5) . koi8-r)
164 ((ascii arabic-iso8859-6) . iso-8859-6)
165 ((ascii greek-iso8859-7) . iso-8859-7)
166 ((ascii hebrew-iso8859-8) . iso-8859-8)
167 ((ascii latin-iso8859-9) . iso-8859-9)
168 ((ascii latin-jisx0201
169 japanese-jisx0208-1978 japanese-jisx0208) . iso-2022-jp)
170 ((ascii latin-jisx0201
171 katakana-jisx0201 japanese-jisx0208) . shift_jis)
172 ((ascii korean-ksc5601) . euc-kr)
173 ((ascii chinese-gb2312) . cn-gb-2312)
174 ((ascii chinese-big5-1 chinese-big5-2) . cn-big5)
175 ((ascii latin-iso8859-1 greek-iso8859-7
176 latin-jisx0201 japanese-jisx0208-1978
177 chinese-gb2312 japanese-jisx0208
178 korean-ksc5601 japanese-jisx0212) . iso-2022-jp-2)
179 ((ascii latin-iso8859-1 greek-iso8859-7
180 latin-jisx0201 japanese-jisx0208-1978
181 chinese-gb2312 japanese-jisx0208
182 korean-ksc5601 japanese-jisx0212
183 chinese-cns11643-1 chinese-cns11643-2) . iso-2022-int-1)
184 ((ascii latin-iso8859-1 latin-iso8859-2
185 cyrillic-iso8859-5 greek-iso8859-7
186 latin-jisx0201 japanese-jisx0208-1978
187 chinese-gb2312 japanese-jisx0208
188 korean-ksc5601 japanese-jisx0212
189 chinese-cns11643-1 chinese-cns11643-2
190 chinese-cns11643-3 chinese-cns11643-4
191 chinese-cns11643-5 chinese-cns11643-6
192 chinese-cns11643-7) . iso-2022-int-1)
199 ;;; @@ Mule emulating aliases
201 ;;; You should not use them.
203 (defun char-category (character)
204 "Return string of category mnemonics for CHAR in TABLE.
205 CHAR can be any multilingual character
206 TABLE defaults to the current buffer's category table."
207 (category-set-mnemonics (char-category-set character))
218 ;;; emu-e20.el ends here