Mercurial > hg > xemacs-beta
annotate lisp/code-init.el @ 5819:ba0ff364bd94
Repair invalid GNU-style key-bindings.
author | Stephen J. Turnbull <stephen@xemacs.org> |
---|---|
date | Sat, 18 Oct 2014 23:21:30 +0900 |
parents | 308d34e9f07d |
children | c608d4b0b75e |
rev | line source |
---|---|
771 | 1 ;;; code-init.el --- Handle coding system default values |
2 | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
3 ;; Copyright (C) 2001, 2002, 2003, 2010 Ben Wing. |
771 | 4 |
5 ;; This file is part of XEmacs. | |
6 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4989
diff
changeset
|
7 ;; XEmacs is free software: you can redistribute it and/or modify it |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4989
diff
changeset
|
8 ;; under the terms of the GNU General Public License as published by the |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4989
diff
changeset
|
9 ;; Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4989
diff
changeset
|
10 ;; option) any later version. |
771 | 11 |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4989
diff
changeset
|
12 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4989
diff
changeset
|
13 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4989
diff
changeset
|
14 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4989
diff
changeset
|
15 ;; for more details. |
771 | 16 |
17 ;; You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4989
diff
changeset
|
18 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>. |
771 | 19 |
20 ;;; Commentary: | |
21 | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
22 ;; Author: Ben wing, 2001? |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
23 |
771 | 24 ;; Placed in a separate file so it can be loaded after the various |
25 ;; coding systems have been created, because we'll be using them at | |
26 ;; load time. | |
27 | |
2297 | 28 ;; #### Issues (this discussion probably belongs elsewhere) |
29 ;; 1. "Big" characters are unrepresentable. Should give error, warning, | |
30 ;; not just substitute "~". | |
31 ;; 2. 21.4 compatibility? | |
32 ;; 3. make-char: non-mule barfs on non-iso8859-1. | |
33 | |
771 | 34 ;;; Code: |
35 | |
36 (defcustom eol-detection-enabled-p (or (featurep 'mule) | |
37 (memq system-type '(windows-nt | |
38 cygwin32)) | |
39 (featurep 'unix-default-eol-detection)) | |
40 "True if XEmacs automatically detects the EOL type when reading files. | |
41 Normally, this is always the case on Windows or when international (Mule) | |
42 support is compiled into this XEmacs. Otherwise, it is currently off by | |
43 default, but this may change. Don't set this; nothing will happen. Instead, | |
44 use the Options menu or `set-eol-detection'." | |
45 :group 'encoding | |
46 :type 'boolean | |
47 ;; upon initialization, we don't want the whole business of | |
48 ;; set-eol-detection to be called. We will init everything appropriately | |
49 ;; later in the same file, when reset-language-environment is called. | |
50 :initialize #'(lambda (var val) | |
1698 | 51 (setq eol-detection-enabled-p (eval val))) |
771 | 52 :set #'(lambda (var val) |
53 (set-eol-detection val) | |
54 (setq eol-detection-enabled-p val))) | |
55 | |
56 (defun set-eol-detection (flag) | |
57 "Enable (if FLAG is non-nil) or disable automatic EOL detection of files. | |
58 EOL detection is enabled by default on Windows or when international (Mule) | |
59 support is compiled into this XEmacs. Otherwise, it is currently off by | |
60 default, but this may change. NOTE: You *REALLY* should not turn off EOL | |
61 detection on Windows! Your files will have lots of annoying ^M's in them | |
62 if you do this." | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
63 (dolist (x '(bfcs-for-read |
771 | 64 keyboard |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
65 process-read |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
66 no-conv-cs)) |
771 | 67 (set-coding-system-variable |
68 x (coding-system-change-eol-conversion (get-coding-system-variable x) | |
2508 | 69 (if flag nil 'lf))))) |
771 | 70 |
71 (defun coding-system-current-system-configuration () | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
72 "Function to decide which default coding system configuration applies." |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
73 (cond ((featurep 'cygwin-use-utf-8) 'cygwin-utf-8) |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
74 ((memq system-type '(windows-nt cygwin32)) |
771 | 75 (if (featurep 'mule) 'windows-mule 'windows-no-mule)) |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
76 ((featurep 'mule) 'mule) |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
77 (eol-detection-enabled-p 'no-mule-eol-detection) |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
78 (t 'no-mule-no-eol-detection))) |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
79 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
80 (defvar coding-system-default-configuration-table (make-hash-table)) |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
81 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
82 (defun define-coding-system-default-configuration (name doc props) |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
83 (puthash name (nconc `(doc ,doc) props) |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
84 coding-system-default-configuration-table)) |
771 | 85 |
1318 | 86 ;; NOTE NOTE NOTE: These values may get overridden when the language |
87 ;; environment is initialized (set-language-environment-coding-systems). | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
88 (define-coding-system-default-configuration |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
89 'no-mule-no-eol-detection |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
90 "No Mule support, EOL detection not enabled." |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
91 '(bfcs-for-read binary |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
92 default-bfcs binary |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
93 process-read binary |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
94 process-write binary |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
95 keyboard binary |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
96 native binary |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
97 no-conv-cs binary |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
98 terminal binary)) |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
99 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
100 (define-coding-system-default-configuration |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
101 'no-mule-eol-detection |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
102 "No Mule support, EOL detection enabled." |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
103 '(bfcs-for-read raw-text |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
104 default-bfcs binary |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
105 process-read raw-text |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
106 process-write binary |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
107 keyboard raw-text |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
108 native binary |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
109 no-conv-cs raw-text |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
110 terminal binary)) |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
111 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
112 (define-coding-system-default-configuration |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
113 'mule |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
114 "Mule support enabled." |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
115 '(bfcs-for-read undecided |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
116 default-bfcs iso-2022-8 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
117 process-read undecided |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
118 process-write binary |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
119 keyboard undecided-unix |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
120 native binary |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
121 no-conv-cs raw-text |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
122 terminal binary)) |
771 | 123 |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
124 (define-coding-system-default-configuration |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
125 'windows-no-mule |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
126 "Microsoft Windows, no Mule support." |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
127 '(bfcs-for-read raw-text |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
128 default-bfcs raw-text-dos |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
129 process-read raw-text |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
130 process-write raw-text |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
131 keyboard raw-text |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
132 native raw-text-dos |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
133 no-conv-cs raw-text |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
134 terminal binary)) |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
135 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
136 (define-coding-system-default-configuration |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
137 'windows-mule |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
138 "Microsoft Windows, Mule support enabled." |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
139 '(bfcs-for-read undecided |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
140 default-bfcs mswindows-multibyte-dos |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
141 process-read undecided |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
142 process-write mswindows-multibyte-system-default |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
143 keyboard undecided-unix |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
144 native mswindows-multibyte-system-default-dos |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
145 no-conv-cs mswindows-multibyte |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
146 terminal mswindows-multibyte-unix)) |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
147 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
148 (define-coding-system-default-configuration |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
149 'cygwin-utf-8 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
150 "Mule support enabled." |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
151 '(bfcs-for-read undecided |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
152 default-bfcs utf-8 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
153 process-read utf-8 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
154 process-write utf-8 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
155 keyboard utf-8 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
156 native utf-8 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
157 no-conv-cs utf-8 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
158 terminal utf-8)) |
771 | 159 |
160 (defvar coding-system-default-variable-list | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
161 '(bfcs-for-read |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
162 default-bfcs |
771 | 163 native |
164 keyboard | |
165 terminal | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
166 process-read |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
167 process-write |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
168 no-conv-cs)) |
771 | 169 |
170 (defun get-coding-system-variable (var) | |
171 "Return the value of a basic coding system variable. | |
172 This is intended as a uniform interface onto the coding system settings that | |
173 control how encoding detection and conversion works. See | |
174 `coding-system-variable-default-value' for a list of the possible values of | |
175 VAR." | |
176 (case var | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
177 (bfcs-for-read buffer-file-coding-system-for-read) |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
178 (default-bfcs |
771 | 179 (default-value 'buffer-file-coding-system)) |
180 (native (coding-system-aliasee 'native)) | |
181 (keyboard (coding-system-aliasee 'keyboard)) | |
182 (terminal (coding-system-aliasee 'terminal)) | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
183 (process-read (car default-process-coding-system)) |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
184 (process-write (cdr default-process-coding-system)) |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
185 (no-conv-cs |
2508 | 186 (coding-category-system 'no-conversion)) |
771 | 187 (t (error 'invalid-constant "Invalid coding system variable" var)))) |
188 | |
189 (defun set-coding-system-variable (var value) | |
190 "Set a basic coding system variable to VALUE. | |
191 This is intended as a uniform interface onto the coding system settings that | |
192 control how encoding detection and conversion works. See | |
193 `coding-system-variable-default-value' for a list of the possible values of | |
194 VAR." | |
195 (case var | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
196 (bfcs-for-read |
771 | 197 (set-buffer-file-coding-system-for-read value)) |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
198 (default-bfcs |
771 | 199 (set-default-buffer-file-coding-system value)) |
200 (native (define-coding-system-alias 'native value)) | |
201 (keyboard (set-keyboard-coding-system value)) | |
202 (terminal (set-terminal-coding-system value)) | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
203 (process-read |
771 | 204 (setq default-process-coding-system |
205 (cons value (cdr default-process-coding-system)))) | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
206 (process-write |
771 | 207 (setq default-process-coding-system |
208 (cons (car default-process-coding-system) value))) | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
209 (no-conv-cs |
2508 | 210 (set-coding-category-system 'no-conversion value)) |
771 | 211 (t (error 'invalid-constant "Invalid coding system variable" var)))) |
212 | |
213 (defun coding-system-variable-default-value (var &optional config) | |
214 "Return the appropriate default value for a coding system variable. | |
215 | |
216 VAR specifies the variable, and CONFIG the configuration, defaulting | |
217 to the current system configuration (as returned by | |
218 `coding-system-current-system-configuration'). | |
219 | |
220 The table of default values looks like this: (see below for abbreviations) | |
221 | |
222 | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
223 NoMule NoMuleEOL Mule MSW MSWMule CygUTF |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
224 ------------------------------------------------------------------------------ |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
225 bfcs-for-read binary raw-text undecided raw-text undecided undecided |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
226 default-bfcs binary binary iso-2022-8 raw-text-dos MSW-MB-dos utf-8 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
227 native binary binary binary raw-text-dos MSW-MB-SD-dos utf-8 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
228 keyboard binary raw-text undecided- raw-text undecided- utf-8 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
229 unix unix |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
230 terminal binary binary binary binary MSW-MB-unix utf-8 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
231 process-read binary raw-text undecided raw-text undecided utf-8 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
232 process-write binary binary binary raw-text MSW-MB-SD utf-8 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
233 no-conv-cs binary raw-text raw-text raw-text MSW-MB utf-8 |
771 | 234 |
235 | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
236 VAR can be one of: |
771 | 237 |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
238 `bfcs-for-read' |
771 | 239 |
240 Lisp variable of the same name; the default coding system used when | |
241 reading in a file, in the absence of more specific settings. (See | |
242 `insert-file-contents' for a description of exactly how a file's | |
243 coding system is determined when it's read in.) | |
244 | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
245 `default-bfcs' |
771 | 246 |
247 Default value of `buffer-file-coding-system', the buffer-local | |
248 variable specifying a file's coding system to be used when it is | |
249 written out. Set using `set-default-buffer-file-coding-system' (or | |
250 the primitive `setq-default'). When a file is read in, | |
251 `buffer-file-coding-system' for that file is set from the coding | |
252 system used to read the file in; the default value applies to newly | |
253 created files. | |
254 | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
255 `native' |
771 | 256 |
257 The coding system named `native'. Changed using | |
258 `define-coding-system-alias'. Used internally when passing | |
1318 | 259 text to or from system API's, unless the particular |
771 | 260 API specifies another coding system. |
261 | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
262 `keyboard' |
771 | 263 |
264 #### fill in | |
265 | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
266 `terminal' |
771 | 267 |
268 #### fill in | |
269 | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
270 `process-read' |
771 | 271 |
272 #### fill in | |
273 | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
274 `process-write' |
771 | 275 |
276 #### fill in | |
277 | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
278 `no-conv-cs' |
771 | 279 |
280 Coding system used when category `no-conversion' is detected. | |
281 | |
282 | |
283 CONFIG is one of: (abbreviations in parens) | |
284 | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
285 `no-mule-no-eol-detection' (NoMule) |
771 | 286 |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
287 Non-Windows, no Mule support, no automatic EOL detection. (Controlled by |
771 | 288 `eol-detection-enabled-p', which is set by the command-line flag |
289 -enable-eol-detection or the configure flag --with-default-eol-detection.) | |
290 | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
291 `unix-no-mule-eol-detection' (NoMuleEOL) |
771 | 292 |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
293 Non-Windows, no Mule support, automatic EOL detection. |
771 | 294 |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
295 `unix-mule' (Mule) |
771 | 296 |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
297 Non-Windows, Mule support. |
771 | 298 |
299 `windows-no-mule' (MSW) | |
300 | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
301 MS Windows or old Cygwin, no Mule support. |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
302 |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
303 `windows-mule' (MSWMule) |
771 | 304 |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
305 MS Windows or old Cygwin, Mule support. |
771 | 306 |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
307 `cygwin-utf-8' (CygUTF) |
771 | 308 |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
309 Cygwin 1.7 or later, which uses UTF-8 consistently. |
771 | 310 |
311 The following coding system abbreviations are also used in the table: | |
312 | |
313 MSW-MB = mswindows-multibyte | |
314 MSW-MB = mswindows-multibyte-system-default | |
315 " | |
316 (setq config (or config (coding-system-current-system-configuration))) | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
317 (or (memq var coding-system-default-variable-list) |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
318 (error 'invalid-constant "Invalid coding system variable" var)) |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
319 (let ((props (gethash config coding-system-default-configuration-table))) |
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
320 (or props (error 'invalid-constant "Invalid coding system configuration" |
771 | 321 config)) |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
322 (getf props var))) |
771 | 323 |
324 (defun reset-coding-system-defaults (&optional config) | |
325 "Reset all basic coding system variables are set to their default values. | |
326 See `coding-system-variable-default-value'." | |
327 (setq config (or config (coding-system-current-system-configuration))) | |
328 (mapcar #'(lambda (var) | |
329 (set-coding-system-variable | |
330 var (coding-system-variable-default-value var config))) | |
331 coding-system-default-variable-list)) | |
332 | |
333 (defun reset-coding-categories-to-default () | |
334 "Reset all coding categories (used for automatic detection) to their defaults. | |
335 | |
336 The order of priorities of coding categories and the coding system | |
337 bound to each category are as follows: | |
338 | |
339 coding category coding system | |
340 -------------------------------------------------- | |
341 utf-16-little-endian-bom utf-16-little-endian | |
342 utf-16-bom utf-16-bom | |
985 | 343 utf-8-bom utf-8-bom |
771 | 344 iso-7 iso-2022-7bit |
345 no-conversion raw-text | |
346 utf-8 utf-8 | |
347 iso-8-1 iso-8859-1 | |
348 iso-8-2 ctext (iso-8859-1 alias) | |
349 iso-8-designate ctext (iso-8859-1 alias) | |
350 iso-lock-shift iso-2022-lock | |
351 shift-jis shift-jis | |
352 big5 big5 | |
353 utf-16-little-endian utf-16-little-endian | |
354 utf-16 utf-16 | |
355 ucs-4 ucs-4 | |
356 " | |
357 ;; #### What a mess! This needs to be overhauled. | |
358 | |
359 ;; The old table (from FSF synch?) was not what we use (cf mule-coding.el), | |
360 ;; and as documented iso-8-designate is inconsistent with iso-2022-8bit-ss2. | |
361 ;; The order of priorities of coding categories and the coding system | |
362 ;; bound to each category are as follows: | |
363 ;; | |
364 ;; coding category coding system | |
365 ;; -------------------------------------------------- | |
366 ;; iso-8-2 iso-8859-1 | |
367 ;; iso-8-1 iso-8859-1 | |
368 ;; iso-7 iso-2022-7bit | |
369 ;; iso-lock-shift iso-2022-lock | |
370 ;; iso-8-designate iso-2022-8bit-ss2 | |
371 ;; no-conversion raw-text | |
372 ;; shift-jis shift_jis | |
373 ;; big5 big5 | |
374 ;; ucs-4 ---- | |
375 ;; utf-8 ---- | |
376 (when (featurep 'mule) | |
377 (set-coding-category-system 'iso-7 'iso-2022-7) | |
378 (set-coding-category-system 'iso-8-1 'iso-8859-1) | |
379 (set-coding-category-system 'iso-8-2 'ctext) | |
380 (set-coding-category-system 'iso-lock-shift 'iso-2022-lock) | |
381 (set-coding-category-system 'iso-8-designate 'ctext) | |
382 (if (find-coding-system 'shift-jis) | |
383 (set-coding-category-system 'shift-jis 'shift-jis)) | |
384 (if (find-coding-system 'big5) | |
385 (set-coding-category-system 'big5 'big5)) | |
386 ) | |
387 (set-coding-category-system | |
388 'no-conversion | |
4989
d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
Ben Wing <ben@xemacs.org>
parents:
4568
diff
changeset
|
389 (coding-system-variable-default-value 'no-conv-cs)) |
771 | 390 (set-coding-category-system 'ucs-4 'ucs-4) |
391 (set-coding-category-system 'utf-8 'utf-8) | |
985 | 392 (set-coding-category-system 'utf-8-bom 'utf-8-bom) |
771 | 393 (set-coding-category-system 'utf-16-little-endian 'utf-16-little-endian) |
394 (set-coding-category-system 'utf-16 'utf-16) | |
395 (set-coding-category-system 'utf-16-little-endian-bom | |
396 'utf-16-little-endian-bom) | |
397 (set-coding-category-system 'utf-16-bom 'utf-16-bom) | |
398 (set-coding-priority-list | |
399 (if (featurep 'mule) | |
400 '(utf-16-little-endian-bom | |
401 utf-16-bom | |
985 | 402 utf-8-bom |
771 | 403 iso-7 |
404 no-conversion | |
405 utf-8 | |
406 iso-8-1 | |
407 iso-8-2 | |
408 iso-8-designate | |
409 iso-lock-shift | |
410 shift-jis | |
411 big5 | |
412 utf-16-little-endian | |
413 utf-16 | |
414 ucs-4) | |
415 '(utf-16-little-endian-bom | |
416 utf-16-bom | |
985 | 417 utf-8-bom |
771 | 418 no-conversion |
419 utf-8 | |
420 utf-16-little-endian | |
421 utf-16 | |
422 ucs-4)))) | |
423 | |
424 (defun reset-language-environment () | |
425 "Reset coding system environment of XEmacs to the default status. | |
426 All basic coding system variables are set to their default values, as | |
427 are the coding categories used for automatic detection and their | |
428 priority. | |
429 | |
430 BE VERY CERTAIN YOU WANT TO DO THIS BEFORE DOING IT! | |
431 | |
432 For more information, see `reset-coding-system-defaults' and | |
433 `reset-coding-categories-to-default'." | |
434 (reset-coding-system-defaults) | |
435 (reset-coding-categories-to-default)) | |
436 | |
437 ;; Initialize everything so that the remaining Lisp files can contain | |
438 ;; extended characters. (They will be in ISO-7 format) | |
439 | |
440 ;; !!####!! The Lisp files should all be in UTF-8!!! That way, all | |
441 ;; special characters appear as high bits and there's no problem with | |
442 ;; the Lisp parser trying to read a Mule file and getting all screwed | |
443 ;; up. The only other thing then would be characters; we just need to | |
444 ;; modify the Lisp parser to read the stuff directly after a ? as | |
445 ;; UTF-8 and return a 30-bit value directly, and modify the character | |
446 ;; routines a bit to allow such a beast to exist. MAKE IT A POINT TO | |
447 ;; IMPLEMENT THIS AS ONE OF MY FUTURE PROJECTS. --ben | |
448 | |
449 (reset-language-environment) | |
450 | |
4568
1d74a1d115ee
Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2508
diff
changeset
|
451 (coding-system-put 'raw-text 'safe-charsets '(ascii control-1 latin-iso8859-1)) |
1d74a1d115ee
Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2508
diff
changeset
|
452 |
771 | 453 ;;; code-init.el ends here |