Mercurial > hg > xemacs-beta
comparison lisp/tl/emu-x20.el @ 120:cca96a509cfe r20-1b12
Import from CVS: tag r20-1b12
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:25:29 +0200 |
parents | 8619ce7e4c50 |
children | 1370575f1259 |
comparison
equal
deleted
inserted
replaced
119:d101af7320b8 | 120:cca96a509cfe |
---|---|
1 ;;; emu-x20.el --- emu API implementation for XEmacs 20 with mule | 1 ;;; emu-x20.el --- emu API implementation for XEmacs 20 with mule |
2 | 2 |
3 ;; Copyright (C) 1994,1995,1996,1997 MORIOKA Tomohiko | 3 ;; Copyright (C) 1994,1995,1996,1997 MORIOKA Tomohiko |
4 | 4 |
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp> | 5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp> |
6 ;; Version: $Id: emu-x20.el,v 1.6 1997/03/22 06:02:43 steve Exp $ | 6 ;; Version: $Id: emu-x20.el,v 1.7 1997/04/10 05:55:51 steve Exp $ |
7 ;; Keywords: emulation, compatibility, Mule, XEmacs | 7 ;; Keywords: emulation, compatibility, Mule, XEmacs |
8 | 8 |
9 ;; This file is part of XEmacs. | 9 ;; This file is part of XEmacs. |
10 | 10 |
11 ;; This program is free software; you can redistribute it and/or | 11 ;; This program is free software; you can redistribute it and/or |
38 | 38 |
39 (defconst *noconv* 'no-conversion) | 39 (defconst *noconv* 'no-conversion) |
40 | 40 |
41 (defmacro as-binary-process (&rest body) | 41 (defmacro as-binary-process (&rest body) |
42 `(let (selective-display ; Disable ^M to nl translation. | 42 `(let (selective-display ; Disable ^M to nl translation. |
43 (coding-system-for-write 'no-conversion) | 43 (coding-system-for-read 'no-conversion) |
44 process-input-coding-system | 44 (coding-system-for-write 'no-conversion)) |
45 process-output-coding-system) | |
46 ,@body)) | 45 ,@body)) |
47 | 46 |
48 (defmacro as-binary-input-file (&rest body) | 47 (defmacro as-binary-input-file (&rest body) |
49 `(let ((coding-system-for-read 'no-conversion)) | 48 `(let ((coding-system-for-read 'no-conversion)) |
50 ,@body)) | 49 ,@body)) |
121 (koi8-r . koi8) | 120 (koi8-r . koi8) |
122 (iso-2022-jp-2 . iso-2022-ss2-7) | 121 (iso-2022-jp-2 . iso-2022-ss2-7) |
123 )) | 122 )) |
124 | 123 |
125 (defun mime-charset-to-coding-system (charset) | 124 (defun mime-charset-to-coding-system (charset) |
126 "Return coding-system by MIME charset. [emu-x20.el]" | 125 "Return coding-system by MIME charset." |
127 (if (stringp charset) | 126 (if (stringp charset) |
128 (setq charset (intern (downcase charset))) | 127 (setq charset (intern (downcase charset))) |
129 ) | 128 ) |
130 (or (cdr (assq charset mime-charset-coding-system-alist)) | 129 (or (cdr (assq charset mime-charset-coding-system-alist)) |
131 (and (memq charset (coding-system-list)) charset) | 130 (and (memq charset (coding-system-list)) charset) |
132 )) | 131 )) |
133 | 132 |
134 (defun detect-mime-charset-region (start end) | 133 (defun detect-mime-charset-region (start end) |
135 "Return MIME charset for region between START and END. | 134 "Return MIME charset for region between START and END." |
136 \[emu-x20.el]" | |
137 (charsets-to-mime-charset (charsets-in-region start end))) | 135 (charsets-to-mime-charset (charsets-in-region start end))) |
138 | 136 |
139 (defun encode-mime-charset-region (start end charset) | 137 (defun encode-mime-charset-region (start end charset) |
140 "Encode the text between START and END as MIME CHARSET. | 138 "Encode the text between START and END as MIME CHARSET." |
141 \[emu-x20.el]" | |
142 (let ((cs (mime-charset-to-coding-system charset))) | 139 (let ((cs (mime-charset-to-coding-system charset))) |
143 (if cs | 140 (if cs |
144 (encode-coding-region start end cs) | 141 (encode-coding-region start end cs) |
145 ))) | 142 ))) |
146 | 143 |
147 (defun decode-mime-charset-region (start end charset) | 144 (defun decode-mime-charset-region (start end charset) |
148 "Decode the text between START and END as MIME CHARSET. | 145 "Decode the text between START and END as MIME CHARSET." |
149 \[emu-x20.el]" | |
150 (let ((cs (mime-charset-to-coding-system charset))) | 146 (let ((cs (mime-charset-to-coding-system charset))) |
151 (if cs | 147 (if cs |
152 (decode-coding-region start end cs) | 148 (decode-coding-region start end cs) |
153 ))) | 149 ))) |
154 | 150 |
155 (defun encode-mime-charset-string (string charset) | 151 (defun encode-mime-charset-string (string charset) |
156 "Encode the STRING as MIME CHARSET. [emu-x20.el]" | 152 "Encode the STRING as MIME CHARSET." |
157 (let ((cs (mime-charset-to-coding-system charset))) | 153 (let ((cs (mime-charset-to-coding-system charset))) |
158 (if cs | 154 (if cs |
159 (encode-coding-string string cs) | 155 (encode-coding-string string cs) |
160 string))) | 156 string))) |
161 | 157 |
162 (defun decode-mime-charset-string (string charset) | 158 (defun decode-mime-charset-string (string charset) |
163 "Decode the STRING as MIME CHARSET. [emu-x20.el]" | 159 "Decode the STRING as MIME CHARSET." |
164 (let ((cs (mime-charset-to-coding-system charset))) | 160 (let ((cs (mime-charset-to-coding-system charset))) |
165 (if cs | 161 (if cs |
166 (decode-coding-string string cs) | 162 (decode-coding-string string cs) |
167 string))) | 163 string))) |
168 | 164 |
177 (defalias 'char-leading-char 'char-charset) | 173 (defalias 'char-leading-char 'char-charset) |
178 | 174 |
179 (defun char-category (character) | 175 (defun char-category (character) |
180 "Return string of category mnemonics for CHAR in TABLE. | 176 "Return string of category mnemonics for CHAR in TABLE. |
181 CHAR can be any multilingual character | 177 CHAR can be any multilingual character |
182 TABLE defaults to the current buffer's category table. | 178 TABLE defaults to the current buffer's category table." |
183 \[emu-x20.el; Mule emulating function]" | |
184 (mapconcat (lambda (chr) | 179 (mapconcat (lambda (chr) |
185 (char-to-string (int-char chr)) | 180 (char-to-string (int-char chr)) |
186 ) | 181 ) |
187 (char-category-list character) | 182 (char-category-list character) |
188 "")) | 183 "")) |