aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2009-07-01 11:40:03 +0000
committerKenichi Handa2009-07-01 11:40:03 +0000
commit3dcad254d5c3e6127f6e3b52e6864bf080ae29bb (patch)
treecd5663f95b3c3eec7292c8734a42e93925eefd88
parentfd503d99b25a653ba5b300e31d8b3c6a86520ecd (diff)
downloademacs-3dcad254d5c3e6127f6e3b52e6864bf080ae29bb.tar.gz
emacs-3dcad254d5c3e6127f6e3b52e6864bf080ae29bb.zip
(set-keyboard-coding-system): Perform the
necessary setup here instead of calling encoded-kbd-setup-display.
-rw-r--r--lisp/international/mule.el53
1 files changed, 37 insertions, 16 deletions
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index dc96d21bdbb..ebbc86a62ff 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -1268,36 +1268,57 @@ See also the command `set-keyboard-coding-system'.")
1268 1268
1269(defun set-keyboard-coding-system (coding-system &optional terminal) 1269(defun set-keyboard-coding-system (coding-system &optional terminal)
1270 "Set coding system for keyboard input on TERMINAL to CODING-SYSTEM. 1270 "Set coding system for keyboard input on TERMINAL to CODING-SYSTEM.
1271In addition, this command calls `encoded-kbd-setup-display' to set up the
1272translation of keyboard input events to the specified coding system.
1273 1271
1274For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems]. 1272For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems].
1275The default is determined by the selected language environment 1273The default is determined by the selected language environment
1276or by the previous use of this command. 1274or by the previous use of this command.
1277 1275
1276If CODING-SYSTEM is nil or the coding-type of CODING-SYSTEM is
1277`raw-text', the decoding of keyboard input is disabled.
1278
1278TERMINAL may be a terminal object, a frame, or nil for the 1279TERMINAL may be a terminal object, a frame, or nil for the
1279selected frame's terminal. The setting has no effect on 1280selected frame's terminal. The setting has no effect on
1280graphical terminals." 1281graphical terminals."
1281 (interactive 1282 (interactive
1282 (list (let ((default (if (and (not (keyboard-coding-system)) 1283 (list (let* ((coding (keyboard-coding-system nil))
1283 default-keyboard-coding-system) 1284 (default (if (eq (coding-system-type coding) 'raw-text)
1284 default-keyboard-coding-system))) 1285 default-keyboard-coding-system)))
1285 (read-coding-system 1286 (read-coding-system
1286 (format "Coding system for keyboard input (default %s): " 1287 (format "Coding system for keyboard input (default %s): "
1287 default) 1288 default)
1288 default)))) 1289 default))))
1289 (if (and (not coding-system) 1290 (let ((coding-type (coding-system-type coding-system))
1290 (not (keyboard-coding-system))) 1291 (saved-meta-mode
1291 (setq coding-system default-keyboard-coding-system)) 1292 (terminal-parameter terminal 'keyboard-coding-saved-meta-mode)))
1292 (if coding-system 1293 (if (not (eq coding-type 'raw-text))
1293 (setq default-keyboard-coding-system coding-system)) 1294 (let (accept-8-bit)
1294 (if (and coding-system 1295 (if (not (or (coding-system-get coding-system :suitable-for-keyboard)
1295 (not (coding-system-get coding-system :ascii-compatible-p)) 1296 (coding-system-get coding-system :ascii-compatible-p)))
1296 (not (coding-system-get coding-system :suitable-for-keyboard))) 1297 (error "Unsuitable coding system for keyboard: %s" coding-system))
1297 (error "%s is not suitable for keyboard" coding-system)) 1298 (cond ((memq coding-type '(charset utf-8 shift-jis big5 ccl))
1299 (setq accept-8-bit t))
1300 ((eq coding-type 'iso-2022)
1301 (let ((flags (coding-system-get coding-system :flags)))
1302 (or (memq '7-bit flags)
1303 (setq accept-8-bit t))))
1304 (t
1305 (error "Unsupported coding system for keyboard: %s"
1306 coding-system)))
1307 (when accept-8-bit
1308 (or saved-meta-mode
1309 (set-terminal-parameter terminal
1310 'keyboard-coding-saved-meta-mode
1311 (cons (nth 2 (current-input-mode))
1312 nil)))
1313 (set-input-meta-mode 8)))
1314
1315 (when saved-meta-mode
1316 (set-input-meta-mode (car saved-meta-mode))
1317 (set-terminal-parameter terminal
1318 'keyboard-coding-saved-meta-mode
1319 nil))))
1298 (set-keyboard-coding-system-internal coding-system terminal) 1320 (set-keyboard-coding-system-internal coding-system terminal)
1299 (setq keyboard-coding-system coding-system) 1321 (setq keyboard-coding-system coding-system))
1300 (encoded-kbd-setup-display terminal))
1301 1322
1302(defcustom keyboard-coding-system nil 1323(defcustom keyboard-coding-system nil
1303 "Specify coding system for keyboard input. 1324 "Specify coding system for keyboard input.