annotate lisp/tl/emu-e19.el @ 22:8fc7fe29b841 r19-15b94

Import from CVS: tag r19-15b94
author cvs
date Mon, 13 Aug 2007 08:50:29 +0200
parents 0293115a14e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1 ;;; emu-e19.el --- emu module for Emacs 19 and XEmacs 19
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
2
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 10
diff changeset
3 ;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
6 ;; Version: $Id: emu-e19.el,v 1.4 1997/02/16 01:29:29 steve Exp $
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
7 ;; Keywords: emulation, compatibility, mule, Latin-1
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
8
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 4
diff changeset
9 ;; This file is part of emu.
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
10
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
11 ;; This program is free software; you can redistribute it and/or
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
12 ;; modify it under the terms of the GNU General Public License as
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
13 ;; published by the Free Software Foundation; either version 2, or (at
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
14 ;; your option) any later version.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
15
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
16 ;; This program is distributed in the hope that it will be useful, but
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
19 ;; General Public License for more details.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
20
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
24 ;; Boston, MA 02111-1307, USA.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
25
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
26 ;;; Code:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
27
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
28 ;;; @ version and variant specific features
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
29 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
30
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
31 (cond (running-xemacs
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
32 (require 'emu-xemacs))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
33 (running-emacs-19
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
34 (require 'emu-19)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
35 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
36
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
37
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
38 ;;; @ character set
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
39 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
40
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
41 (defconst charset-ascii 0 "Character set of ASCII")
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 4
diff changeset
42 (defconst charset-latin-iso8859-1 129 "Character set of ISO-8859-1")
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
43
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
44 (defun charset-description (charset)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
45 "Return description of CHARSET. [emu-e19.el]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
46 (if (< charset 128)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
47 (documentation-property 'charset-ascii 'variable-documentation)
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 4
diff changeset
48 (documentation-property 'charset-latin-iso8859-1 'variable-documentation)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
49 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
50
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
51 (defun charset-registry (charset)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
52 "Return registry name of CHARSET. [emu-e19.el]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
53 (if (< charset 128)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
54 "ASCII"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
55 "ISO8859-1"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
56
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
57 (defun charset-columns (charset)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
58 "Return number of columns a CHARSET occupies when displayed.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
59 \[emu-e19.el]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
60 1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
61
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
62 (defun charset-direction (charset)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
63 "Return the direction of a character of CHARSET by
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
64 0 (left-to-right) or 1 (right-to-left). [emu-e19.el]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
65 0)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
66
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
67 (defun find-charset-string (str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
68 "Return a list of charsets in the string.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
69 \[emu-e19.el; Mule emulating function]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
70 (if (string-match "[\200-\377]" str)
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 4
diff changeset
71 (list charset-latin-iso8859-1)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
72 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
73
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
74 (defalias 'find-non-ascii-charset-string 'find-charset-string)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
75
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
76 (defun find-charset-region (start end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
77 "Return a list of charsets in the region between START and END.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
78 \[emu-e19.el; Mule emulating function]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
79 (if (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
80 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
81 (narrow-to-region start end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
82 (goto-char start)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
83 (re-search-forward "[\200-\377]" nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
84 ))
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 4
diff changeset
85 (list charset-latin-iso8859-1)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
86 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
87
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
88 (defalias 'find-non-ascii-charset-region 'find-charset-region)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
89
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
90
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
91 ;;; @ coding-system
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
92 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
93
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
94 (defconst *internal* nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
95 (defconst *ctext* nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
96 (defconst *noconv* nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
97
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
98 (defun decode-coding-string (string coding-system)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
99 "Decode the STRING which is encoded in CODING-SYSTEM.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
100 \[emu-e19.el; Emacs 20 emulating function]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
101 string)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
102
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
103 (defun encode-coding-string (string coding-system)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
104 "Encode the STRING as CODING-SYSTEM.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
105 \[emu-e19.el; Emacs 20 emulating function]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
106 string)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
107
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
108 (defun decode-coding-region (start end coding-system)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
109 "Decode the text between START and END which is encoded in CODING-SYSTEM.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
110 \[emu-e19.el; Emacs 20 emulating function]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
111 0)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
112
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
113 (defun encode-coding-region (start end coding-system)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
114 "Encode the text between START and END to CODING-SYSTEM.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
115 \[emu-e19.el; Emacs 20 emulating function]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
116 0)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
117
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
118 (defun detect-coding-region (start end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
119 "Detect coding-system of the text in the region between START and END.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
120 \[emu-e19.el; Emacs 20 emulating function]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
121 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
122
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
123 (defun set-buffer-file-coding-system (coding-system &optional force)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
124 "Set buffer-file-coding-system of the current buffer to CODING-SYSTEM.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
125 \[emu-e19.el; Emacs 20 emulating function]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
126 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
127
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
128 (defmacro as-binary-process (&rest body)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
129 (` (let (selective-display) ; Disable ^M to nl translation.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
130 (,@ body)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
131 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
132
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
133 (defmacro as-binary-input-file (&rest body)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
134 (` (let ((emx-binary-mode t)) ; Stop CRLF to LF conversion in OS/2
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
135 (,@ body)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
136 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
137
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 10
diff changeset
138 (defmacro as-binary-output-file (&rest body)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 10
diff changeset
139 (` (let ((emx-binary-mode t)) ; Stop CRLF to LF conversion in OS/2
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 10
diff changeset
140 (,@ body)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 10
diff changeset
141 )))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 10
diff changeset
142
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
143
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
144 ;;; @@ for old MULE emulation
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
145 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
146
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
147 (defun code-convert-string (str ic oc)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
148 "Convert code in STRING from SOURCE code to TARGET code,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
149 On successful converion, returns the result string,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
150 else returns nil. [emu-e19.el; old MULE emulating function]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
151 str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
152
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
153 (defun code-convert-region (beg end ic oc)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
154 "Convert code of the text between BEGIN and END from SOURCE
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
155 to TARGET. On successful conversion returns t,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
156 else returns nil. [emu-e19.el; old MULE emulating function]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
157 t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
158
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
159
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
160 ;;; @ binary access
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
161 ;;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
162
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
163 (defun insert-binary-file-contents-literally
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
164 (filename &optional visit beg end replace)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
165 "Like `insert-file-contents-literally', q.v., but don't code conversion.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
166 A buffer may be modified in several ways after reading into the buffer due
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
167 to advanced Emacs features, such as file-name-handlers, format decoding,
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
168 find-file-hooks, etc.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
169 This function ensures that none of these modifications will take place."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
170 (let ((emx-binary-mode t))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
171 (insert-file-contents-literally filename visit beg end replace)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
172 ))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
173
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
174
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
175 ;;; @ MIME charset
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
176 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
177
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
178 (defvar charsets-mime-charset-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
179 (list (cons (list charset-ascii) 'us-ascii)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
180
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
181 (defvar default-mime-charset 'iso-8859-1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
182
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
183 (defun mime-charset-to-coding-system (charset)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
184 (if (stringp charset)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
185 (setq charset (intern (downcase charset)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
186 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
187 (and (memq charset (list 'us-ascii default-mime-charset))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
188 charset)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
189 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
190
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
191 (defun detect-mime-charset-region (start end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
192 "Return MIME charset for region between START and END.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
193 \[emu-e19.el]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
194 (if (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
195 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
196 (narrow-to-region start end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
197 (goto-char start)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
198 (re-search-forward "[\200-\377]" nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
199 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
200 default-mime-charset
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
201 'us-ascii))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
202
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
203 (defun encode-mime-charset-region (start end charset)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
204 "Encode the text between START and END as MIME CHARSET.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
205 \[emu-e19.el]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
206 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
207
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
208 (defun decode-mime-charset-region (start end charset)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
209 "Decode the text between START and END as MIME CHARSET.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
210 \[emu-e19.el]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
211 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
212
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
213 (defun encode-mime-charset-string (string charset)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
214 "Encode the STRING as MIME CHARSET. [emu-e19.el]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
215 string)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
216
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
217 (defun decode-mime-charset-string (string charset)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
218 "Decode the STRING as MIME CHARSET. [emu-e19.el]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
219 string)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
220
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
221
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
222 ;;; @ character
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
223 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
224
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
225 (defun char-charset (chr)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
226 "Return the character set of char CHR.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
227 \[emu-e19.el; XEmacs 20 emulating function]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
228 (if (< chr 128)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
229 charset-ascii
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 4
diff changeset
230 charset-latin-iso8859-1))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
231
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
232 (defun char-bytes (char)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
233 "Return number of bytes a character in CHAR occupies in a buffer.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
234 \[emu-e19.el; MULE emulating function]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
235 1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
236
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
237 (defalias 'char-length 'char-bytes)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
238
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
239 (defun char-columns (character)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
240 "Return number of columns a CHARACTER occupies when displayed.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
241 \[emu-e19.el]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
242 1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
243
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
244 ;;; @@ for old MULE emulation
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
245 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
246
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
247 (defalias 'char-width 'char-columns)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
248
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
249 (defalias 'char-leading-char 'char-charset)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
250
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
251
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
252 ;;; @ string
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
253 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
254
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
255 (defalias 'string-columns 'length)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
256
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
257 (defun string-to-char-list (str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
258 (mapcar (function identity) str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
259 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
260
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
261 (defalias 'string-to-int-list 'string-to-char-list)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
262
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
263 (defalias 'sref 'aref)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
264
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
265 (defun truncate-string (str width &optional start-column)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
266 "Truncate STR to fit in WIDTH columns.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
267 Optional non-nil arg START-COLUMN specifies the starting column.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
268 \[emu-e19.el; MULE 2.3 emulating function]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
269 (or start-column
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
270 (setq start-column 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
271 (substring str start-column width)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
272 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
273
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
274 ;;; @@ for old MULE emulation
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
275 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
276
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
277 (defalias 'string-width 'length)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
278
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
279
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
280 ;;; @ end
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
281 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
282
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
283 (provide 'emu-e19)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
284
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
285 ;;; emu-e19.el ends here