home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / lucid / lemacs-19.6 / lisp / term / news.el next >
Encoding:
Text File  |  1992-06-29  |  2.8 KB  |  86 lines

  1. ;; keypad and function key bindings for the Sony NEWS keyboard.
  2. ;; Copyright (C) 1989 Free Software Foundation, Inc.
  3.  
  4. ;; This file is part of GNU Emacs.
  5.  
  6. ;; GNU Emacs is distributed in the hope that it will be useful,
  7. ;; but WITHOUT ANY WARRANTY.  No author or distributor
  8. ;; accepts responsibility to anyone for the consequences of using it
  9. ;; or for whether it serves any particular purpose or works at all,
  10. ;; unless he says so in writing.  Refer to the GNU Emacs General Public
  11. ;; License for full details.
  12.  
  13. ;; Everyone is granted permission to copy, modify and redistribute
  14. ;; GNU Emacs, but only under the conditions described in the
  15. ;; GNU Emacs General Public License.   A copy of this license is
  16. ;; supposed to have been given to you along with GNU Emacs so you
  17. ;; can know your rights and responsibilities.  It should be in a
  18. ;; file named COPYING.  Among other things, the copyright notice
  19. ;; and this notice must be preserved on all copies.
  20.  
  21. ;; This file effects a mapping from the raw escape sequences of various
  22. ;; keypad and function keys to the symbols used by emacs to represent
  23. ;; those keys.  The mapping from key symbol to the function performed
  24. ;; when that key is pressed is handled keyboard-independently by the file
  25. ;; ../keypad.el.
  26.  
  27. ;; Note that his file is also used under X11.  For this to work, the variable
  28. ;; names must not change from keyboard file to keyboard file, nor can the
  29. ;; structure of keypad-maps change.
  30.  
  31. (require 'keypad)
  32.  
  33. (defvar keypads nil
  34.   "Keypad and function keys keymap for Sony News machine.")
  35.  
  36. (defvar keypad-maps nil
  37.   "A list of strings sent by the keypad and function keys on the Sony News.
  38. There is an element for each unique prefix.  Each element is of the form
  39. (PREFIX map map ...), each map being (string . symbol).")
  40.  
  41. (setq keypad-maps '(("\eO"
  42.             ("P" . function-1)
  43.             ("Q" . function-2)
  44.             ("R" . function-3)
  45.             ("S" . function-4)
  46.             ("T" . function-5)
  47.             ("U" . function-6)
  48.             ("V" . function-7)
  49.             ("W" . function-8)
  50.             ("X" . function-9)
  51.             ("Y" . function-10)
  52.  
  53.             ("m" . keypad-subtract)
  54.             ("k" . keypad-add)
  55.             ("l" . keypad-comma)
  56.             ("n" . keypad-period)
  57.             ("M" . keypad-enter)
  58.  
  59.             ("p" . keypad-0)
  60.             ("q" . keypad-1)
  61.             ("r" . keypad-2)
  62.             ("s" . keypad-3)
  63.             ("t" . keypad-4)
  64.             ("u" . keypad-5)
  65.             ("v" . keypad-6)
  66.             ("w" . keypad-7)
  67.             ("x" . keypad-8)
  68.             ("y" . keypad-9)
  69.     
  70.                  ; These three strings are just made up.
  71.             ("a"    . execute)       ; enter
  72.             ("b"    . select)        ; nfer
  73.             ("c"    . cancel))))     ; xfer
  74.  
  75. (let ((pads keypad-maps))
  76.   (while pads
  77.     (unwind-protect
  78.     (let* ((prefix (car (car pads)))
  79.            (stringmap (cdr (car pads)))
  80.            (padmap (if (lookup-key global-map prefix)
  81.                (error "Keymap entry for keypad prefix already exisists")
  82.              (make-sparse-keymap))))
  83.       (define-key global-map prefix padmap)
  84.       (setup-terminal-keymap padmap stringmap))
  85.       (setq pads (cdr pads)))))
  86.