Mercurial > hg > xemacs-beta
comparison lisp/tl/emu-x20.el @ 4:b82b59fe008d r19-15b3
Import from CVS: tag r19-15b3
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:46:56 +0200 |
parents | |
children | 4b173ad71786 |
comparison
equal
deleted
inserted
replaced
3:30df88044ec6 | 4:b82b59fe008d |
---|---|
1 ;;; | |
2 ;;; emu-x20.el --- Mule 2 emulation module for XEmacs 20 with Mule | |
3 ;;; | |
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc. | |
5 ;;; Copyright (C) 1994 .. 1996 MORIOKA Tomohiko | |
6 ;;; | |
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp> | |
8 ;;; Version: | |
9 ;;; $Id: emu-x20.el,v 1.1.1.1 1996/12/18 03:55:31 steve Exp $ | |
10 ;;; Keywords: emulation, compatibility, Mule, XEmacs | |
11 ;;; | |
12 ;;; This file is part of tl (Tiny Library). | |
13 ;;; | |
14 ;;; This program is free software; you can redistribute it and/or | |
15 ;;; modify it under the terms of the GNU General Public License as | |
16 ;;; published by the Free Software Foundation; either version 2, or | |
17 ;;; (at your option) any later version. | |
18 ;;; | |
19 ;;; This program is distributed in the hope that it will be useful, | |
20 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
22 ;;; General Public License for more details. | |
23 ;;; | |
24 ;;; You should have received a copy of the GNU General Public License | |
25 ;;; along with This program. If not, write to the Free Software | |
26 ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
27 ;;; | |
28 ;;; Code: | |
29 | |
30 (defvar xemacs-beta-version | |
31 (if (string-match "(beta\\([0-9]+\\))" emacs-version) | |
32 (string-to-number | |
33 (substring emacs-version (match-beginning 1)(match-end 1)) | |
34 ))) | |
35 | |
36 | |
37 ;;; @ character set | |
38 ;;; | |
39 | |
40 (defalias 'char-leading-char 'char-charset) | |
41 | |
42 (defun find-charset-string (string) | |
43 "Return a list of charsets in the STRING except ascii. | |
44 \[emu-x20.el; Mule emulating function]" | |
45 (delq 'ascii (charsets-in-string string)) | |
46 ) | |
47 | |
48 (defun find-charset-region (start end) | |
49 "Return a list of charsets except ascii | |
50 in the region between START and END. | |
51 \[emu-x20.el; Mule emulating function]" | |
52 (delq 'ascii (charsets-in-region start end)) | |
53 ) | |
54 | |
55 (defconst lc-ascii 'ascii) | |
56 (defconst lc-ltn1 'latin-1) | |
57 (defconst lc-ltn2 'latin-2) | |
58 (defconst lc-ltn3 'latin-3) | |
59 (defconst lc-ltn4 'latin-4) | |
60 (defconst lc-crl 'cyrillic) | |
61 (defconst lc-arb 'arabic) | |
62 (defconst lc-grk 'greek) | |
63 (defconst lc-hbw 'hebrew) | |
64 (defconst lc-ltn5 'latin-5) | |
65 (defconst lc-jp 'japanese) | |
66 (defconst lc-jp2 'japanese-2) | |
67 (defconst lc-kr 'korean) | |
68 (defconst lc-big5-1 'chinese-big5-1) | |
69 (defconst lc-big5-2 'chinese-big5-2) | |
70 (defconst lc-cn 'chinese-gb) | |
71 (defconst lc-cns1 'chinese-cns-1) | |
72 (defconst lc-cns2 'chinese-cns-2) | |
73 (defconst lc-cns3 'chinese-cns-3) | |
74 (defconst lc-cns4 'chinese-cns-4) | |
75 (defconst lc-cns5 'chinese-cns-5) | |
76 (defconst lc-cns6 'chinese-cns-6) | |
77 (defconst lc-cns7 'chinese-cns-7) | |
78 | |
79 | |
80 ;;; @ coding-system | |
81 ;;; | |
82 | |
83 (defconst *noconv* 'noconv) | |
84 (defconst *ctext* 'ctext) | |
85 (defconst *hz* 'hz) | |
86 (defconst *big5* 'big5) | |
87 (defconst *euc-kr* 'euc-kr) | |
88 (defconst *koi8* nil) | |
89 | |
90 (defvar code-converter-is-broken | |
91 (and xemacs-beta-version (<= xemacs-beta-version 18))) | |
92 | |
93 (if code-converter-is-broken | |
94 (progn | |
95 ;;; | |
96 (defun decode-coding-region (start end coding-system &optional buffer) | |
97 "Decode the text between START and END which is encoded in CODING-SYSTEM. | |
98 \[emu-x20.el; XEmacs 20 emulating function]" | |
99 (save-excursion | |
100 (if buffer | |
101 (set-buffer buffer) | |
102 ) | |
103 (save-restriction | |
104 (narrow-to-region start end) | |
105 (let ((process-output-coding-system 'noconv) | |
106 (process-input-coding-system coding-system)) | |
107 (call-process-region start end "cat" t t nil) | |
108 )))) | |
109 | |
110 (defun encode-coding-region (start end coding-system &optional buffer) | |
111 "Encode the text between START and END which is encoded in CODING-SYSTEM. | |
112 \[emu-x20.el; XEmacs 20 emulating function]" | |
113 (save-excursion | |
114 (if buffer | |
115 (set-buffer buffer) | |
116 ) | |
117 (save-restriction | |
118 (narrow-to-region start end) | |
119 (let ((process-output-coding-system coding-system) | |
120 (process-input-coding-system 'noconv)) | |
121 (call-process-region start end "cat" t t nil) | |
122 )))) | |
123 ;;; | |
124 )) | |
125 | |
126 | |
127 ;;; @ character and string | |
128 ;;; | |
129 | |
130 (defun char-bytes (chr) 1) | |
131 (defun char-width (chr) 1) | |
132 | |
133 (defalias 'string-width 'length) | |
134 | |
135 (defalias 'sref 'aref) | |
136 | |
137 (defun truncate-string (str width &optional start-column) | |
138 "Truncate STR to fit in WIDTH columns. | |
139 Optional non-nil arg START-COLUMN specifies the starting column. | |
140 \[emu-x20.el; Mule 2.3 emulating function]" | |
141 (or start-column | |
142 (setq start-column 0)) | |
143 (substring str start-column width) | |
144 ) | |
145 | |
146 | |
147 ;;; @ etc | |
148 ;;; | |
149 | |
150 (require 'emu-xemacs) | |
151 | |
152 | |
153 ;;; @ end | |
154 ;;; | |
155 | |
156 (provide 'emu-x20) | |
157 | |
158 ;;; emu-x20.el ends here |