Simplify 8-bit character handling by terminal for 'raw-text'
* lisp/international/mule.el (set-keyboard-coding-system): Treat 'raw-text' as another coding type that requires 8-bit characters. * lisp/xt-mouse.el (xterm-mouse--read-coordinate): Use 'no-conversion' instead of 'latin-1'.
This commit is contained in:
parent
f3653ec446
commit
4ab671c48c
2 changed files with 30 additions and 40 deletions
|
@ -1445,42 +1445,35 @@ graphical terminals."
|
||||||
(let ((coding-type (coding-system-type coding-system))
|
(let ((coding-type (coding-system-type coding-system))
|
||||||
(saved-meta-mode
|
(saved-meta-mode
|
||||||
(terminal-parameter terminal 'keyboard-coding-saved-meta-mode)))
|
(terminal-parameter terminal 'keyboard-coding-saved-meta-mode)))
|
||||||
(if (not (eq coding-type 'raw-text))
|
(let (accept-8-bit)
|
||||||
(let (accept-8-bit)
|
(if (not (or (coding-system-get coding-system :suitable-for-keyboard)
|
||||||
(if (not (or (coding-system-get coding-system :suitable-for-keyboard)
|
(coding-system-get coding-system :ascii-compatible-p)))
|
||||||
(coding-system-get coding-system :ascii-compatible-p)))
|
(error "Unsuitable coding system for keyboard: %s" coding-system))
|
||||||
(error "Unsuitable coding system for keyboard: %s" coding-system))
|
(cond ((memq coding-type '(raw-text charset utf-8 shift-jis big5 ccl))
|
||||||
(cond ((memq coding-type '(charset utf-8 shift-jis big5 ccl))
|
(setq accept-8-bit t))
|
||||||
(setq accept-8-bit t))
|
((eq coding-type 'iso-2022)
|
||||||
((eq coding-type 'iso-2022)
|
(let ((flags (coding-system-get coding-system :flags)))
|
||||||
(let ((flags (coding-system-get coding-system :flags)))
|
(or (memq '7-bit flags)
|
||||||
(or (memq '7-bit flags)
|
(setq accept-8-bit t))))
|
||||||
(setq accept-8-bit t))))
|
(t
|
||||||
(t
|
(error "Unsupported coding system for keyboard: %s"
|
||||||
(error "Unsupported coding system for keyboard: %s"
|
coding-system)))
|
||||||
coding-system)))
|
(if accept-8-bit
|
||||||
(if accept-8-bit
|
(progn
|
||||||
(progn
|
(or saved-meta-mode
|
||||||
(or saved-meta-mode
|
(set-terminal-parameter terminal
|
||||||
(set-terminal-parameter terminal
|
'keyboard-coding-saved-meta-mode
|
||||||
'keyboard-coding-saved-meta-mode
|
(cons (nth 2 (current-input-mode))
|
||||||
(cons (nth 2 (current-input-mode))
|
nil)))
|
||||||
nil)))
|
(set-input-meta-mode 8 terminal))
|
||||||
(set-input-meta-mode 8 terminal))
|
(when saved-meta-mode
|
||||||
(when saved-meta-mode
|
(set-input-meta-mode (car saved-meta-mode) terminal)
|
||||||
(set-input-meta-mode (car saved-meta-mode) terminal)
|
(set-terminal-parameter terminal
|
||||||
(set-terminal-parameter terminal
|
'keyboard-coding-saved-meta-mode
|
||||||
'keyboard-coding-saved-meta-mode
|
nil)))
|
||||||
nil)))
|
;; Avoid end-of-line conversion.
|
||||||
;; Avoid end-of-line conversion.
|
(setq coding-system
|
||||||
(setq coding-system
|
(coding-system-change-eol-conversion coding-system 'unix))))
|
||||||
(coding-system-change-eol-conversion coding-system 'unix)))
|
|
||||||
|
|
||||||
(when saved-meta-mode
|
|
||||||
(set-input-meta-mode (car saved-meta-mode) terminal)
|
|
||||||
(set-terminal-parameter terminal
|
|
||||||
'keyboard-coding-saved-meta-mode
|
|
||||||
nil))))
|
|
||||||
(set-keyboard-coding-system-internal coding-system terminal)
|
(set-keyboard-coding-system-internal coding-system terminal)
|
||||||
(setq keyboard-coding-system coding-system))
|
(setq keyboard-coding-system coding-system))
|
||||||
|
|
||||||
|
|
|
@ -155,10 +155,7 @@ single byte."
|
||||||
(set-keyboard-coding-system
|
(set-keyboard-coding-system
|
||||||
(if (terminal-parameter nil 'xterm-mouse-utf-8)
|
(if (terminal-parameter nil 'xterm-mouse-utf-8)
|
||||||
'utf-8-unix
|
'utf-8-unix
|
||||||
;; Use Latin-1 instead of no-conversion to avoid flicker
|
'no-conversion))
|
||||||
;; due to `set-keyboard-coding-system' changing the meta
|
|
||||||
;; mode.
|
|
||||||
'latin-1))
|
|
||||||
;; Wait only a little; we assume that the entire escape sequence
|
;; Wait only a little; we assume that the entire escape sequence
|
||||||
;; has already been sent when this function is called.
|
;; has already been sent when this function is called.
|
||||||
(read-char nil nil 0.1))
|
(read-char nil nil 0.1))
|
||||||
|
|
Loading…
Add table
Reference in a new issue