diff options
| author | Kenichi Handa | 2009-07-01 11:41:29 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2009-07-01 11:41:29 +0000 |
| commit | 5fbd8697579fd0e10d49d42f50bc62d6ee194777 (patch) | |
| tree | ee3db547a13e76fa69fa14a2c792619df2704927 | |
| parent | 3dcad254d5c3e6127f6e3b52e6864bf080ae29bb (diff) | |
| download | emacs-5fbd8697579fd0e10d49d42f50bc62d6ee194777.tar.gz emacs-5fbd8697579fd0e10d49d42f50bc62d6ee194777.zip | |
Deleted.
| -rw-r--r-- | lisp/international/encoded-kb.el | 425 |
1 files changed, 0 insertions, 425 deletions
diff --git a/lisp/international/encoded-kb.el b/lisp/international/encoded-kb.el deleted file mode 100644 index 62fd6f1c17b..00000000000 --- a/lisp/international/encoded-kb.el +++ /dev/null | |||
| @@ -1,425 +0,0 @@ | |||
| 1 | ;;; encoded-kb.el --- handler to input multibyte characters encoded somehow | ||
| 2 | |||
| 3 | ;; Copyright (C) 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 | ||
| 4 | ;; Free Software Foundation, Inc. | ||
| 5 | ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, | ||
| 6 | ;; 2005, 2006, 2007, 2008, 2009 | ||
| 7 | ;; National Institute of Advanced Industrial Science and Technology (AIST) | ||
| 8 | ;; Registration Number H14PRO021 | ||
| 9 | ;; Copyright (C) 2003 | ||
| 10 | ;; National Institute of Advanced Industrial Science and Technology (AIST) | ||
| 11 | ;; Registration Number H13PRO009 | ||
| 12 | |||
| 13 | ;; This file is part of GNU Emacs. | ||
| 14 | |||
| 15 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 16 | ;; it under the terms of the GNU General Public License as published by | ||
| 17 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 18 | ;; (at your option) any later version. | ||
| 19 | |||
| 20 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 21 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 22 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 23 | ;; GNU General Public License for more details. | ||
| 24 | |||
| 25 | ;; You should have received a copy of the GNU General Public License | ||
| 26 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 27 | |||
| 28 | ;;; Commentary: | ||
| 29 | |||
| 30 | ;;; Code: | ||
| 31 | |||
| 32 | ;; Usually this map is empty (even if Encoded-kbd mode is on), but if | ||
| 33 | ;; the keyboard coding system is iso-2022-based, it defines dummy key | ||
| 34 | ;; bindings for ESC $ ..., etc. so that those bindings in | ||
| 35 | ;; input-decode-map take effect. | ||
| 36 | (defconst encoded-kbd-mode-map (make-sparse-keymap) | ||
| 37 | "Keymap for Encoded-kbd minor mode.") | ||
| 38 | |||
| 39 | ;; Subsidiary keymaps for handling ISO2022 escape sequences. | ||
| 40 | |||
| 41 | (defvar encoded-kbd-iso2022-esc-map | ||
| 42 | (let ((map (make-sparse-keymap))) | ||
| 43 | (define-key map "$" 'encoded-kbd-iso2022-esc-dollar-prefix) | ||
| 44 | (define-key map "(" 'encoded-kbd-iso2022-designation-prefix) | ||
| 45 | (define-key map ")" 'encoded-kbd-iso2022-designation-prefix) | ||
| 46 | (define-key map "," 'encoded-kbd-iso2022-designation-prefix) | ||
| 47 | (define-key map "-" 'encoded-kbd-iso2022-designation-prefix) | ||
| 48 | map) | ||
| 49 | "Keymap for handling ESC code in Encoded-kbd mode.") | ||
| 50 | (fset 'encoded-kbd-iso2022-esc-prefix encoded-kbd-iso2022-esc-map) | ||
| 51 | |||
| 52 | (defvar encoded-kbd-iso2022-esc-dollar-map | ||
| 53 | (let ((map (make-sparse-keymap))) | ||
| 54 | (define-key map "(" 'encoded-kbd-iso2022-designation-prefix) | ||
| 55 | (define-key map ")" 'encoded-kbd-iso2022-designation-prefix) | ||
| 56 | (define-key map "," 'encoded-kbd-iso2022-designation-prefix) | ||
| 57 | (define-key map "-" 'encoded-kbd-iso2022-designation-prefix) | ||
| 58 | (define-key map "@" 'encoded-kbd-iso2022-designation) | ||
| 59 | (define-key map "A" 'encoded-kbd-iso2022-designation) | ||
| 60 | (define-key map "B" 'encoded-kbd-iso2022-designation) | ||
| 61 | map) | ||
| 62 | "Keymap for handling ESC $ sequence in Encoded-kbd mode.") | ||
| 63 | (fset 'encoded-kbd-iso2022-esc-dollar-prefix | ||
| 64 | encoded-kbd-iso2022-esc-dollar-map) | ||
| 65 | |||
| 66 | (defvar encoded-kbd-iso2022-designation-map | ||
| 67 | (let ((map (make-sparse-keymap)) | ||
| 68 | (l charset-list) | ||
| 69 | final-char) | ||
| 70 | (while l | ||
| 71 | (setq final-char (charset-iso-final-char (car l))) | ||
| 72 | (if (> final-char 0) | ||
| 73 | (define-key map (char-to-string final-char) | ||
| 74 | 'encoded-kbd-iso2022-designation)) | ||
| 75 | (setq l (cdr l))) | ||
| 76 | map) | ||
| 77 | "Keymap for handling ISO2022 designation sequence in Encoded-kbd mode.") | ||
| 78 | (fset 'encoded-kbd-iso2022-designation-prefix | ||
| 79 | encoded-kbd-iso2022-designation-map) | ||
| 80 | |||
| 81 | ;; Keep information of designation state of ISO2022 encoding. When | ||
| 82 | ;; Encoded-kbd mode is on, this is set to a vector of length 4, the | ||
| 83 | ;; elements are character sets currently designated to graphic | ||
| 84 | ;; registers 0 thru 3. | ||
| 85 | |||
| 86 | (defvar encoded-kbd-iso2022-designations nil) | ||
| 87 | (put 'encoded-kbd-iso2022-designations 'permanent-local t) | ||
| 88 | |||
| 89 | ;; Keep information of invocation state of ISO2022 encoding. When | ||
| 90 | ;; Encoded-kbd mode is on, this is set to a vector of length 3, | ||
| 91 | ;; graphic register numbers currently invoked to graphic plane 1 and | ||
| 92 | ;; 2, and a single shifted graphic register number. | ||
| 93 | |||
| 94 | (defvar encoded-kbd-iso2022-invocations nil) | ||
| 95 | (put 'encoded-kbd-iso2022-invocations 'permanent-local t) | ||
| 96 | |||
| 97 | (defsubst encoded-kbd-last-key () | ||
| 98 | (let ((keys (this-single-command-keys))) | ||
| 99 | (aref keys (1- (length keys))))) | ||
| 100 | |||
| 101 | (defun encoded-kbd-iso2022-designation (ignore) | ||
| 102 | "Do ISO2022 designation according to the current key in Encoded-kbd mode. | ||
| 103 | The following key sequence may cause multilingual text insertion." | ||
| 104 | (let ((key-seq (this-single-command-keys)) | ||
| 105 | (prev-g0-charset (aref encoded-kbd-iso2022-designations | ||
| 106 | (aref encoded-kbd-iso2022-invocations 0))) | ||
| 107 | intermediate-char final-char | ||
| 108 | reg dimension chars charset) | ||
| 109 | (if (= (length key-seq) 4) | ||
| 110 | ;; ESC $ <intermediate-char> <final-char> | ||
| 111 | (setq intermediate-char (aref key-seq 2) | ||
| 112 | dimension 2 | ||
| 113 | chars (if (< intermediate-char ?,) 94 96) | ||
| 114 | final-char (aref key-seq 3) | ||
| 115 | reg (mod intermediate-char 4)) | ||
| 116 | (if (= (aref key-seq 1) ?$) | ||
| 117 | ;; ESC $ <final-char> | ||
| 118 | (setq dimension 2 | ||
| 119 | chars 94 | ||
| 120 | final-char (aref key-seq 2) | ||
| 121 | reg 0) | ||
| 122 | ;; ESC <intermediate-char> <final-char> | ||
| 123 | (setq intermediate-char (aref key-seq 1) | ||
| 124 | dimension 1 | ||
| 125 | chars (if (< intermediate-char ?,) 94 96) | ||
| 126 | final-char (aref key-seq 2) | ||
| 127 | reg (mod intermediate-char 4)))) | ||
| 128 | (aset encoded-kbd-iso2022-designations reg | ||
| 129 | (iso-charset dimension chars final-char))) | ||
| 130 | "") | ||
| 131 | |||
| 132 | (defun encoded-kbd-iso2022-single-shift (ignore) | ||
| 133 | (let ((char (encoded-kbd-last-key))) | ||
| 134 | (aset encoded-kbd-iso2022-invocations 2 (if (= char ?\216) 2 3))) | ||
| 135 | "") | ||
| 136 | |||
| 137 | (defun encoded-kbd-self-insert-iso2022-7bit (ignore) | ||
| 138 | (let ((char (encoded-kbd-last-key)) | ||
| 139 | (charset (aref encoded-kbd-iso2022-designations | ||
| 140 | (or (aref encoded-kbd-iso2022-invocations 2) | ||
| 141 | (aref encoded-kbd-iso2022-invocations 0))))) | ||
| 142 | (aset encoded-kbd-iso2022-invocations 2 nil) | ||
| 143 | (vector (if (= (charset-dimension charset) 1) | ||
| 144 | (make-char charset char) | ||
| 145 | (make-char charset char (read-char-exclusive)))))) | ||
| 146 | |||
| 147 | (defun encoded-kbd-self-insert-iso2022-8bit (ignore) | ||
| 148 | (let ((char (encoded-kbd-last-key)) | ||
| 149 | (charset (aref encoded-kbd-iso2022-designations | ||
| 150 | (or (aref encoded-kbd-iso2022-invocations 2) | ||
| 151 | (aref encoded-kbd-iso2022-invocations 1))))) | ||
| 152 | (aset encoded-kbd-iso2022-invocations 2 nil) | ||
| 153 | (vector (if (= (charset-dimension charset) 1) | ||
| 154 | (make-char charset char) | ||
| 155 | (make-char charset char (read-char-exclusive)))))) | ||
| 156 | |||
| 157 | (defun encoded-kbd-self-insert-sjis (ignore) | ||
| 158 | (let ((char (encoded-kbd-last-key))) | ||
| 159 | (vector | ||
| 160 | (if (or (< char ?\xA0) (>= char ?\xE0)) | ||
| 161 | (decode-sjis-char (+ (ash char 8) (read-char-exclusive))) | ||
| 162 | (make-char 'katakana-jisx0201 char))))) | ||
| 163 | |||
| 164 | (defun encoded-kbd-self-insert-big5 (ignore) | ||
| 165 | (let ((char (encoded-kbd-last-key))) | ||
| 166 | (vector | ||
| 167 | (decode-big5-char (+ (ash char 8) (read-char-exclusive)))))) | ||
| 168 | |||
| 169 | (defun encoded-kbd-self-insert-ccl (ignore) | ||
| 170 | (let ((str (char-to-string (encoded-kbd-last-key))) | ||
| 171 | (ccl (coding-system-get (keyboard-coding-system) :ccl-decoder)) | ||
| 172 | (vec [nil nil nil nil nil nil nil nil nil]) | ||
| 173 | result) | ||
| 174 | (while (= (length (setq result (ccl-execute-on-string ccl vec str t))) 0) | ||
| 175 | (dotimes (i 9) (aset vec i nil)) | ||
| 176 | (setq str (format "%s%c" str (read-char-exclusive)))) | ||
| 177 | (vector (aref result 0)))) | ||
| 178 | |||
| 179 | |||
| 180 | ;; Decode list of codes in CODE-LIST by CHARSET and return the decoded | ||
| 181 | ;; characters. If CODE-LIST is too short for the dimension of | ||
| 182 | ;; CHARSET, read new codes and append them to the tail of CODE-LIST. | ||
| 183 | ;; Return nil if CODE-LIST can't be decoded. | ||
| 184 | |||
| 185 | (defun encoded-kbd-decode-code-list (charset code-list) | ||
| 186 | (let ((dimension (charset-dimension charset)) | ||
| 187 | code) | ||
| 188 | (while (> dimension (length code-list)) | ||
| 189 | (nconc code-list (list (read-char-exclusive)))) | ||
| 190 | (setq code (car code-list)) | ||
| 191 | (if (= dimension 1) | ||
| 192 | (decode-char charset code) | ||
| 193 | (setq code-list (cdr code-list) | ||
| 194 | code (logior (lsh code 8) (car code-list))) | ||
| 195 | (if (= dimension 2) | ||
| 196 | (decode-char charset code) | ||
| 197 | (setq code-list (cdr code-list) | ||
| 198 | code (logior (lsh code 8) (car code-list))) | ||
| 199 | (if (= dimension 3) | ||
| 200 | (decode-char charset code) | ||
| 201 | ;; As Emacs can't handle full 32-bit integer, we must give a | ||
| 202 | ;; cons of higher and lower 16-bit codes to decode-char. | ||
| 203 | (setq code (cons (lsh code -8) | ||
| 204 | (logior (lsh (car code-list) 8) (cadr code-list)))) | ||
| 205 | (decode-char charset code)))))) | ||
| 206 | |||
| 207 | (defun encoded-kbd-self-insert-charset (ignore) | ||
| 208 | (let ((charset-list | ||
| 209 | (coding-system-get (keyboard-coding-system) :charset-list)) | ||
| 210 | (code-list (list (encoded-kbd-last-key))) | ||
| 211 | tail char) | ||
| 212 | (while (and charset-list (not char)) | ||
| 213 | (setq char (encoded-kbd-decode-code-list (car charset-list) code-list) | ||
| 214 | charset-list (cdr charset-list))) | ||
| 215 | (if char | ||
| 216 | (vector char) | ||
| 217 | (setq unread-command-events (cdr code-list)) | ||
| 218 | (vector (car code-list))))) | ||
| 219 | |||
| 220 | (defun encoded-kbd-self-insert-utf-8 (arg) | ||
| 221 | (interactive "p") | ||
| 222 | (let* ((lead (encoded-kbd-last-key)) | ||
| 223 | (char lead) | ||
| 224 | len event) | ||
| 225 | (cond ((< char #xE0) | ||
| 226 | (setq len 1 char (logand char #x1F))) | ||
| 227 | ((< char #xF0) | ||
| 228 | (setq len 2 char (logand char #x0F))) | ||
| 229 | ((< char #xF8) | ||
| 230 | (setq len 3 char (logand char #x07))) | ||
| 231 | (t | ||
| 232 | (setq len 4 char 0))) | ||
| 233 | (while (> len 0) | ||
| 234 | (setq event (read-char-exclusive)) | ||
| 235 | (if (and (>= event #x80) (< event #xc0)) | ||
| 236 | ;; Valid utf-8 sequence. | ||
| 237 | (setq char (logior (lsh char 6) (- event #x80)) | ||
| 238 | len (1- len)) | ||
| 239 | ;; Invalid utf-8 sequence. Might be because Quail got involved | ||
| 240 | ;; in-between and the bytes we thought we were reading were actually | ||
| 241 | ;; latin-1 chars. Let's presume that `event' is the second "byte", | ||
| 242 | ;; i.e. there weren't any "apprently correct" between `lead' and | ||
| 243 | ;; `event': it's easy to recover in this case, and the more general | ||
| 244 | ;; case seems pretty unlikely. | ||
| 245 | ;; FIXME: We should really do encoded-kbd decoding before processing | ||
| 246 | ;; input-methods. | ||
| 247 | (push event unread-command-events) | ||
| 248 | (setq char lead) | ||
| 249 | (setq len 0))) | ||
| 250 | (vector char))) | ||
| 251 | |||
| 252 | (defun encoded-kbd-setup-keymap (keymap coding) | ||
| 253 | ;; At first, reset the keymap. | ||
| 254 | (define-key encoded-kbd-mode-map "\e" nil) | ||
| 255 | ;; Then setup the keymap according to the keyboard coding system. | ||
| 256 | (cond | ||
| 257 | ((eq (coding-system-type coding) 'shift-jis) | ||
| 258 | (let ((i 128)) | ||
| 259 | (while (< i 256) | ||
| 260 | (define-key keymap | ||
| 261 | (vector i) 'encoded-kbd-self-insert-sjis) | ||
| 262 | (setq i (1+ i)))) | ||
| 263 | 8) | ||
| 264 | |||
| 265 | ((eq (coding-system-type coding) 'big5) | ||
| 266 | (let ((i 128)) | ||
| 267 | (while (< i 256) | ||
| 268 | (define-key keymap | ||
| 269 | (vector i) 'encoded-kbd-self-insert-big5) | ||
| 270 | (setq i (1+ i)))) | ||
| 271 | 8) | ||
| 272 | |||
| 273 | ((eq (coding-system-type coding) 'charset) | ||
| 274 | (dolist (elt (mapcar | ||
| 275 | #'(lambda (x) | ||
| 276 | (let ((dim (charset-dimension x)) | ||
| 277 | (code-space (get-charset-property x :code-space))) | ||
| 278 | (cons (aref code-space (* (1- dim) 2)) | ||
| 279 | (aref code-space (1+ (* (1- dim) 2)))))) | ||
| 280 | (coding-system-get coding :charset-list))) | ||
| 281 | (let ((from (max (car elt) 128)) | ||
| 282 | (to (cdr elt))) | ||
| 283 | (while (<= from to) | ||
| 284 | (define-key keymap | ||
| 285 | (vector from) 'encoded-kbd-self-insert-charset) | ||
| 286 | (setq from (1+ from))))) | ||
| 287 | 8) | ||
| 288 | |||
| 289 | ((eq (coding-system-type coding) 'iso-2022) | ||
| 290 | (let ((flags (coding-system-get coding :flags)) | ||
| 291 | (designation (coding-system-get coding :designation))) | ||
| 292 | (if (memq 'locking-shift flags) | ||
| 293 | nil ; Don't support locking-shift. | ||
| 294 | (setq encoded-kbd-iso2022-designations (make-vector 4 nil) | ||
| 295 | encoded-kbd-iso2022-invocations (make-vector 3 nil)) | ||
| 296 | (dotimes (i 4) | ||
| 297 | (if (aref designation i) | ||
| 298 | (if (charsetp (aref designation i)) | ||
| 299 | (aset encoded-kbd-iso2022-designations | ||
| 300 | i (aref designation i)) | ||
| 301 | (if (charsetp (car-safe (aref designation i))) | ||
| 302 | (aset encoded-kbd-iso2022-designations | ||
| 303 | i (car (aref designation i))))))) | ||
| 304 | (aset encoded-kbd-iso2022-invocations 0 0) | ||
| 305 | (if (aref encoded-kbd-iso2022-designations 1) | ||
| 306 | (aset encoded-kbd-iso2022-invocations 1 1)) | ||
| 307 | (when (memq 'designation flags) | ||
| 308 | (define-key encoded-kbd-mode-map "\e" 'encoded-kbd-iso2022-esc-prefix) | ||
| 309 | (define-key keymap "\e" 'encoded-kbd-iso2022-esc-prefix)) | ||
| 310 | (when (or (aref designation 2) (aref designation 3)) | ||
| 311 | (define-key keymap | ||
| 312 | [?\216] 'encoded-kbd-iso2022-single-shift) | ||
| 313 | (define-key keymap | ||
| 314 | [?\217] 'encoded-kbd-iso2022-single-shift)) | ||
| 315 | (or (eq (aref designation 0) 'ascii) | ||
| 316 | (dotimes (i 96) | ||
| 317 | (define-key keymap | ||
| 318 | (vector (+ 32 i)) 'encoded-kbd-self-insert-iso2022-7bit))) | ||
| 319 | (if (memq '7-bit flags) | ||
| 320 | t | ||
| 321 | (dotimes (i 96) | ||
| 322 | (define-key keymap | ||
| 323 | (vector (+ 160 i)) 'encoded-kbd-self-insert-iso2022-8bit)) | ||
| 324 | 8)))) | ||
| 325 | |||
| 326 | ((eq (coding-system-type coding) 4) ; CCL-base | ||
| 327 | (let ((valid-codes (or (coding-system-get coding :valid) | ||
| 328 | '((128 . 255)))) | ||
| 329 | elt from to valid) | ||
| 330 | (while valid-codes | ||
| 331 | (setq elt (car valid-codes) valid-codes (cdr valid-codes)) | ||
| 332 | (if (consp elt) | ||
| 333 | (setq from (car elt) to (cdr elt)) | ||
| 334 | (setq from (setq to elt))) | ||
| 335 | (while (<= from to) | ||
| 336 | (if (>= from 128) | ||
| 337 | (define-key keymap | ||
| 338 | (vector from) 'encoded-kbd-self-insert-ccl)) | ||
| 339 | (setq from (1+ from)))) | ||
| 340 | 8)) | ||
| 341 | |||
| 342 | ((eq (coding-system-type coding) 'utf-8) | ||
| 343 | (let ((i #xC0)) | ||
| 344 | (while (< i 256) | ||
| 345 | (define-key keymap | ||
| 346 | (vector i) 'encoded-kbd-self-insert-utf-8) | ||
| 347 | (setq i (1+ i)))) | ||
| 348 | 8) | ||
| 349 | |||
| 350 | (t | ||
| 351 | nil))) | ||
| 352 | |||
| 353 | ;;;###autoload | ||
| 354 | (defun encoded-kbd-setup-display (terminal) | ||
| 355 | "Set up a `input-decode-map' for `keyboard-coding-system' on TERMINAL. | ||
| 356 | |||
| 357 | TERMINAL may be a terminal id, a frame, or nil for the selected frame's terminal." | ||
| 358 | (let ((frame (if (framep terminal) | ||
| 359 | terminal | ||
| 360 | (car (frames-on-display-list terminal))))) | ||
| 361 | (when frame | ||
| 362 | (with-selected-frame frame | ||
| 363 | ;; Remove any previous encoded-kb keymap from input-decode-map. | ||
| 364 | (let ((m input-decode-map) | ||
| 365 | (child nil)) | ||
| 366 | (while (keymapp m) | ||
| 367 | (if (not (equal (keymap-prompt m) "encoded-kb")) | ||
| 368 | (progn | ||
| 369 | (setq child m) | ||
| 370 | (setq m (keymap-parent m))) | ||
| 371 | ;; We've found an encoded-kb map, but maybe the prompt we get | ||
| 372 | ;; is really inherited from the encoded-kb map. | ||
| 373 | (let (mp) | ||
| 374 | (while (and (keymapp (setq mp (keymap-parent m))) | ||
| 375 | (equal (keymap-prompt mp) "encoded-kb")) | ||
| 376 | (setq child m) | ||
| 377 | (setq m mp)) | ||
| 378 | ;; (assert (equal (keymap-prompt m) "encoded-kb")) | ||
| 379 | ;; (assert (eq mp (keymap-parent m))) | ||
| 380 | ;; (assert (not (and (keymapp mp) | ||
| 381 | ;; (equal (keymap-prompt mp) "encoded-kb")))) | ||
| 382 | ;; (assert (eq m (if child | ||
| 383 | ;; (keymap-parent child) input-decode-map))) | ||
| 384 | ;; We can finally do the actual removal. | ||
| 385 | (if child | ||
| 386 | (set-keymap-parent child mp) | ||
| 387 | (setq input-decode-map mp)) | ||
| 388 | (setq m mp)))))) | ||
| 389 | |||
| 390 | (if (keyboard-coding-system) | ||
| 391 | ;; We are turning on Encoded-kbd mode. | ||
| 392 | (let ((coding (keyboard-coding-system)) | ||
| 393 | (keymap (make-sparse-keymap "encoded-kb")) | ||
| 394 | (cim (current-input-mode)) | ||
| 395 | result) | ||
| 396 | ;; Place `keymap' as the immediate parent of input-decode-map | ||
| 397 | ;; rather than on top, so that later `define-key' on | ||
| 398 | ;; input-decode-map don't end up accidentally changing our | ||
| 399 | ;; part of the keymap, which would lead to bugs when/if we later | ||
| 400 | ;; on remove that part. | ||
| 401 | (set-keymap-parent keymap (keymap-parent input-decode-map)) | ||
| 402 | (set-keymap-parent input-decode-map keymap) | ||
| 403 | (unless (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode) | ||
| 404 | (set-terminal-parameter nil 'encoded-kbd-saved-input-mode | ||
| 405 | (nth 2 cim))) | ||
| 406 | (setq result (and coding (encoded-kbd-setup-keymap keymap coding))) | ||
| 407 | (if result | ||
| 408 | (when (and (eq result 8) | ||
| 409 | (memq (nth 2 cim) '(t nil))) | ||
| 410 | (set-input-meta-mode 'use-8th-bit)) | ||
| 411 | (set-terminal-parameter | ||
| 412 | nil 'encoded-kbd-saved-input-meta-mode nil) | ||
| 413 | (error "Unsupported coding system in Encoded-kbd mode: %S" | ||
| 414 | coding))) | ||
| 415 | ;; We are turning off Encoded-kbd mode. | ||
| 416 | (let ((old (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode))) | ||
| 417 | (when (and old (not (equal (nth 2 (current-input-mode)) old))) | ||
| 418 | (set-input-meta-mode old)) | ||
| 419 | (set-terminal-parameter | ||
| 420 | nil 'encoded-kbd-saved-input-meta-mode nil)))))) | ||
| 421 | |||
| 422 | (provide 'encoded-kb) | ||
| 423 | |||
| 424 | ;; arch-tag: 76f0f9b3-65e7-45c3-b692-59509a87ad44 | ||
| 425 | ;;; encoded-kb.el ends here | ||