aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2008-08-23 17:00:57 +0000
committerEli Zaretskii2008-08-23 17:00:57 +0000
commitd8dbc0d041e73f55c0a36bfc72a3ce5b9d5249b3 (patch)
tree475844655d010c3cde16d81b07dbe9b76b1b242c
parent8e96a98d3074e209d5b939bc828391139df15d32 (diff)
downloademacs-d8dbc0d041e73f55c0a36bfc72a3ce5b9d5249b3.tar.gz
emacs-d8dbc0d041e73f55c0a36bfc72a3ce5b9d5249b3.zip
(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.
-rw-r--r--lisp/term/internal.el68
1 files changed, 37 insertions, 31 deletions
diff --git a/lisp/term/internal.el b/lisp/term/internal.el
index 59b25864f69..7e7fc918602 100644
--- a/lisp/term/internal.el
+++ b/lisp/term/internal.el
@@ -25,22 +25,27 @@
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)
@@ -49,6 +54,19 @@
49(put 'return 'ascii-character 13) 54(put 'return 'ascii-character 13)
50(put 'escape 'ascii-character ?\e) 55(put 'escape 'ascii-character ?\e)
51 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))
69
52;; ---------------------------------------------------------------------- 70;; ----------------------------------------------------------------------
53;; DOS display setup 71;; DOS display setup
54;; ================= 72;; =================
@@ -694,7 +712,7 @@ list. You can (and should) also run it whenever the value of
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))
@@ -706,26 +724,14 @@ list. You can (and should) also run it whenever the value of
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