Mercurial > emacs
comparison lisp/international/mule-cmds.el @ 23916:ccc00be328a1
(set-language-environment): On MS-DOS
terminals, install DOS-specific nonascii-translation-table if the
language info doesn't specify one. Pass the default eol-type to
set-language-environment-coding-systems.
(set-default-coding-systems): Copy the eol-type property for the
new default values of {buffer-file,process}-coding-system from the
old defaults.
(set-language-environment-coding-systems): Accept an optional
argument EOL-TYPE, and set the eol-type property of the default
coding systems accordingly.
(set-terminal-coding-system): Enable menu item on MS-DOS terminals.
(set-keyboard-coding-system): Likewise.
(set-default-coding-systems): Don't set
default-terminal-coding-system on MS-DOS to anything but nil.
(prefer-coding-system): Describe in the doc string that
default-terminal-coding-system is not changed on MS-DOS.
(set-language-environment): For MS-DOS, set standard syntax table
and display table for all characters with code above 127.
(standard-display-european-internal): For MS-DOS, pass all
characters with code above 127 directly to the terminal, and don't
remap characters 160 and 146 in the unibyte case.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Thu, 17 Dec 1998 17:12:56 +0000 |
parents | 3b5045c64434 |
children | e3421077c412 |
comparison
equal
deleted
inserted
replaced
23915:7ce49fb0dfbc | 23916:ccc00be328a1 |
---|---|
129 '("Next X Selection" . set-next-selection-coding-system) | 129 '("Next X Selection" . set-next-selection-coding-system) |
130 t) | 130 t) |
131 (define-key setup-language-environment-map | 131 (define-key setup-language-environment-map |
132 [Default] '("Default" . setup-specified-language-environment)) | 132 [Default] '("Default" . setup-specified-language-environment)) |
133 | 133 |
134 ;; These are meaningless when running under X. | 134 ;; These are meaningless when running under X and W32. |
135 (put 'set-terminal-coding-system 'menu-enable | 135 (put 'set-terminal-coding-system 'menu-enable |
136 '(not window-system)) | 136 '(or (not window-system) (eq window-system 'pc))) |
137 (put 'set-keyboard-coding-system 'menu-enable | 137 (put 'set-keyboard-coding-system 'menu-enable |
138 '(not window-system)) | 138 '(or (not window-system) (eq window-system 'pc))) |
139 ;; This is meaningless when the current buffer has no process. | 139 ;; This is meaningless when the current buffer has no process. |
140 (put 'set-buffer-process-coding-system 'menu-enable | 140 (put 'set-buffer-process-coding-system 'menu-enable |
141 '(get-buffer-process (current-buffer))) | 141 '(get-buffer-process (current-buffer))) |
142 ;; These are meaningless when running under terminal. | 142 ;; These are meaningless when running under terminal. |
143 (put 'set-selection-coding-system 'menu-enable | 143 (put 'set-selection-coding-system 'menu-enable |
210 This sets the following coding systems: | 210 This sets the following coding systems: |
211 o coding system of a newly created buffer | 211 o coding system of a newly created buffer |
212 o default coding system for subprocess I/O | 212 o default coding system for subprocess I/O |
213 This also sets the following values: | 213 This also sets the following values: |
214 o default value used as file-name-coding-system for converting file names. | 214 o default value used as file-name-coding-system for converting file names. |
215 o default value for the command `set-terminal-coding-system' | 215 o default value for the command `set-terminal-coding-system' (not on MSDOS) |
216 o default value for the command `set-keyboard-coding-system'" | 216 o default value for the command `set-keyboard-coding-system'." |
217 (check-coding-system coding-system) | 217 (check-coding-system coding-system) |
218 (setq-default buffer-file-coding-system coding-system) | 218 (setq-default buffer-file-coding-system coding-system) |
219 (if default-enable-multibyte-characters | 219 (if default-enable-multibyte-characters |
220 (setq default-file-name-coding-system coding-system)) | 220 (setq default-file-name-coding-system coding-system)) |
221 (setq default-terminal-coding-system coding-system) | 221 ;; If coding-system is nil, honor that on MS-DOS as well, so |
222 ;; that they could reset the terminal coding system. | |
223 (unless (and (eq window-system 'pc) coding-system) | |
224 (setq default-terminal-coding-system coding-system)) | |
222 (setq default-keyboard-coding-system coding-system) | 225 (setq default-keyboard-coding-system coding-system) |
223 (setq default-process-coding-system (cons coding-system coding-system))) | 226 (setq default-process-coding-system (cons coding-system coding-system))) |
224 | 227 |
225 (defalias 'update-iso-coding-systems 'update-coding-systems-internal) | 228 (defalias 'update-iso-coding-systems 'update-coding-systems-internal) |
226 (make-obsolete 'update-iso-coding-systems 'update-coding-systems-internal) | 229 (make-obsolete 'update-iso-coding-systems 'update-coding-systems-internal) |
230 This also sets the following coding systems: | 233 This also sets the following coding systems: |
231 o coding system of a newly created buffer | 234 o coding system of a newly created buffer |
232 o default coding system for subprocess I/O | 235 o default coding system for subprocess I/O |
233 This also sets the following values: | 236 This also sets the following values: |
234 o default value used as file-name-coding-system for converting file names. | 237 o default value used as file-name-coding-system for converting file names. |
235 o default value for the command `set-terminal-coding-system' | 238 o default value for the command `set-terminal-coding-system' (not on MSDOS) |
236 o default value for the command `set-keyboard-coding-system'" | 239 o default value for the command `set-keyboard-coding-system' |
240 | |
241 This command does not change the default value of terminal coding system | |
242 for MS-DOS terminal, because DOS terminals only support a single coding | |
243 system, and Emacs automatically sets the default to that coding system at | |
244 startup." | |
237 (interactive "zPrefer coding system: ") | 245 (interactive "zPrefer coding system: ") |
238 (if (not (and coding-system (coding-system-p coding-system))) | 246 (if (not (and coding-system (coding-system-p coding-system))) |
239 (error "Invalid coding system `%s'" coding-system)) | 247 (error "Invalid coding system `%s'" coding-system)) |
240 (let ((coding-category (coding-system-category coding-system)) | 248 (let ((coding-category (coding-system-category coding-system)) |
241 (base (coding-system-base coding-system))) | 249 (base (coding-system-base coding-system))) |
526 (if (fboundp select-safe-coding-system-function) | 534 (if (fboundp select-safe-coding-system-function) |
527 (funcall select-safe-coding-system-function | 535 (funcall select-safe-coding-system-function |
528 (point-min) (point-max) coding) | 536 (point-min) (point-max) coding) |
529 coding))) | 537 coding))) |
530 | 538 |
531 ;;; Language support staffs. | 539 ;;; Language support stuff. |
532 | 540 |
533 (defvar language-info-alist nil | 541 (defvar language-info-alist nil |
534 "Alist of language environment definitions. | 542 "Alist of language environment definitions. |
535 Each element looks like: | 543 Each element looks like: |
536 (LANGUAGE-NAME . ((KEY . INFO) ...)) | 544 (LANGUAGE-NAME . ((KEY . INFO) ...)) |
1160 (if current-language-environment | 1168 (if current-language-environment |
1161 (let ((func (get-language-info current-language-environment | 1169 (let ((func (get-language-info current-language-environment |
1162 'exit-function))) | 1170 'exit-function))) |
1163 (run-hooks 'exit-language-environment-hook) | 1171 (run-hooks 'exit-language-environment-hook) |
1164 (if (fboundp func) (funcall func)))) | 1172 (if (fboundp func) (funcall func)))) |
1165 (reset-language-environment) | 1173 (let ((default-eol-type (coding-system-eol-type |
1166 | 1174 default-buffer-file-coding-system))) |
1167 (setq current-language-environment language-name) | 1175 (reset-language-environment) |
1168 (set-language-environment-coding-systems language-name) | 1176 |
1177 (setq current-language-environment language-name) | |
1178 (set-language-environment-coding-systems language-name default-eol-type)) | |
1169 (let ((input-method (get-language-info language-name 'input-method))) | 1179 (let ((input-method (get-language-info language-name 'input-method))) |
1170 (when input-method | 1180 (when input-method |
1171 (setq default-input-method input-method) | 1181 (setq default-input-method input-method) |
1172 (if input-method-history | 1182 (if input-method-history |
1173 (setq input-method-history | 1183 (setq input-method-history |
1174 (cons input-method | 1184 (cons input-method |
1175 (delete input-method input-method-history)))))) | 1185 (delete input-method input-method-history)))))) |
1176 (let ((nonascii (get-language-info language-name 'nonascii-translation))) | 1186 (let ((nonascii (get-language-info language-name 'nonascii-translation))) |
1177 (if (char-table-p nonascii) | 1187 (cond |
1178 (setq nonascii-translation-table nonascii) | 1188 ((char-table-p nonascii) |
1179 (if (charsetp nonascii) | 1189 (setq nonascii-translation-table nonascii)) |
1180 (setq nonascii-insert-offset (- (make-char nonascii) 128))))) | 1190 ((eq window-system 'pc) |
1191 ;; DOS terminals' default is to use a special non-ASCII translation | |
1192 ;; table as appropriate for the installed codepage. | |
1193 (setq | |
1194 nonascii-translation-table (symbol-value | |
1195 (intern | |
1196 (concat "cp" | |
1197 dos-codepage | |
1198 "-nonascii-translation-table"))))) | |
1199 ((charsetp nonascii) | |
1200 (setq nonascii-insert-offset (- (make-char nonascii) 128))))) | |
1181 | 1201 |
1182 (setq charset-origin-alist | 1202 (setq charset-origin-alist |
1183 (get-language-info language-name 'charset-origin-alist)) | 1203 (get-language-info language-name 'charset-origin-alist)) |
1184 | 1204 |
1185 ;; Unibyte setups if necessary. | 1205 ;; Unibyte setups if necessary. |
1190 (let ((set-case-syntax-set-multibyte nil)) | 1210 (let ((set-case-syntax-set-multibyte nil)) |
1191 (load syntax nil t)) | 1211 (load syntax nil t)) |
1192 ;; No information for syntax and case. Reset to the defaults. | 1212 ;; No information for syntax and case. Reset to the defaults. |
1193 (let ((syntax-table (standard-syntax-table)) | 1213 (let ((syntax-table (standard-syntax-table)) |
1194 (case-table (standard-case-table)) | 1214 (case-table (standard-case-table)) |
1195 (ch 160)) | 1215 (ch (if (eq window-system 'pc) 128 160))) |
1196 (while (< ch 256) | 1216 (while (< ch 256) |
1197 (modify-syntax-entry ch " " syntax-table) | 1217 (modify-syntax-entry ch " " syntax-table) |
1198 (aset case-table ch ch) | 1218 (aset case-table ch ch) |
1199 (setq ch (1+ ch))) | 1219 (setq ch (1+ ch))) |
1200 (set-char-table-extra-slot case-table 0 nil) | 1220 (set-char-table-extra-slot case-table 0 nil) |
1207 (set-case-table (standard-case-table))) | 1227 (set-case-table (standard-case-table))) |
1208 (setq list (cdr list)))))) | 1228 (setq list (cdr list)))))) |
1209 ;; Display table and coding system for terminal. | 1229 ;; Display table and coding system for terminal. |
1210 (let ((coding (get-language-info language-name 'unibyte-display))) | 1230 (let ((coding (get-language-info language-name 'unibyte-display))) |
1211 (if coding | 1231 (if coding |
1212 (progn | 1232 (standard-display-european-internal) |
1213 (standard-display-european-internal) | 1233 (standard-display-default (if (eq window-system 'pc) 128 160) 255) |
1214 (set-terminal-coding-system coding)) | 1234 (aset standard-display-table 146 nil)) |
1215 (standard-display-default 160 255) | 1235 (or (eq window-system 'pc) |
1216 (aset standard-display-table 146 nil) | 1236 (set-terminal-coding-system coding)))) |
1217 (set-terminal-coding-system nil)))) | |
1218 | 1237 |
1219 (let ((required-features (get-language-info language-name 'features))) | 1238 (let ((required-features (get-language-info language-name 'features))) |
1220 (while required-features | 1239 (while required-features |
1221 (require (car required-features)) | 1240 (require (car required-features)) |
1222 (setq required-features (cdr required-features)))) | 1241 (setq required-features (cdr required-features)))) |
1226 (run-hooks 'set-language-environment-hook) | 1245 (run-hooks 'set-language-environment-hook) |
1227 (force-mode-line-update t)) | 1246 (force-mode-line-update t)) |
1228 | 1247 |
1229 (defun standard-display-european-internal () | 1248 (defun standard-display-european-internal () |
1230 ;; Actually set up direct output of non-ASCII characters. | 1249 ;; Actually set up direct output of non-ASCII characters. |
1231 (standard-display-8bit 160 255) | 1250 (standard-display-8bit (if (eq window-system 'pc) 128 160) 255) |
1232 ;; Make non-line-break space display as a plain space. | 1251 ;; Unibyte Emacs on MS-DOS wants to display all 8-bit characters with |
1233 ;; Most X fonts do the wrong thing for code 160. | 1252 ;; the native font, and codes 160 and 146 stand for something very |
1234 (aset standard-display-table 160 [32]) | 1253 ;; different there. |
1235 ;; Most Windows programs send out apostrophe's as \222. Most X fonts | 1254 (or (and (eq window-system 'pc) (not default-enable-multibyte-characters)) |
1236 ;; don't contain a character at that position. Map it to the ASCII | 1255 (progn |
1237 ;; apostrophe. | 1256 ;; Make non-line-break space display as a plain space. |
1238 (aset standard-display-table 146 [39])) | 1257 ;; Most X fonts do the wrong thing for code 160. |
1239 | 1258 (aset standard-display-table 160 [32]) |
1240 (defun set-language-environment-coding-systems (language-name) | 1259 ;; Most Windows programs send out apostrophe's as \222. Most X fonts |
1241 "Do various coding system setups for language environment LANGUAGE-NAME." | 1260 ;; don't contain a character at that position. Map it to the ASCII |
1261 ;; apostrophe. | |
1262 (aset standard-display-table 146 [39])))) | |
1263 | |
1264 (defun set-language-environment-coding-systems (language-name | |
1265 &optional eol-type) | |
1266 "Do various coding system setups for language environment LANGUAGE-NAME. | |
1267 | |
1268 The optional arg EOL-TYPE specifies the eol-type of the default value | |
1269 of buffer-file-coding-system set by this function." | |
1242 (let* ((priority (get-language-info language-name 'coding-priority)) | 1270 (let* ((priority (get-language-info language-name 'coding-priority)) |
1243 (default-coding (car priority))) | 1271 (default-coding (car priority))) |
1244 (if priority | 1272 (if priority |
1245 (let ((categories (mapcar 'coding-system-category priority))) | 1273 (let ((categories (mapcar 'coding-system-category priority))) |
1246 (set-default-coding-systems default-coding) | 1274 (set-default-coding-systems |
1275 (if (memq eol-type '(0 1 2 unix dos mac)) | |
1276 (coding-system-change-eol-conversion default-coding eol-type) | |
1277 default-coding)) | |
1247 (setq default-sendmail-coding-system default-coding) | 1278 (setq default-sendmail-coding-system default-coding) |
1248 (set-coding-priority categories) | 1279 (set-coding-priority categories) |
1249 (while priority | 1280 (while priority |
1250 (set (car categories) (car priority)) | 1281 (set (car categories) (car priority)) |
1251 (setq priority (cdr priority) categories (cdr categories))) | 1282 (setq priority (cdr priority) categories (cdr categories))) |