Commit 3dcad254 authored by Kenichi Handa's avatar Kenichi Handa

(set-keyboard-coding-system): Perform the

necessary setup here instead of calling encoded-kbd-setup-display.
parent fd503d99
......@@ -1268,36 +1268,57 @@ See also the command `set-keyboard-coding-system'.")
(defun set-keyboard-coding-system (coding-system &optional terminal)
"Set coding system for keyboard input on TERMINAL to CODING-SYSTEM.
In addition, this command calls `encoded-kbd-setup-display' to set up the
translation of keyboard input events to the specified coding system.
For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems].
The default is determined by the selected language environment
or by the previous use of this command.
If CODING-SYSTEM is nil or the coding-type of CODING-SYSTEM is
`raw-text', the decoding of keyboard input is disabled.
TERMINAL may be a terminal object, a frame, or nil for the
selected frame's terminal. The setting has no effect on
graphical terminals."
(list (let ((default (if (and (not (keyboard-coding-system))
(list (let* ((coding (keyboard-coding-system nil))
(default (if (eq (coding-system-type coding) 'raw-text)
(format "Coding system for keyboard input (default %s): "
(if (and (not coding-system)
(not (keyboard-coding-system)))
(setq coding-system default-keyboard-coding-system))
(if coding-system
(setq default-keyboard-coding-system coding-system))
(if (and coding-system
(not (coding-system-get coding-system :ascii-compatible-p))
(not (coding-system-get coding-system :suitable-for-keyboard)))
(error "%s is not suitable for keyboard" coding-system))
(let ((coding-type (coding-system-type coding-system))
(terminal-parameter terminal 'keyboard-coding-saved-meta-mode)))
(if (not (eq coding-type 'raw-text))
(let (accept-8-bit)
(if (not (or (coding-system-get coding-system :suitable-for-keyboard)
(coding-system-get coding-system :ascii-compatible-p)))
(error "Unsuitable coding system for keyboard: %s" coding-system))
(cond ((memq coding-type '(charset utf-8 shift-jis big5 ccl))
(setq accept-8-bit t))
((eq coding-type 'iso-2022)
(let ((flags (coding-system-get coding-system :flags)))
(or (memq '7-bit flags)
(setq accept-8-bit t))))
(error "Unsupported coding system for keyboard: %s"
(when accept-8-bit
(or saved-meta-mode
(set-terminal-parameter terminal
(cons (nth 2 (current-input-mode))
(set-input-meta-mode 8)))
(when saved-meta-mode
(set-input-meta-mode (car saved-meta-mode))
(set-terminal-parameter terminal
(set-keyboard-coding-system-internal coding-system terminal)
(setq keyboard-coding-system coding-system)
(encoded-kbd-setup-display terminal))
(setq keyboard-coding-system coding-system))
(defcustom keyboard-coding-system nil
"Specify coding system for keyboard input.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment