home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / lisp / term / news.el < prev    next >
Encoding:
Text File  |  1995-03-25  |  2.7 KB  |  85 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 XEmacs.
  5.  
  6. ;; XEmacs is free software; you can redistribute it and/or modify it
  7. ;; under the terms of the GNU General Public License as published by
  8. ;; the Free Software Foundation; either version 2, or (at your option)
  9. ;; any later version.
  10.  
  11. ;; XEmacs is distributed in the hope that it will be useful, but
  12. ;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. ;; General Public License for more details.
  15.  
  16. ;; You should have received a copy of the GNU General Public License
  17. ;; along with XEmacs; see the file COPYING.  If not, write to the Free
  18. ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. ;; This file effects a mapping from the raw escape sequences of various
  21. ;; keypad and function keys to the symbols used by emacs to represent
  22. ;; those keys.  The mapping from key symbol to the function performed
  23. ;; when that key is pressed is handled keyboard-independently by the file
  24. ;; ../keypad.el.
  25.  
  26. ;; Note that his file is also used under X11.  For this to work, the variable
  27. ;; names must not change from keyboard file to keyboard file, nor can the
  28. ;; structure of keypad-maps change.
  29.  
  30. (require 'keypad)
  31.  
  32. (defvar keypads nil
  33.   "Keypad and function keys keymap for Sony News machine.")
  34.  
  35. (defvar keypad-maps nil
  36.   "A list of strings sent by the keypad and function keys on the Sony News.
  37. There is an element for each unique prefix.  Each element is of the form
  38. (PREFIX map map ...), each map being (string . symbol).")
  39.  
  40. (setq keypad-maps '(("\eO"
  41.             ("P" . function-1)
  42.             ("Q" . function-2)
  43.             ("R" . function-3)
  44.             ("S" . function-4)
  45.             ("T" . function-5)
  46.             ("U" . function-6)
  47.             ("V" . function-7)
  48.             ("W" . function-8)
  49.             ("X" . function-9)
  50.             ("Y" . function-10)
  51.  
  52.             ("m" . keypad-subtract)
  53.             ("k" . keypad-add)
  54.             ("l" . keypad-comma)
  55.             ("n" . keypad-period)
  56.             ("M" . keypad-enter)
  57.  
  58.             ("p" . keypad-0)
  59.             ("q" . keypad-1)
  60.             ("r" . keypad-2)
  61.             ("s" . keypad-3)
  62.             ("t" . keypad-4)
  63.             ("u" . keypad-5)
  64.             ("v" . keypad-6)
  65.             ("w" . keypad-7)
  66.             ("x" . keypad-8)
  67.             ("y" . keypad-9)
  68.     
  69.                  ; These three strings are just made up.
  70.             ("a"    . execute)       ; enter
  71.             ("b"    . select)        ; nfer
  72.             ("c"    . cancel))))     ; xfer
  73.  
  74. (let ((pads keypad-maps))
  75.   (while pads
  76.     (unwind-protect
  77.     (let* ((prefix (car (car pads)))
  78.            (stringmap (cdr (car pads)))
  79.            (padmap (if (lookup-key global-map prefix)
  80.                (error "Keymap entry for keypad prefix already exisists")
  81.              (make-sparse-keymap))))
  82.       (define-key global-map prefix padmap)
  83.       (setup-terminal-keymap padmap stringmap))
  84.       (setq pads (cdr pads)))))
  85.