annotate lisp/coding.el @ 366:83d76f480a59

Added tag r21-1-12 for changeset 30d2cfa1092a
author cvs
date Mon, 13 Aug 2007 11:00:13 +0200
parents 7347b34c275b
children cc15677e0335
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
1 ;;; coding.el --- Coding-system functions for XEmacs.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
2
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
4 ;; Licensed to the Free Software Foundation.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
5 ;; Copyright (C) 1995 Amdahl Corporation.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
6 ;; Copyright (C) 1995 Sun Microsystems.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
7 ;; Copyright (C) 1997 MORIOKA Tomohiko
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
8
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
9 ;; This file is part of XEmacs.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
10
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
11 ;; This file is very similar to mule-coding.el
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
12
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
13 ;; XEmacs is free software; you can redistribute it and/or modify it
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
14 ;; under the terms of the GNU General Public License as published by
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
15 ;; the Free Software Foundation; either version 2, or (at your option)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
16 ;; any later version.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
17
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
18 ;; XEmacs is distributed in the hope that it will be useful, but
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
21 ;; General Public License for more details.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
22
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
24 ;; along with XEmacs; see the file COPYING. If not, write to the
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
26 ;; Boston, MA 02111-1307, USA.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
27
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
28 ;;; Commentary:
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
29
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
30 ;;; split off of mule.el.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
31
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
32 ;;; Code:
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
33
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
34 (defalias 'check-coding-system 'get-coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
35
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
36 (defconst modeline-multibyte-status '("%C")
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
37 "Modeline control for showing multibyte extension status.")
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
38
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
39 ;; override the default value defined in loaddefs.el.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
40 (setq-default modeline-format
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
41 (cons (purecopy "")
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
42 (cons 'modeline-multibyte-status
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
43 (cdr modeline-format))))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
44
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
45 (defun modify-coding-system-alist (target-type regexp coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
46 "Modify one of look up tables for finding a coding system on I/O operation.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
47 There are three of such tables, `file-coding-system-alist',
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
48 `process-coding-system-alist', and `network-coding-system-alist'.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
49
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
50 TARGET-TYPE specifies which of them to modify.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
51 If it is `file', it affects `file-coding-system-alist' (which see).
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
52 If it is `process', it affects `process-coding-system-alist' (which see).
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
53 If it is `network', it affects `network-codign-system-alist' (which see).
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
54
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
55 REGEXP is a regular expression matching a target of I/O operation.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
56 The target is a file name if TARGET-TYPE is `file', a program name if
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
57 TARGET-TYPE is `process', or a network service name or a port number
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
58 to connect to if TARGET-TYPE is `network'.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
59
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
60 CODING-SYSTEM is a coding system to perform code conversion on the I/O
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
61 operation, or a cons cell (DECODING . ENCODING) specifying the coding systems
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
62 for decoding and encoding respectively,
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
63 or a function symbol which, when called, returns such a cons cell."
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
64 (or (memq target-type '(file process network))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
65 (error "Invalid target type: %s" target-type))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
66 (or (stringp regexp)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
67 (and (eq target-type 'network) (integerp regexp))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
68 (error "Invalid regular expression: %s" regexp))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
69 (if (symbolp coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
70 (if (not (fboundp coding-system))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
71 (progn
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
72 (check-coding-system coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
73 (setq coding-system (cons coding-system coding-system))))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
74 (check-coding-system (car coding-system))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
75 (check-coding-system (cdr coding-system)))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
76 (cond ((eq target-type 'file)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
77 (let ((slot (assoc regexp file-coding-system-alist)))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
78 (if slot
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
79 (setcdr slot coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
80 (setq file-coding-system-alist
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
81 (cons (cons regexp coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
82 file-coding-system-alist)))))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
83 ((eq target-type 'process)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
84 (let ((slot (assoc regexp process-coding-system-alist)))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
85 (if slot
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
86 (setcdr slot coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
87 (setq process-coding-system-alist
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
88 (cons (cons regexp coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
89 process-coding-system-alist)))))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
90 (t
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
91 (let ((slot (assoc regexp network-coding-system-alist)))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
92 (if slot
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
93 (setcdr slot coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
94 (setq network-coding-system-alist
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
95 (cons (cons regexp coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
96 network-coding-system-alist)))))))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
97
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
98 (defsubst keyboard-coding-system ()
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
99 "Return coding-system of what is sent from terminal keyboard."
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
100 keyboard-coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
101
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
102 (defun set-keyboard-coding-system (coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
103 "Set the coding system used for TTY keyboard input. Currently broken."
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
104 (interactive "zkeyboard-coding-system: ")
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
105 (get-coding-system coding-system) ; correctness check
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
106 (setq keyboard-coding-system coding-system)
361
7347b34c275b Import from CVS: tag r21-1-10
cvs
parents: 357
diff changeset
107 (if (eq (device-type) 'tty)
7347b34c275b Import from CVS: tag r21-1-10
cvs
parents: 357
diff changeset
108 (set-console-tty-input-coding-system
7347b34c275b Import from CVS: tag r21-1-10
cvs
parents: 357
diff changeset
109 (device-console) keyboard-coding-system))
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
110 (redraw-modeline t))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
111
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
112 (defsubst terminal-coding-system ()
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
113 "Return coding-system of your terminal."
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
114 terminal-coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
115
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
116 (defun set-terminal-coding-system (coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
117 "Set the coding system used for TTY display output. Currently broken."
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
118 (interactive "zterminal-coding-system: ")
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
119 (get-coding-system coding-system) ; correctness check
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
120 (setq terminal-coding-system coding-system)
357
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 261
diff changeset
121 ; #### should this affect all current tty consoles ?
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 261
diff changeset
122 (if (eq (device-type) 'tty)
361
7347b34c275b Import from CVS: tag r21-1-10
cvs
parents: 357
diff changeset
123 (set-console-tty-output-coding-system
7347b34c275b Import from CVS: tag r21-1-10
cvs
parents: 357
diff changeset
124 (device-console) terminal-coding-system))
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
125 (redraw-modeline t))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
126
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
127 (defun set-pathname-coding-system (coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
128 "Set the coding system used for file system path names."
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
129 (interactive "zPathname-coding-system: ")
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
130 (get-coding-system coding-system) ; correctness check
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
131 (setq file-name-coding-system coding-system))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
132
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
133 (defun what-coding-system (start end &optional arg)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
134 "Show the encoding of text in the region.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
135 This function is meant to be called interactively;
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
136 from a Lisp program, use `detect-coding-region' instead."
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
137 (interactive "r\nP")
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
138 (princ (detect-coding-region start end)))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
139
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
140 (defun decode-coding-string (str coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
141 "Decode the string STR which is encoded in CODING-SYSTEM.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
142 Does not modify STR. Returns the decoded string on successful conversion."
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
143 (with-string-as-buffer-contents
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
144 str (decode-coding-region (point-min) (point-max) coding-system)))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
145
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
146 (defun encode-coding-string (str coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
147 "Encode the string STR using CODING-SYSTEM.
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
148 Does not modify STR. Returns the encoded string on successful conversion."
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
149 (with-string-as-buffer-contents
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
150 str (encode-coding-region (point-min) (point-max) coding-system)))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
151
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
152
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
153 ;;;; Coding system accessors
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
154
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
155 (defun coding-system-mnemonic (coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
156 "Return the 'mnemonic property of CODING-SYSTEM."
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
157 (coding-system-property coding-system 'mnemonic))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
158
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
159 (defalias 'coding-system-docstring 'coding-system-doc-string)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
160
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
161 (defun coding-system-eol-type (coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
162 "Return the 'eol-type property of CODING-SYSTEM."
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
163 (coding-system-property coding-system 'eol-type))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
164
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
165 (defun coding-system-eol-lf (coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
166 "Return the 'eol-lf property of CODING-SYSTEM."
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
167 (coding-system-property coding-system 'eol-lf))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
168
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
169 (defun coding-system-eol-crlf (coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
170 "Return the 'eol-crlf property of CODING-SYSTEM."
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
171 (coding-system-property coding-system 'eol-crlf))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
172
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
173 (defun coding-system-eol-cr (coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
174 "Return the 'eol-cr property of CODING-SYSTEM."
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
175 (coding-system-property coding-system 'eol-cr))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
176
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
177 (defun coding-system-post-read-conversion (coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
178 "Return the 'post-read-conversion property of CODING-SYSTEM."
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
179 (coding-system-property coding-system 'post-read-conversion))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
180
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
181 (defun coding-system-pre-write-conversion (coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
182 "Return the 'pre-write-conversion property of CODING-SYSTEM."
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
183 (coding-system-property coding-system 'pre-write-conversion))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
184
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
185 (defun coding-system-base (coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
186 "Return the base coding system of CODING-SYSTEM."
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
187 (if (not (coding-system-eol-type coding-system))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
188 coding-system
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
189 (find-coding-system
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
190 (intern
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
191 (substring
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
192 (symbol-name (coding-system-name coding-system))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
193 0
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
194 (string-match "-unix$\\|-dos$\\|-mac$"
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
195 (symbol-name (coding-system-name coding-system))))))))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
196
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
197 ;;;; Definitions of predefined coding systems
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
198
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
199 (make-coding-system
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
200 'undecided 'undecided
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
201 "Automatic conversion."
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
202 '(mnemonic "Auto"))
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
203
261
405dd6d1825b Import from CVS: tag r20-5b29
cvs
parents: 259
diff changeset
204 ;; these are so that gnus and friends work when not mule
405dd6d1825b Import from CVS: tag r20-5b29
cvs
parents: 259
diff changeset
205 (or (featurep 'mule)
405dd6d1825b Import from CVS: tag r20-5b29
cvs
parents: 259
diff changeset
206 (progn
405dd6d1825b Import from CVS: tag r20-5b29
cvs
parents: 259
diff changeset
207 (copy-coding-system 'undecided 'iso-8859-1)
405dd6d1825b Import from CVS: tag r20-5b29
cvs
parents: 259
diff changeset
208 (copy-coding-system 'undecided 'iso-8859-2)))
405dd6d1825b Import from CVS: tag r20-5b29
cvs
parents: 259
diff changeset
209
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
210 ;; compatibility for old XEmacsen (don't use it)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
211 (copy-coding-system 'undecided 'automatic-conversion)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
212
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
213 (copy-coding-system 'no-conversion 'raw-text)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
214
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
215 (make-compatible-variable 'enable-multibyte-characters "Unimplemented")
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
216
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
217 (define-obsolete-variable-alias
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
218 'pathname-coding-system 'file-name-coding-system)
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
219
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents:
diff changeset
220 ;;; mule-coding.el ends here