annotate lisp/prim/keymap.el @ 44:8d2a9b52c682 r19-15prefinal

Import from CVS: tag r19-15prefinal
author cvs
date Mon, 13 Aug 2007 08:55:10 +0200
parents 0293115a14e9
children 131b0175ea99
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;; Keymap functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;; Copyright (C) 1993, 1994 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; You should have received a copy of the GNU General Public License
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
18 ;; along with XEmacs; see the file COPYING. If not, write to the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
19 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
20 ;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;;; Synched up with: FSF 19.28.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;;; Note: FSF does not have a file keymap.el. This stuff is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; in keymap.c.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;Prevent the \{...} documentation construct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;from mentioning keys that run this command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 (put 'undefined 'suppress-keymap t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (defun undefined ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (ding))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (defun suppress-keymap (map &optional nodigits)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 "Make MAP override all normally self-inserting keys to be undefined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 Normally, as an exception, digits and minus-sign are set to make prefix args,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 but optional second arg NODIGITS non-nil treats them like other chars."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (substitute-key-definition 'self-insert-command 'undefined map global-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (or nodigits
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (let ((string (make-string 1 ?0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (define-key map "-" 'negative-argument)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;; Make plain numbers do numeric args.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (while (<= (aref string 0) ?9)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (define-key map string 'digit-argument)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (aset string 0 (1+ (aref string 0)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (defun substitute-key-definition (olddef newdef keymap &optional oldmap prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 "Replace OLDDEF with NEWDEF for any keys in KEYMAP now defined as OLDDEF.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 In other words, OLDDEF is replaced with NEWDEF wherever it appears.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 Prefix keymaps are checked recursively. If optional fourth argument OLDMAP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 is specified, we redefine in KEYMAP as NEWDEF those chars which are defined
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 as OLDDEF in OLDMAP, unless that keybinding is already present in keymap.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 If optional fifth argument PREFIX is defined, then only those occurrences of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 OLDDEF found in keymaps accessible through the keymap bound to PREFIX in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 KEYMAP are redefined. See also `accessible-keymaps'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (let ((maps (accessible-keymaps (or oldmap keymap) prefix))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (shadowing (not (null oldmap)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 prefix map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (while maps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (setq prefix (car (car maps))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 map (cdr (car maps))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 maps (cdr maps))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;; Substitute in this keymap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (map-keymap #'(lambda (key binding)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (if (eq binding olddef)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 ;; The new bindings always go in KEYMAP even if we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 ;; found them in OLDMAP or one of it's children.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 ;; If KEYMAP will be shadowing OLDMAP, then do not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 ;; redefine the key if there is another binding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ;; in KEYMAP that will shadow OLDDEF.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (or (and shadowing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (lookup-key keymap key))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 ;; define-key will give an error if a prefix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 ;; of the key is already defined. Otherwise
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 ;; it will define the key in the map.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 ;; #### - Perhaps this should be protected?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (define-key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 keymap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (vconcat prefix (list key))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 newdef))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 ;; from Bill Dubuque <wgd@martigny.ai.mit.edu>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (defun insert-key-binding (key) ; modeled after describe-key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (interactive "kInsert command bound to key: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (let (defn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 ;; If the key typed was really a menu selection, grab the form out
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 ;; of the event object and intuit the function that would be called,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 ;; and describe that instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (if (and (vectorp key) (= 1 (length key))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (or (misc-user-event-p (aref key 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (eq (car-safe (aref key 0)) 'menu-selection)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (let ((event (aref key 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (setq defn (if (eventp event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (list (event-function event) (event-object event))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (cdr event)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (if (eq (car defn) 'eval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (setq defn (` (lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (, (car (cdr defn)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (if (eq (car-safe defn) 'call-interactively)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (setq defn (car (cdr defn))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (if (and (consp defn) (null (cdr defn)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (setq defn (car defn))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (setq defn (key-binding key)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (if (or (null defn) (integerp defn))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (error "%s is undefined" (key-description key))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (if (or (stringp defn) (vectorp defn))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (setq defn (key-binding defn))) ;; a keyboard macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (insert (format "%s" defn)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ;; from Bill Dubuque <wgd@martigny.ai.mit.edu>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (defun read-command-or-command-sexp (prompt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 "Read a command symbol or command sexp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 A command sexp is wrapped in an interactive lambda if needed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 Prompts with PROMPT."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 ;; Todo: it would be better if we could reject symbols that are not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 ;; commandp (as does 'read-command') but that is not easy to do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 ;; because we must supply arg4 = require-match = nil for sexp case.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (let ((result (car (read-from-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (completing-read prompt obarray 'commandp)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (if (and (consp result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (not (eq (car result) 'lambda)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (` (lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (, result)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 result)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (defun local-key-binding (keys)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 "Return the binding for command KEYS in current local keymap only.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 KEYS is a string, a vector of events, or a vector of key-description lists
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 as described in the documentation for the `define-key' function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 The binding is probably a symbol with a function definition; see
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 the documentation for `lookup-key' for more information."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (let ((map (current-local-map)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (if map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (lookup-key map keys)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (defun global-key-binding (keys)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 "Return the binding for command KEYS in current global keymap only.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 KEYS is a string or vector of events, a sequence of keystrokes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 The binding is probably a symbol with a function definition; see
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 the documentation for `lookup-key' for more information."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (lookup-key (current-global-map) keys))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 ;; from Bill Dubuque <wgd@martigny.ai.mit.edu>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (defun global-set-key (key command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 "Give KEY a global binding as COMMAND.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 COMMAND is a symbol naming an interactively-callable function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 KEY is a string, a vector of events, or a vector of key-description lists
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 as described in the documentation for the `define-key' function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 Note that if KEY has a local binding in the current buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 that local binding will continue to shadow any global binding."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 ;;(interactive "KSet key globally: \nCSet key %s to command: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (interactive (list (setq key (read-key-sequence "Set key globally: "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 ;; Command sexps are allowed here so that this arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 ;; may be supplied interactively via insert-key-binding.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (read-command-or-command-sexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (format "Set key %s to command: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (key-description key)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (define-key (current-global-map) key command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ;; from Bill Dubuque <wgd@martigny.ai.mit.edu>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (defun local-set-key (key command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 "Give KEY a local binding as COMMAND.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 COMMAND is a symbol naming an interactively-callable function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 KEY is a string, a vector of events, or a vector of key-description lists
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 as described in the documentation for the `define-key' function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 The binding goes in the current buffer's local map,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 which is shared with other buffers in the same major mode."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 ;;(interactive "KSet key locally: \nCSet key %s locally to command: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (interactive (list (setq key (read-key-sequence "Set key locally: "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 ;; Command sexps are allowed here so that this arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 ;; may be supplied interactively via insert-key-binding.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (read-command-or-command-sexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (format "Set key %s locally to command: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (key-description key)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (if (null (current-local-map))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (use-local-map (make-sparse-keymap)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (define-key (current-local-map) key command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (defun global-unset-key (key)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 "Remove global binding of KEY.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 KEY is a string, a vector of events, or a vector of key-description lists
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 as described in the documentation for the `define-key' function."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (interactive "kUnset key globally: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (global-set-key key nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (defun local-unset-key (key)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 "Remove local binding of KEY.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 KEY is a string, a vector of events, or a vector of key-description lists
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 as described in the documentation for the `define-key' function."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (interactive "kUnset key locally: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (if (current-local-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (define-key (current-local-map) key nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 ;; Yet more RMS brain-death.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (defun minor-mode-key-binding (key &optional accept-default)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 "Find the visible minor mode bindings of KEY.
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
205 Return an alist of pairs (MODENAME . BINDING), where MODENAME is
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 the symbol which names the minor mode binding KEY, and BINDING is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 KEY's definition in that mode. In particular, if KEY has no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 minor-mode bindings, return nil. If the first binding is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 non-prefix, all subsequent bindings will be omitted, since they would
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 be ignored. Similarly, the list doesn't include non-prefix bindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 that come after prefix bindings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 If optional argument ACCEPT-DEFAULT is non-nil, recognize default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 bindings; see the description of `lookup-key' for more details about this."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (let ((tail minor-mode-map-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 a s v)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (while tail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (setq a (car tail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 tail (cdr tail))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (and (consp a)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (symbolp (setq s (car a)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (boundp s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (symbol-value s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 ;; indirect-function deals with autoloadable keymaps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (setq v (indirect-function (cdr a)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (setq v (lookup-key v key accept-default))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 ;; Terminate loop, with v set to non-nil value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (setq tail nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 v))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (defun current-minor-mode-maps ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 "Return a list of keymaps for the minor modes of the current buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (let ((l '())
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (tail minor-mode-map-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 a s v)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (while tail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (setq a (car tail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 tail (cdr tail))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (and (consp a)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (symbolp (setq s (car a)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (boundp s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (symbol-value s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 ;; indirect-function deals with autoloadable keymaps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (setq v (indirect-function (cdr a)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (setq l (cons v l))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (nreverse l)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 ;;#### What a crock
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (defun define-prefix-command (name &optional mapvar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 "Define COMMAND as a prefix command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 A new sparse keymap is stored as COMMAND's function definition.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 If second optional argument MAPVAR is not specified,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 COMMAND's value (as well as its function definition) is set to the keymap.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 If a second optional argument MAPVAR is given and is not `t',
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 the map is stored as its value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 Regardless of MAPVAR, COMMAND's function-value is always set to the keymap."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (let ((map (make-sparse-keymap)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (set-keymap-name map name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (fset name map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (cond ((not mapvar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (set name map))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 ((eq mapvar 't)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (set mapvar map)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 ;;; Converting vectors of events to a read-equivalent form.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 ;;; This is used both by call-interactively (for the command history)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 ;;; and by macros.el (for saving keyboard macros to a file).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (defun events-to-keys (events &optional no-mice)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 "Given a vector of event objects, returns a vector of key descriptors,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 or a string (if they all fit in the ASCII range).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 Optional arg NO-MICE means that button events are not allowed."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (if (and events (symbolp events)) (setq events (vector events)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (cond ((stringp events)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 events)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 ((not (vectorp events))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (signal 'wrong-type-argument (list 'vectorp events)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 ((let* ((length (length events))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (string (make-string length 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 c ce
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (i 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (while (< i length)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (setq ce (aref events i))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (or (eventp ce) (setq ce (character-to-event ce)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 ;; Normalize `c' to `?c' and `(control k)' to `?\C-k'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 ;; By passing t for the `allow-meta' arg we could get kbd macros
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 ;; with meta in them to translate to the string form instead of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 ;; the list/symbol form; but I expect that would cause confusion,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 ;; so let's use the list/symbol form whenever there's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 ;; any ambiguity.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (setq c (event-to-character ce))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (if (and c
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 character-set-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (key-press-event-p ce))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (cond ((symbolp (event-key ce))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (if (get (event-key ce) character-set-property)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 ;; Don't use a string for `backspace' and `tab' to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 ;; avoid that unpleasant little ambiguity.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (setq c nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 ((and (= (event-modifier-bits ce) 1) ;control
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (integerp (event-key ce)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (let* ((te (character-to-event c)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (if (and (symbolp (event-key te))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (get (event-key te) character-set-property))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 ;; Don't "normalize" (control i) to tab
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 ;; to avoid the ambiguity in the other direction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (setq c nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (deallocate-event te)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (if c
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (aset string i c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (setq i length string nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (setq i (1+ i)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (let* ((length (length events))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (new (copy-sequence events))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 event mods key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (i 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (while (< i length)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (setq event (aref events i))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (cond ((key-press-event-p event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (setq mods (event-modifiers event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 key (event-key event))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (if (numberp key)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (setq key (intern (make-string 1 key))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (aset new i (if mods
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (nconc mods (cons key nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 key)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 ((misc-user-event-p event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (aset new i (list 'menu-selection
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (event-function event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (event-object event))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 ((or (button-press-event-p event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (button-release-event-p event))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (if no-mice
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 "Mouse events can't be saved in keyboard macros."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (setq mods (event-modifiers event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 key (intern (concat "button"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (event-button event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (if (button-release-event-p event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 "up" ""))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (aset new i (if mods
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (nconc mods (cons key nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 key)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 ((or (and event (symbolp event))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (and (consp event) (symbolp (car event))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (aset new i event))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (signal 'wrong-type-argument (list 'eventp event))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (setq i (1+ i)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 new))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 ;FSFmacs ####
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 ;;; Support keyboard commands to turn on various modifiers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 ;;; These functions -- which are not commands -- each add one modifier
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 ;;; to the following event.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 ;(defun event-apply-alt-modifier (ignore-prompt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 ; (vector (event-apply-modifier (read-event) 'alt 22 "A-")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 ;(defun event-apply-super-modifier (ignore-prompt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 ; (vector (event-apply-modifier (read-event) 'super 23 "s-")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 ;(defun event-apply-hyper-modifier (ignore-prompt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 ; (vector (event-apply-modifier (read-event) 'hyper 24 "H-")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 ;(defun event-apply-shift-modifier (ignore-prompt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 ; (vector (event-apply-modifier (read-event) 'shift 25 "S-")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 ;(defun event-apply-control-modifier (ignore-prompt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 ; (vector (event-apply-modifier (read-event) 'control 26 "C-")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 ;(defun event-apply-meta-modifier (ignore-prompt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 ; (vector (event-apply-modifier (read-event) 'meta 27 "M-")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 ;(defun event-apply-modifier (event symbol lshiftby prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 ; "Apply a modifier flag to event EVENT.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 ;SYMBOL is the name of this modifier, as a symbol.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 ;LSHIFTBY is the numeric value of this modifier, in keyboard events.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 ;PREFIX is the string that represents this modifier in an event type symbol."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 ; (if (numberp event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 ; (cond ((eq symbol 'control)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 ; (if (and (<= (downcase event) ?z)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 ; (>= (downcase event) ?a))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 ; (- (downcase event) ?a -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 ; (if (and (<= (downcase event) ?Z)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 ; (>= (downcase event) ?A))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 ; (- (downcase event) ?A -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 ; (logior (lsh 1 lshiftby) event))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 ; ((eq symbol 'shift)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 ; (if (and (<= (downcase event) ?z)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 ; (>= (downcase event) ?a))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 ; (upcase event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 ; (logior (lsh 1 lshiftby) event)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 ; (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 ; (logior (lsh 1 lshiftby) event)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 ; (if (memq symbol (event-modifiers event))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 ; event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 ; (let ((event-type (if (symbolp event) event (car event))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 ; (setq event-type (intern (concat prefix (symbol-name event-type))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 ; (if (symbolp event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 ; event-type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 ; (cons event-type (cdr event)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 ;(define-key function-key-map [?\C-x ?@ ?h] 'event-apply-hyper-modifier)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 ;(define-key function-key-map [?\C-x ?@ ?s] 'event-apply-super-modifier)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 ;(define-key function-key-map [?\C-x ?@ ?m] 'event-apply-meta-modifier)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 ;(define-key function-key-map [?\C-x ?@ ?a] 'event-apply-alt-modifier)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 ;(define-key function-key-map [?\C-x ?@ ?S] 'event-apply-shift-modifier)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 ;(define-key function-key-map [?\C-x ?@ ?c] 'event-apply-control-modifier)