1 ;;; emu-e19.el --- emu module for Emacs 19 and XEmacs 19
3 ;; Copyright (C) 1995,1996 Free Software Foundation, Inc.
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
7 ;; $Id: emu-e19.el,v 7.32 1996/08/17 03:25:51 morioka Exp $
8 ;; Keywords: emulation, compatibility, mule, Latin-1
10 ;; This file is part of tl (Tiny Library).
12 ;; This program is free software; you can redistribute it and/or
13 ;; modify it under the terms of the GNU General Public License as
14 ;; published by the Free Software Foundation; either version 2, or (at
15 ;; your option) any later version.
17 ;; This program is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ;; General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with this program; see the file COPYING. If not, write to
24 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
29 ;;; @ version and variant specific features
33 (require 'emu-xemacs))
42 (defconst charset-ascii 0 "Character set of ASCII")
43 (defconst charset-latin-1 129 "Character set of ISO-8859-1")
45 (defun charset-description (charset)
46 "Return description of CHARSET. [emu-e19.el]"
48 (documentation-property 'charset-ascii 'variable-documentation)
49 (documentation-property 'charset-latin-1 'variable-documentation)
52 (defun charset-registry (charset)
53 "Return registry name of CHARSET. [emu-e19.el]"
58 (defun charset-columns (charset)
59 "Return number of columns a CHARSET occupies when displayed.
63 (defun charset-direction (charset)
64 "Return the direction of a character of CHARSET by
65 0 (left-to-right) or 1 (right-to-left). [emu-e19.el]"
68 (defun find-charset-string (str)
69 "Return a list of charsets in the string.
70 \[emu-e19.el; Mule emulating function]"
71 (if (string-match "[\200-\377]" str)
75 (defun find-charset-region (start end)
76 "Return a list of charsets in the region between START and END.
77 \[emu-e19.el; Mule emulating function]"
80 (narrow-to-region start end)
82 (re-search-forward "[\200-\377]" nil t)
87 ;;; @@ for Mule emulation
91 (defconst lc-ltn1 129)
97 (defconst *internal* nil)
98 (defconst *ctext* nil)
99 (defconst *noconv* nil)
101 (defun code-convert-string (str ic oc)
102 "Convert code in STRING from SOURCE code to TARGET code,
103 On successful converion, returns the result string,
104 else returns nil. [emu-e19.el; Mule emulating function]"
107 (defun code-convert-region (beg end ic oc)
108 "Convert code of the text between BEGIN and END from SOURCE
109 to TARGET. On successful conversion returns t,
110 else returns nil. [emu-e19.el; Mule emulating function]"
113 (defun decode-coding-string (string coding-system)
114 "Decode the STRING which is encoded in CODING-SYSTEM.
118 (defun code-detect-region (beg end)
119 "Detect coding-system of the text in the region
120 between START and END. [emu-e19.el; Mule emulating function]"
123 (defun set-file-coding-system (coding-system &optional force)
126 (defmacro as-binary-process (&rest body)
127 (` (let (selective-display) ; Disable ^M to nl translation.
135 (defvar charsets-mime-charset-alist
136 (list (cons (list charset-ascii) 'us-ascii)))
138 (defvar default-mime-charset 'iso-8859-1)
140 (defun mime-charset-to-coding-system (charset)
141 (if (stringp charset)
142 (setq charset (intern (downcase charset)))
144 (and (memq charset (list 'us-ascii default-mime-charset))
148 (defun detect-mime-charset-region (start end)
149 "Return MIME charset for region between START and END.
153 (narrow-to-region start end)
155 (re-search-forward "[\200-\377]" nil t)
160 (defun encode-mime-charset-region (start end charset)
161 "Encode the text between START and END as MIME CHARSET.
165 (defun decode-mime-charset-region (start end charset)
166 "Decode the text between START and END as MIME CHARSET.
170 (defun encode-mime-charset-string (string charset)
171 "Encode the STRING as MIME CHARSET. [emu-e19.el]"
174 (defun decode-mime-charset-string (string charset)
175 "Decode the STRING as MIME CHARSET. [emu-e19.el]"
182 (defun char-charset (chr)
183 "Return the character set of char CHR.
184 \[emu-e19.el; XEmacs 20 emulating function]"
189 (defun char-bytes (char)
190 "Return number of bytes a character in CHAR occupies in a buffer.
191 \[emu-e19.el; Mule emulating function]"
194 (defalias 'char-length 'char-bytes)
196 (defun char-columns (character)
197 "Return number of columns a CHARACTER occupies when displayed.
201 ;;; @@ for Mule emulation
204 (defalias 'char-width 'char-columns)
206 (defalias 'char-leading-char 'char-charset)
212 (defalias 'string-columns 'length)
214 (defun string-to-char-list (str)
215 (mapcar (function identity) str)
218 (defalias 'string-to-int-list 'string-to-char-list)
220 (defalias 'sref 'aref)
222 (defun truncate-string (str width &optional start-column)
223 "Truncate STR to fit in WIDTH columns.
224 Optional non-nil arg START-COLUMN specifies the starting column.
225 \[emu-e19.el; Mule 2.3 emulating function]"
227 (setq start-column 0))
228 (substring str start-column width)
231 ;;; @@ for Mule emulation
234 (defalias 'string-width 'length)
242 ;;; emu-e19.el ends here