annotate lisp/term/news.el @ 71:a35b34e246fe

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