annotate lisp/apel/emu-e19.el @ 185:3d6bfa290dbd r20-3b19

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