Mercurial > emacs
annotate lisp/emulation/keypad.el @ 45641:d1d326ead96d
*** empty log message ***
author | Pavel Janík <Pavel@Janik.cz> |
---|---|
date | Wed, 05 Jun 2002 05:17:06 +0000 |
parents | eb7082dc04a0 |
children | 66857c2230b6 |
rev | line source |
---|---|
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1 ;;; keypad.el --- simplified keypad bindings |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
2 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
3 ;; Copyright (C) 2002 Free Software Foundation, Inc. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
4 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
5 ;; Author: Kim F. Storm <storm@cua.dk> |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
6 ;; Keywords: keyboard convenience |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
7 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
8 ;; This file is part of GNU Emacs. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
9 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
10 ;; GNU Emacs is free software; you can redistribute it and/or modify |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
11 ;; it under the terms of the GNU General Public License as published by |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
13 ;; any later version. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
14 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
15 ;; GNU Emacs is distributed in the hope that it will be useful, |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
18 ;; GNU General Public License for more details. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
19 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
20 ;; You should have received a copy of the GNU General Public License |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
23 ;; Boston, MA 02111-1307, USA. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
24 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
25 ;;; Commentary: |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
26 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
27 ;; The keypad package allows easy binding of the keypad keys to |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
28 ;; various commonly used sets of commands. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
29 ;; |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
30 ;; With the following setup, the keypad can be used for numeric data |
45296 | 31 ;; entry when NumLock is off, and to give numeric prefix arguments to |
32 ;; emacs commands, when NumLock on on. | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
33 ;; |
45296 | 34 ;; keypad-setup => Plain Numeric Keypad |
35 ;; keypad-numlock-setup => Prefix numeric args | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
36 ;; |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
37 ;; +--------+--------+--------+ |
45296 | 38 ;; | M-7 | M-8 | M-9 | <- numlock on |
39 ;; | 7 | 8 | 9 | <- numlock off | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
40 ;; +--------+--------+--------+ |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
41 ;; | M-4 | M-5 | M-6 | |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
42 ;; | 4 | 5 | 6 | |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
43 ;; +--------+--------+--------+ |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
44 ;; | M-1 | M-2 | M-3 | |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
45 ;; | 1 | 2 | 3 | |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
46 ;; +--------+--------+--------+ |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
47 ;; | M-0 | M-- | |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
48 ;; | 0 | . | |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
49 ;; +-----------------+--------+ |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
50 |
45296 | 51 ;; The following keypad setup is used for navigation together with |
52 ;; modes like cua-mode which uses shifted movement keys to extend the | |
53 ;; region. | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
54 ;; |
45296 | 55 ;; keypad-setup => Cursor keys |
56 ;; keypad-shifted-setup => Shifted cursor keys | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
57 ;; |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
58 ;; +--------+--------+--------+ |
45296 | 59 ;; | S-home | S-up | S-PgUp | <- shifted, numlock off |
60 ;; | Home | up | PgUp | <- unshifted, numlock off | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
61 ;; +--------+--------+--------+ |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
62 ;; | S-left |S-space |S-right | |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
63 ;; | left | space | right | |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
64 ;; +--------+--------+--------+ |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
65 ;; | S-end | S-down | S-PgDn | |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
66 ;; | end | down | PgDn | |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
67 ;; +--------+--------+--------+ |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
68 ;; | S-insert |S-delete| |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
69 ;; | insert | delete | |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
70 ;; +-----------------+--------+ |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
71 |
45296 | 72 ;; The following setup binds the unshifted keypad keys to plain |
73 ;; numeric keys when NumLock is either on or off, but the decimal key | |
74 ;; produces either a . (NumLock off) or a , (NumLock on). This is | |
75 ;; useful for e.g. Danish users where the decimal separator is a | |
76 ;; comma. | |
77 ;; | |
78 ;; keypad-setup => Plain Numeric Keypad | |
79 ;; keypad-numlock-setup => Numeric Keypad with Decimal key: , | |
80 ;; | |
81 ;; +--------+--------+--------+ | |
82 ;; | 7 | 8 | 9 | <- numlock on | |
83 ;; | 7 | 8 | 9 | <- numlock off | |
84 ;; +--------+--------+--------+ | |
85 ;; | 4 | 5 | 6 | | |
86 ;; | 4 | 5 | 6 | | |
87 ;; +--------+--------+--------+ | |
88 ;; | 1 | 2 | 3 | | |
89 ;; | 1 | 2 | 3 | | |
90 ;; +--------+--------+--------+ | |
91 ;; | 0 | , | | |
92 ;; | 0 | . | | |
93 ;; +-----------------+--------+ | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
94 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
95 ;;; Code: |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
96 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
97 (provide 'keypad) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
98 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
99 ;;; Customization |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
100 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
101 ;;;###autoload |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
102 (defcustom keypad-setup nil |
45296 | 103 "Specifies the keypad setup for unshifted keypad keys when NumLock is off. |
104 When selecting the plain numeric keypad setup, the character returned by the | |
105 decimal key must be specified." | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
106 :set (lambda (symbol value) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
107 (if value |
45296 | 108 (keypad-setup value nil nil value))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
109 :initialize 'custom-initialize-default |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
110 :link '(emacs-commentary-link "keypad.el") |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
111 :version "21.4" |
45296 | 112 :type '(choice (const :tag "Plain numeric keypad" numeric) |
113 (character :tag "Numeric Keypad with Decimal Key" | |
114 :match (lambda (widget value) (integerp value)) | |
115 :value ?.) | |
116 (const :tag "Numeric prefix arguments" prefix) | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
117 (const :tag "Cursor keys" cursor) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
118 (const :tag "Shifted cursor keys" S-cursor) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
119 (const :tag "Remove bindings" none) |
45296 | 120 (other :tag "Keep existing bindings" nil)) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
121 :group 'keyboard) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
122 |
45296 | 123 ;;;###autoload |
124 (defcustom keypad-numlock-setup nil | |
125 "Specifies the keypad setup for unshifted keypad keys when NumLock is on. | |
126 When selecting the plain numeric keypad setup, the character returned by the | |
127 decimal key must be specified." | |
128 :set (lambda (symbol value) | |
129 (if value | |
130 (keypad-setup value t nil value))) | |
131 :initialize 'custom-initialize-default | |
132 :link '(emacs-commentary-link "keypad.el") | |
133 :version "21.4" | |
134 :type '(choice (const :tag "Plain numeric keypad" numeric) | |
135 (character :tag "Numeric Keypad with Decimal Key" | |
136 :match (lambda (widget value) (integerp value)) | |
137 :value ?.) | |
138 (const :tag "Numeric prefix arguments" prefix) | |
139 (const :tag "Cursor keys" cursor) | |
140 (const :tag "Shifted cursor keys" S-cursor) | |
141 (const :tag "Remove bindings" none) | |
142 (other :tag "Keep existing bindings" nil)) | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
143 :group 'keyboard) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
144 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
145 ;;;###autoload |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
146 (defcustom keypad-shifted-setup nil |
45296 | 147 "Specifies the keypad setup for shifted keypad keys when NumLock is off. |
148 When selecting the plain numeric keypad setup, the character returned by the | |
149 decimal key must be specified." | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
150 :set (lambda (symbol value) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
151 (if value |
45296 | 152 (keypad-setup value nil t value))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
153 :initialize 'custom-initialize-default |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
154 :link '(emacs-commentary-link "keypad.el") |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
155 :version "21.4" |
45296 | 156 :type '(choice (const :tag "Plain numeric keypad" numeric) |
157 (character :tag "Numeric Keypad with Decimal Key" | |
158 :match (lambda (widget value) (integerp value)) | |
159 :value ?.) | |
160 (const :tag "Numeric prefix arguments" prefix) | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
161 (const :tag "Cursor keys" cursor) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
162 (const :tag "Shifted cursor keys" S-cursor) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
163 (const :tag "Remove bindings" none) |
45296 | 164 (other :tag "Keep existing bindings" nil)) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
165 :group 'keyboard) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
166 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
167 ;;;###autoload |
45296 | 168 (defcustom keypad-numlock-shifted-setup nil |
169 "Specifies the keypad setup for shifted keypad keys when NumLock is off. | |
170 When selecting the plain numeric keypad setup, the character returned by the | |
171 decimal key must be specified." | |
172 :set (lambda (symbol value) | |
173 (if value | |
174 (keypad-setup value t t value))) | |
175 :initialize 'custom-initialize-default | |
176 :link '(emacs-commentary-link "keypad.el") | |
177 :version "21.4" | |
178 :type '(choice (const :tag "Plain numeric keypad" numeric) | |
179 (character :tag "Numeric Keypad with Decimal Key" | |
180 :match (lambda (widget value) (integerp value)) | |
181 :value ?.) | |
182 (const :tag "Numeric prefix arguments" prefix) | |
183 (const :tag "Cursor keys" cursor) | |
184 (const :tag "Shifted cursor keys" S-cursor) | |
185 (const :tag "Remove bindings" none) | |
186 (other :tag "Keep existing bindings" nil)) | |
187 :group 'keyboard) | |
188 | |
189 | |
190 ;;;###autoload | |
191 (defun keypad-setup (setup &optional numlock shift decimal) | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
192 "Set keypad bindings in function-key-map according to SETUP. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
193 If optional second argument NUMLOCK is non-nil, the NumLock On bindings |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
194 are changed. Otherwise, the NumLock Off bindings are changed. |
45296 | 195 If optional third argument SHIFT is non-nil, the shifted keypad |
196 keys are bound. | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
197 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
198 Setup Binding |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
199 ------------------------------------------------------------- |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
200 'prefix Command prefix argument, i.e. M-0 .. M-9 and M-- |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
201 'S-cursor Bind shifted keypad keys to the shifted cursor movement keys. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
202 'cursor Bind keypad keys to the cursor movement keys. |
45296 | 203 'numeric Plain numeric keypad, i.e. 0 .. 9 and . (or DECIMAL arg) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
204 'none Removes all bindings for keypad keys in function-key-map. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
205 |
45296 | 206 If SETUP is 'numeric and the optional fourth argument DECIMAL is non-nil, |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
207 the decimal key on the keypad is mapped to DECIMAL instead of `.'" |
45296 | 208 (let* ((i 0) |
209 (var (cond | |
210 ((and (not numlock) (not shift)) 'keypad-setup) | |
211 ((and (not numlock) shift) 'keypad-shifted-setup) | |
212 ((and numlock (not shift)) 'keypad-numlock-setup) | |
213 ((and numlock shift) 'keypad-numlock-shifted-setup))) | |
214 (kp (cond | |
215 ((eq var 'keypad-setup) | |
216 [kp-delete kp-insert kp-end kp-down kp-next kp-left | |
217 kp-space kp-right kp-home kp-up kp-prior]) | |
218 ((eq var 'keypad-shifted-setup) | |
219 [S-kp-decimal S-kp-0 S-kp-1 S-kp-2 S-kp-3 S-kp-4 | |
220 S-kp-5 S-kp-6 S-kp-7 S-kp-8 S-kp-9]) | |
221 ((eq var 'keypad-numlock-setup) | |
222 [kp-decimal kp-0 kp-1 kp-2 kp-3 kp-4 | |
223 kp-5 kp-6 kp-7 kp-8 kp-9]) | |
224 ((eq var 'keypad-numlock-shifted-setup) | |
225 [S-kp-delete S-kp-insert S-kp-end S-kp-down S-kp-next S-kp-left | |
226 S-kp-space S-kp-right S-kp-home S-kp-up S-kp-prior]))) | |
227 (bind | |
228 (cond | |
229 ((or (eq setup 'numeric) | |
230 (char-valid-p setup)) | |
231 (if (eq decimal 'numeric) | |
232 (setq decimal nil)) | |
233 (vector (or decimal ?.) ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9)) | |
234 ((eq setup 'prefix) | |
235 [?\M-- ?\M-0 ?\M-1 ?\M-2 ?\M-3 ?\M-4 | |
236 ?\M-5 ?\M-6 ?\M-7 ?\M-8 ?\M-9]) | |
237 ((eq setup 'cursor) | |
238 [delete insert end down next left | |
239 space right home up prior]) | |
240 ((eq setup 'S-cursor) | |
241 [S-delete S-insert S-end S-down S-next S-left | |
242 S-space S-right S-home S-up S-prior]) | |
243 ((eq setup 'none) | |
244 nil) | |
245 (t | |
246 (signal 'error (list "Unknown keypad setup: " setup)))))) | |
247 | |
248 (set var setup) | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
249 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
250 ;; Bind the keys in KP list to BIND list in function-key-map. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
251 ;; If BIND is nil, all bindings for the keys are removed. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
252 (if (not (boundp 'function-key-map)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
253 (setq function-key-map (make-sparse-keymap))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
254 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
255 (while (< i 11) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
256 (define-key function-key-map (vector (aref kp i)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
257 (if bind (vector (aref bind i)))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
258 (setq i (1+ i))))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
259 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
260 ;;; keypad.el ends here |