Mercurial > emacs
comparison lisp/term/internal.el @ 97666:ed4b9c6c72c8
(msdos-key-remapping-map): New variable. Move here all the special keys we
will be remapping via local-function-key-map.
(msdos-setup-keyboard): New function.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 23 Aug 2008 17:00:57 +0000 |
parents | c3309dba6542 |
children | a0f0ccc831a1 |
comparison
equal
deleted
inserted
replaced
97665:8e20ddb5288c | 97666:ed4b9c6c72c8 |
---|---|
23 ;;; Commentary: | 23 ;;; Commentary: |
24 | 24 |
25 ;;; Code: | 25 ;;; Code: |
26 | 26 |
27 ;; --------------------------------------------------------------------------- | 27 ;; --------------------------------------------------------------------------- |
28 ;; keyboard setup -- that's simple! | 28 (defvar msdos-key-remapping-map |
29 (set-input-mode nil nil 0) | 29 (let ((map (make-sparse-keymap))) |
30 (define-key local-function-key-map [backspace] "\177") ; Normal behavior for BS | 30 ;; keyboard setup -- that's simple! |
31 (define-key local-function-key-map [delete] "\C-d") ; ... and Delete | 31 (define-key map [backspace] "\177") ; Normal behavior for BS |
32 (define-key local-function-key-map [tab] [?\t]) | 32 (define-key map [delete] "\C-d") ; ... and Delete |
33 (define-key local-function-key-map [linefeed] [?\n]) | 33 (define-key map [tab] [?\t]) |
34 (define-key local-function-key-map [clear] [11]) | 34 (define-key map [linefeed] [?\n]) |
35 (define-key local-function-key-map [return] [13]) | 35 (define-key map [clear] [11]) |
36 (define-key local-function-key-map [escape] [?\e]) | 36 (define-key map [return] [13]) |
37 (define-key local-function-key-map [M-backspace] [?\M-\d]) | 37 (define-key map [escape] [?\e]) |
38 (define-key local-function-key-map [M-delete] [?\M-d]) | 38 (define-key map [M-backspace] [?\M-\d]) |
39 (define-key local-function-key-map [M-tab] [?\M-\t]) | 39 (define-key map [M-delete] [?\M-d]) |
40 (define-key local-function-key-map [M-linefeed] [?\M-\n]) | 40 (define-key map [M-tab] [?\M-\t]) |
41 (define-key local-function-key-map [M-clear] [?\M-\013]) | 41 (define-key map [M-linefeed] [?\M-\n]) |
42 (define-key local-function-key-map [M-return] [?\M-\015]) | 42 (define-key map [M-clear] [?\M-\013]) |
43 (define-key local-function-key-map [M-escape] [?\M-\e])) | 43 (define-key map [M-return] [?\M-\015]) |
44 (define-key map [M-escape] [?\M-\e]) | |
45 map) | |
46 "Keymap for remapping special keys on MS-DOS keyboard.") | |
47 | |
48 ;; These tell read-char how to convert these special chars to ASCII. | |
44 (put 'backspace 'ascii-character 127) | 49 (put 'backspace 'ascii-character 127) |
45 (put 'delete 'ascii-character 127) | 50 (put 'delete 'ascii-character 127) |
46 (put 'tab 'ascii-character ?\t) | 51 (put 'tab 'ascii-character ?\t) |
47 (put 'linefeed 'ascii-character ?\n) | 52 (put 'linefeed 'ascii-character ?\n) |
48 (put 'clear 'ascii-character 12) | 53 (put 'clear 'ascii-character 12) |
49 (put 'return 'ascii-character 13) | 54 (put 'return 'ascii-character 13) |
50 (put 'escape 'ascii-character ?\e) | 55 (put 'escape 'ascii-character ?\e) |
56 | |
57 (defun msdos-setup-keyboard (frame) | |
58 "Setup `local-function-key-map' for MS-DOS keyboard." | |
59 ;; Don't do this twice on the same display, or it would break | |
60 ;; normal-erase-is-backspace-mode. | |
61 (unless (terminal-parameter frame 'msdos-setup-keyboard) | |
62 ;; Map certain keypad keys into ASCII characters that people usually expect. | |
63 (with-selected-frame frame | |
64 (let ((map (copy-keymap msdos-key-remapping-map))) | |
65 (set-keymap-parent map (keymap-parent local-function-key-map)) | |
66 (set-keymap-parent local-function-key-map map))) | |
67 (set-terminal-parameter frame 'msdos-setup-keyboard t)) | |
68 (set-input-mode nil nil 0)) | |
51 | 69 |
52 ;; ---------------------------------------------------------------------- | 70 ;; ---------------------------------------------------------------------- |
53 ;; DOS display setup | 71 ;; DOS display setup |
54 ;; ================= | 72 ;; ================= |
55 ;; | 73 ;; |
692 (let* ((desc (cdr (assq dos-codepage cjk-codepages-alist))) | 710 (let* ((desc (cdr (assq dos-codepage cjk-codepages-alist))) |
693 (lang (car desc)) | 711 (lang (car desc)) |
694 (coding (car (cdr desc))) | 712 (coding (car (cdr desc))) |
695 coding-dos coding-unix) | 713 coding-dos coding-unix) |
696 (if (null desc) | 714 (if (null desc) |
697 (dos-cpNNN-setup dos-codepage) | 715 (ignore) ; (dos-cpNNN-setup dos-codepage)) FIXME |
698 ;; We've got one of the Far-Eastern codepages which support | 716 ;; We've got one of the Far-Eastern codepages which support |
699 ;; MULE native coding systems directly. | 717 ;; MULE native coding systems directly. |
700 (setq coding-dos (intern (format "%s-dos" coding)) | 718 (setq coding-dos (intern (format "%s-dos" coding)) |
701 coding-unix (intern (format "%s-unix" coding))) | 719 coding-unix (intern (format "%s-unix" coding))) |
702 (set-language-environment lang) | 720 (set-language-environment lang) |
704 (setq file-name-coding-system coding-unix) | 722 (setq file-name-coding-system coding-unix) |
705 (set-terminal-coding-system | 723 (set-terminal-coding-system |
706 (setq default-terminal-coding-system coding-unix)) | 724 (setq default-terminal-coding-system coding-unix)) |
707 ;; Assume they support non-ASCII Latin characters like the IBM | 725 ;; Assume they support non-ASCII Latin characters like the IBM |
708 ;; codepage 437 does. | 726 ;; codepage 437 does. |
709 (IT-display-table-setup "cp437") | 727 ;(IT-display-table-setup "cp437") |
710 ;; It's time: too many input methods in leim/quail produce | 728 ;; It's time: too many input methods in leim/quail produce |
711 ;; Unicode characters. Let the user see them. | 729 ;; Unicode characters. Let the user see them. |
712 (IT-setup-unicode-display) | 730 ;(IT-setup-unicode-display) |
713 (prefer-coding-system coding-dos) | 731 (prefer-coding-system coding-dos) |
714 (if default-enable-multibyte-characters | 732 (if default-enable-multibyte-characters |
715 (setq unibyte-display-via-language-environment t)) | 733 (setq unibyte-display-via-language-environment t)) |
716 ))) | 734 ))) |
717 | 735 |
718 ;; We want to delay the terminal and other codepage-related setup | |
719 ;; until after the terminal is set and user's .emacs is processed, | |
720 ;; because people might define their `dos-codepage-setup-hook' there. | |
721 (add-hook 'term-setup-hook 'dos-codepage-setup) | |
722 | |
723 ;; In multibyte mode, we want unibyte buffers to be displayed using | |
724 ;; the terminal coding system, so that they display correctly on the | |
725 ;; DOS terminal; in unibyte mode we want to see all 8-bit characters | |
726 ;; verbatim. In both cases, we want the entire range of 8-bit | |
727 ;; characters to arrive at our display code verbatim. | |
728 (standard-display-8bit 127 255) | |
729 | |
730 ;; arch-tag: eea04c06-7311-4b5a-b531-3c1be1b070af | 736 ;; arch-tag: eea04c06-7311-4b5a-b531-3c1be1b070af |
731 ;;; internal.el ends here | 737 ;;; internal.el ends here |