home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / msdos / demacs / lisp / term / pc98.el < prev    next >
Encoding:
Text File  |  1991-12-12  |  6.6 KB  |  201 lines

  1. ;; pc98.el: PC9801 cursor key and function key mapping
  2. ;;
  3. ;; Edition History:
  4. ;; 1.1 91/11/20 Halca.HIRANO creation
  5. ;; 1.3 91/11/27 Halca.Hirano pc98-assign-special-key, ESC _ -> ESC O, DEL=^?
  6. ;;
  7.  
  8. ;; Copyright (C) 1991 Free Software Foundation, Inc.
  9.  
  10. ;; This file is part of GNU Emacs.
  11.  
  12. ;; GNU Emacs is distributed in the hope that it will be useful,
  13. ;; but WITHOUT ANY WARRANTY.  No author or distributor
  14. ;; accepts responsibility to anyone for the consequences of using it
  15. ;; or for whether it serves any particular purpose or works at all,
  16. ;; unless he says so in writing.  Refer to the GNU Emacs General Public
  17. ;; License for full details.
  18.  
  19. ;; Everyone is granted permission to copy, modify and redistribute
  20. ;; GNU Emacs, but only under the conditions described in the
  21. ;; GNU Emacs General Public License.   A copy of this license is
  22. ;; supposed to have been given to you along with GNU Emacs so you
  23. ;; can know your rights and responsibilities.  It should be in a
  24. ;; file named COPYING.  Among other things, the copyright notice
  25. ;; and this notice must be preserved on all copies.
  26.  
  27. ;;
  28. ;; codes generated by PC98 keyboard
  29. ;;
  30. ;; ESC O A          F1
  31. ;;  ......
  32. ;; ESC O O          F15
  33. ;;
  34. ;; ESC O P          shift F1
  35. ;;  ......
  36. ;; ESC O ^          shift F15
  37. ;;
  38. ;; ESC O _          ctrl F1
  39. ;;  ......
  40. ;; ESC O m          ctrl F15
  41. ;;
  42. ;; ESC O n        ROLLUP
  43. ;; ESC O o        ROLLDOWN
  44. ;; ESC O p        INS
  45. ;; ^?            DEL
  46. ;; ESC O r        up arrow
  47. ;; ESC O s        left arrow
  48. ;; ESC O t        right arrow
  49. ;; ESC O u        down arrow
  50. ;; ESC O v        CLR
  51. ;; ESC O w        HELP
  52. ;; ESC O x             HOME
  53.  
  54.  
  55. (defvar pc98-map (make-keymap)
  56.   "The pc98-map maps the function keys on the PC9801 keyboard.")
  57.  
  58. ;; function keys
  59.  
  60. (define-key pc98-map "A" 'help-for-help)        ; f.1
  61. (define-key pc98-map "P" 'describe-mode)        ; s-f.1
  62. (define-key pc98-map "_" 'describe-key)            ; c-f.1
  63.  
  64. (define-key pc98-map "B" 'other-window)            ; f.2
  65. (define-key pc98-map "Q" 'switch-to-buffer)        ; s-f.2
  66. (define-key pc98-map "`" 'list-buffers)            ; c-f.2
  67.  
  68. (define-key pc98-map "C" 'delete-other-windows)        ; f.3
  69. (define-key pc98-map "R" 'delete-window)        ; s-f.3
  70. (define-key pc98-map "a" 'scroll-other-window)        ; c-f.3
  71.  
  72. (define-key pc98-map "D" 'split-window-vertically)    ; f.4
  73. (define-key pc98-map "S" 'enlarge-window)        ; s-f.4
  74. (define-key pc98-map "b" 'shrink-window)        ; c-f.4
  75.  
  76. (define-key pc98-map "E" 'split-window-horizontally)    ; f.5
  77. (define-key pc98-map "T" 'enlarge-window-horizontally)    ; s-f.5
  78. (define-key pc98-map "c" 'shrink-window-horizontally)    ; c-f.5
  79.  
  80. (define-key pc98-map "F" 'copy-region-as-kill)        ; f.6
  81. (define-key pc98-map "U" 'kill-region)            ; s-f.6
  82. (define-key pc98-map "d" 'yank)                ; lc-f.6
  83.  
  84. (define-key pc98-map "G" 'goto-line)            ; f.7
  85. (define-key pc98-map "V" 'isearch-forward)        ; s-f.7
  86. (define-key pc98-map "e" 'query-replace)        ; c-f.7
  87.  
  88. (define-key pc98-map "H" 'find-file)            ; f.8
  89. (define-key pc98-map "W" 'save-buffer)            ; s-f.8
  90. (define-key pc98-map "f" 'write-file)            ; c-f.8
  91.  
  92. (define-key pc98-map "I" 'dired)            ; f.9
  93. (define-key pc98-map "X" 'compile)            ; s-f.9
  94. (define-key pc98-map "g" 'repeat-complex-command)    ; c-f.9
  95.  
  96. (define-key pc98-map "J" 'shell-command)        ; f.10
  97. (define-key pc98-map "Y" 'suspend-emacs)        ; s-f.10
  98. (define-key pc98-map "h" 'save-buffers-kill-emacs)    ; c-f.10
  99.  
  100. ; definition for f.11 - f.15 are commented out for speed
  101.  
  102. ;(define-key pc98-map "K" 'unbound-key)        ; f.11
  103. ;(define-key pc98-map "Z" 'unbound-key)        ; s-f.11
  104. ;(define-key pc98-map "i" 'unbound-key)        ; c-f.11
  105.  
  106. ;(define-key pc98-map "L" 'unbound-key)        ; f.12
  107. ;(define-key pc98-map "[" 'unbound-key)        ; s-f.12
  108. ;(define-key pc98-map "j" 'unbound-key)        ; c-f.12
  109.  
  110. ;(define-key pc98-map "M" 'unbound-key)        ; f.13
  111. ;(define-key pc98-map "\\" 'unbound-key)    ; s-f.13
  112. ;(define-key pc98-map "k" 'unbound-key)        ; c-f.13
  113.  
  114. ;(define-key pc98-map "N" 'unbound-key)        ; f.14
  115. ;(define-key pc98-map "]" 'unbound-key)        ; s-f.14
  116. ;(define-key pc98-map "l" 'unbound-key)        ; c-f.14
  117.  
  118. ;(define-key pc98-map "O" 'unbound-key)        ; f.15
  119. ;(define-key pc98-map "^" 'unbound-key)        ; s-f.15
  120. ;(define-key pc98-map "m" 'unbound-key)        ; c-f.15
  121.  
  122. ;; cursor keys
  123. (define-key pc98-map "n" 'scroll-up)                ; ROLLUP
  124. (define-key pc98-map "o" 'scroll-down)            ; ROLLDOWN
  125. (define-key pc98-map "p" 'set-mark-command)        ; INS
  126. ; now DEL generates ^?
  127. ;(define-key pc98-map "q" 'delete-backward-char)        ; DEL
  128. (define-key pc98-map "r" 'previous-line)        ; up arrow
  129. (define-key pc98-map "s" 'backward-char)        ; left arrow
  130. (define-key pc98-map "t" 'forward-char)            ; right arrow
  131. (define-key pc98-map "u" 'next-line)            ; down arrow
  132. (define-key pc98-map "v" 'recenter)            ; CLR
  133. (define-key pc98-map "w" 'help-for-help)        ; HELP
  134. (define-key pc98-map "x" 'beginning-of-buffer)         ; HOME
  135.  
  136. (define-key esc-map "O" pc98-map)
  137.  
  138. (defvar pc98-map-hooks nil
  139.   "List of forms to evaluate after setting pc98-map.")
  140.  
  141. (let ((hooks pc98-map-hooks))
  142.   (while hooks
  143.     (eval (car hooks))
  144.     (setq hooks (cdr hooks))))
  145.  
  146. ;;
  147. ;; function key label support functions
  148. ;;
  149. (defvar console-is-with-function-key-label nil
  150.  "If value is t, the console consists of emacs windows and function key label.")
  151.  
  152. (defun redraw-display-with-function-key-label ()
  153.   (redraw-display)
  154.   (put-function-key-label))
  155.  
  156. (defun recenter-with-function-key-label (&optional arg) "\
  157.   recenter and display function key label."
  158.   (interactive)
  159.   (recenter arg)
  160.   (put-function-key-label))
  161.  
  162. (defun setup-console-with-function-key-label ()
  163.   (delete-other-windows)
  164.   (enlarge-window 100)
  165.   (shrink-window 4)
  166.   (message "")
  167.   (redraw-display-with-function-key-label)
  168.   (send-string-to-terminal "\e[1;1f"))
  169.   
  170. (defun put-function-key-label ()
  171.   (save-excursion
  172.     (message "")
  173.     (send-string-to-terminal
  174.      (convert-string-kanji-code
  175. ;; You may find funny symbols. Don't worry these are Kanji characters.      
  176.       (format "\e[%d;1f\
  177.  |  F.1  |  F.2  |  F.3  |  F.4  |  F.5  |  F.6  | F.7 |  F.8  | F.9 | F.10   |\n\
  178.  |âwâïâv |æïê┌ô« |æSû╩ë╗ |ëíò¬èä |Åcò¬èä |âRâsü[ |ê┌ô« |âèü[âh |DIR  |âRâ}âôâh|\n\
  179. s|âéü[âh |æïÄwÆΦ |æïò┬ì╜ |ëíègæσ |Åcègæσ |âJâbâg |ÆTì⌡ |âZü[âu |MAKE |âVâFâï  |\n\
  180. c|î«ë≡Éα |æïêΩùù |æ╝æïô« |ëíÅkż |ÅcÅkż |âäâôâN |Æuè╖ |âëâCâg |îJò╘ |ÅIù╣    |\n" (- (screen-height) 3))
  181.       3 1)))
  182.   nil)
  183.  
  184. (defun erase-system-function-key-label ()
  185.  "Erase system function key label."
  186.   (send-string-to-terminal "\e[>1h"))
  187.  
  188. (defun appear-system-function-key-label ()
  189.  "Appear system function key label."
  190.   (send-string-to-terminal "\e[>1l"))
  191.  
  192.  
  193.  
  194. (if console-is-with-function-key-label
  195.     (progn
  196.       (global-set-key "\C-l" 'recenter-with-function-key-label)
  197.       (setup-console-with-function-key-label)))
  198.  
  199. (pc98-assign-special-key)        ; set function/cursor key string
  200.  
  201.