428
+ − 1 ;; keymap.el --- Keymap functions for XEmacs.
+ − 2
+ − 3 ;; Copyright (C) 1993-4, 1997 Free Software Foundation, Inc.
+ − 4 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
1333
+ − 5 ;; Copyright (C) 2003 Ben Wing.
428
+ − 6
+ − 7 ;; Maintainer: XEmacs Development Team
+ − 8 ;; Keywords: internals, dumped
+ − 9
+ − 10 ;; This file is part of XEmacs.
+ − 11
+ − 12 ;; XEmacs is free software; you can redistribute it and/or modify it
+ − 13 ;; under the terms of the GNU General Public License as published by
+ − 14 ;; the Free Software Foundation; either version 2, or (at your option)
+ − 15 ;; any later version.
+ − 16
+ − 17 ;; XEmacs is distributed in the hope that it will be useful, but
+ − 18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
+ − 19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ − 20 ;; General Public License for more details.
+ − 21
+ − 22 ;; You should have received a copy of the GNU General Public License
+ − 23 ;; along with XEmacs; see the file COPYING. If not, write to the
+ − 24 ;; Free Software Foundation, 59 Temple Place - Suite 330,
+ − 25 ;; Boston, MA 02111-1307, USA.
+ − 26
+ − 27 ;;; Synched up with: FSF 19.28.
+ − 28
+ − 29 ;;; Commentary:
+ − 30
+ − 31 ;; This file is dumped with XEmacs.
+ − 32
+ − 33 ;;; Note: FSF does not have a file keymap.el. This stuff is
+ − 34 ;;; in keymap.c.
+ − 35
+ − 36 ;Prevent the \{...} documentation construct
+ − 37 ;from mentioning keys that run this command.
+ − 38
+ − 39 ;;; Code:
+ − 40
1333
+ − 41 ;; BEGIN SYNCHED WITH FSF 21.2.
428
+ − 42
+ − 43 (defun undefined ()
+ − 44 (interactive)
+ − 45 (ding))
+ − 46
1333
+ − 47 ;Prevent the \{...} documentation construct
+ − 48 ;from mentioning keys that run this command.
+ − 49 (put 'undefined 'suppress-keymap t)
428
+ − 50
+ − 51 (defun suppress-keymap (map &optional nodigits)
+ − 52 "Make MAP override all normally self-inserting keys to be undefined.
+ − 53 Normally, as an exception, digits and minus-sign are set to make prefix args,
+ − 54 but optional second arg NODIGITS non-nil treats them like other chars."
+ − 55 (substitute-key-definition 'self-insert-command 'undefined map global-map)
+ − 56 (or nodigits
+ − 57 (let ((string (make-string 1 ?0)))
+ − 58 (define-key map "-" 'negative-argument)
+ − 59 ;; Make plain numbers do numeric args.
+ − 60 (while (<= (aref string 0) ?9)
+ − 61 (define-key map string 'digit-argument)
+ − 62 (incf (aref string 0))))))
+ − 63
1333
+ − 64 ;Unneeded in XEmacs (defvar key-substitution-in-progress nil
+ − 65
428
+ − 66 (defun substitute-key-definition (olddef newdef keymap &optional oldmap prefix)
+ − 67 "Replace OLDDEF with NEWDEF for any keys in KEYMAP now defined as OLDDEF.
+ − 68 In other words, OLDDEF is replaced with NEWDEF wherever it appears.
+ − 69 Prefix keymaps are checked recursively. If optional fourth argument OLDMAP
+ − 70 is specified, we redefine in KEYMAP as NEWDEF those chars which are defined
444
+ − 71 as OLDDEF in OLDMAP, unless that keybinding is already present in KEYMAP.
+ − 72 If optional fifth argument PREFIX is non-nil, then only those occurrences of
428
+ − 73 OLDDEF found in keymaps accessible through the keymap bound to PREFIX in
+ − 74 KEYMAP are redefined. See also `accessible-keymaps'."
+ − 75 (let ((maps (accessible-keymaps (or oldmap keymap) prefix))
+ − 76 (shadowing (not (null oldmap)))
+ − 77 prefix map)
+ − 78 (while maps
+ − 79 (setq prefix (car (car maps))
+ − 80 map (cdr (car maps))
+ − 81 maps (cdr maps))
+ − 82 ;; Substitute in this keymap
+ − 83 (map-keymap #'(lambda (key binding)
1333
+ − 84 (if (or (eq binding olddef)
+ − 85 ;; Compare with equal if definition is a key
+ − 86 ;; sequence. That is useful for operating on
+ − 87 ;; function-key-map.
+ − 88 (and (or (stringp binding) (vectorp binding))
+ − 89 (equal binding olddef)))
428
+ − 90 ;; The new bindings always go in KEYMAP even if we
+ − 91 ;; found them in OLDMAP or one of its children.
+ − 92 ;; If KEYMAP will be shadowing OLDMAP, then do not
+ − 93 ;; redefine the key if there is another binding
+ − 94 ;; in KEYMAP that will shadow OLDDEF.
+ − 95 (or (and shadowing
+ − 96 (lookup-key keymap key))
+ − 97 ;; define-key will give an error if a prefix
+ − 98 ;; of the key is already defined. Otherwise
+ − 99 ;; it will define the key in the map.
+ − 100 ;; #### - Perhaps this should be protected?
+ − 101 (define-key
+ − 102 keymap
+ − 103 (vconcat prefix (list key))
+ − 104 newdef))))
+ − 105 map)
+ − 106 )))
+ − 107
1333
+ − 108 ;; FSF garbage. They misguidedly tried to put menu entries into keymaps,
+ − 109 ;; and needed stuff like the following. Eventually they admitted defeat
+ − 110 ;; and switched to our method.
+ − 111
+ − 112 ; (defun define-key-after (keymap key definition &optional after)
+ − 113 ; "Add binding in KEYMAP for KEY => DEFINITION, right after AFTER's binding.
+ − 114 ; This is like `define-key' except that the binding for KEY is placed
+ − 115 ; just after the binding for the event AFTER, instead of at the beginning
+ − 116 ; of the map. Note that AFTER must be an event type (like KEY), NOT a command
+ − 117 ; \(like DEFINITION).
+ − 118 ;
+ − 119 ; If AFTER is t or omitted, the new binding goes at the end of the keymap.
+ − 120 ;
+ − 121 ; KEY must contain just one event type--that is to say, it must be a
+ − 122 ; string or vector of length 1, but AFTER should be a single event
+ − 123 ; type--a symbol or a character, not a sequence.
+ − 124 ;
+ − 125 ; Bindings are always added before any inherited map.
+ − 126 ;
+ − 127 ; The order of bindings in a keymap matters when it is used as a menu."
+ − 128
+ − 129 (defmacro kbd (keys)
+ − 130 "Convert KEYS to the internal Emacs key representation.
+ − 131 KEYS should be a string constant in the format used for
+ − 132 saving keyboard macros (see `insert-kbd-macro')."
+ − 133 (if (or (stringp keys)
+ − 134 (vectorp keys))
+ − 135 ;; #### need to move xemacs-base into the core!!!!!!
+ − 136 (declare-fboundp (read-kbd-macro keys))
+ − 137 `(declare-fboundp (read-kbd-macro ,keys))))
+ − 138
+ − 139 ;; END SYNCHED WITH FSF 21.2.
428
+ − 140
+ − 141 ;; This used to wrap forms into an interactive lambda. It is unclear
+ − 142 ;; to me why this is needed in this function. Anyway,
+ − 143 ;; `key-or-menu-binding' doesn't do it, so this function no longer
+ − 144 ;; does it, either.
+ − 145 (defun insert-key-binding (key) ; modeled after describe-key
+ − 146 "Insert the command bound to KEY."
+ − 147 (interactive "kInsert command bound to key: ")
+ − 148 (let ((defn (key-or-menu-binding key)))
+ − 149 (if (or (null defn) (integerp defn))
+ − 150 (error "%s is undefined" (key-description key))
+ − 151 (if (or (stringp defn) (vectorp defn))
+ − 152 (setq defn (key-binding defn))) ;; a keyboard macro
+ − 153 (insert (format "%s" defn)))))
+ − 154
+ − 155 (defun read-command-or-command-sexp (prompt)
+ − 156 "Read a command symbol or command sexp.
+ − 157 A command sexp is wrapped in an interactive lambda if needed.
+ − 158 Prompts with PROMPT."
+ − 159 ;; Todo: it would be better if we could reject symbols that are not
+ − 160 ;; commandp (as does 'read-command') but that is not easy to do
+ − 161 ;; because we must supply arg4 = require-match = nil for sexp case.
+ − 162 (let ((result (car (read-from-string
+ − 163 (completing-read prompt obarray 'commandp)))))
+ − 164 (if (and (consp result)
+ − 165 (not (eq (car result) 'lambda)))
+ − 166 `(lambda ()
+ − 167 (interactive)
+ − 168 ,result)
+ − 169 result)))
+ − 170
444
+ − 171 (defun local-key-binding (keys &optional accept-defaults)
428
+ − 172 "Return the binding for command KEYS in current local keymap only.
+ − 173 KEYS is a string, a vector of events, or a vector of key-description lists
+ − 174 as described in the documentation for the `define-key' function.
+ − 175 The binding is probably a symbol with a function definition; see
+ − 176 the documentation for `lookup-key' for more information."
+ − 177 (let ((map (current-local-map)))
+ − 178 (if map
444
+ − 179 (lookup-key map keys accept-defaults)
428
+ − 180 nil)))
+ − 181
444
+ − 182 (defun global-key-binding (keys &optional accept-defaults)
428
+ − 183 "Return the binding for command KEYS in current global keymap only.
+ − 184 KEYS is a string or vector of events, a sequence of keystrokes.
+ − 185 The binding is probably a symbol with a function definition; see
+ − 186 the documentation for `lookup-key' for more information."
444
+ − 187 (lookup-key (current-global-map) keys accept-defaults))
428
+ − 188
+ − 189 (defun global-set-key (key command)
+ − 190 "Give KEY a global binding as COMMAND.
+ − 191 COMMAND is a symbol naming an interactively-callable function.
+ − 192 KEY is a string, a vector of events, or a vector of key-description lists
+ − 193 as described in the documentation for the `define-key' function.
+ − 194 Note that if KEY has a local binding in the current buffer
+ − 195 that local binding will continue to shadow any global binding."
+ − 196 ;;(interactive "KSet key globally: \nCSet key %s to command: ")
+ − 197 (interactive (list (setq key (read-key-sequence "Set key globally: "))
+ − 198 ;; Command sexps are allowed here so that this arg
+ − 199 ;; may be supplied interactively via insert-key-binding.
+ − 200 (read-command-or-command-sexp
+ − 201 (format "Set key %s to command: "
+ − 202 (key-description key)))))
+ − 203 (define-key (current-global-map) key command)
+ − 204 nil)
+ − 205
+ − 206 (defun local-set-key (key command)
+ − 207 "Give KEY a local binding as COMMAND.
+ − 208 COMMAND is a symbol naming an interactively-callable function.
+ − 209 KEY is a string, a vector of events, or a vector of key-description lists
+ − 210 as described in the documentation for the `define-key' function.
+ − 211 The binding goes in the current buffer's local map,
+ − 212 which is shared with other buffers in the same major mode."
+ − 213 ;;(interactive "KSet key locally: \nCSet key %s locally to command: ")
+ − 214 (interactive (list (setq key (read-key-sequence "Set key locally: "))
+ − 215 ;; Command sexps are allowed here so that this arg
+ − 216 ;; may be supplied interactively via insert-key-binding.
+ − 217 (read-command-or-command-sexp
+ − 218 (format "Set key %s locally to command: "
+ − 219 (key-description key)))))
+ − 220 (if (null (current-local-map))
+ − 221 (use-local-map (make-sparse-keymap)))
+ − 222 (define-key (current-local-map) key command)
+ − 223 nil)
+ − 224
+ − 225 (defun global-unset-key (key)
+ − 226 "Remove global binding of KEY.
+ − 227 KEY is a string, a vector of events, or a vector of key-description lists
+ − 228 as described in the documentation for the `define-key' function."
+ − 229 (interactive "kUnset key globally: ")
+ − 230 (global-set-key key nil))
+ − 231
+ − 232 (defun local-unset-key (key)
+ − 233 "Remove local binding of KEY.
+ − 234 KEY is a string, a vector of events, or a vector of key-description lists
+ − 235 as described in the documentation for the `define-key' function."
+ − 236 (interactive "kUnset key locally: ")
+ − 237 (if (current-local-map)
+ − 238 (define-key (current-local-map) key nil)))
+ − 239
+ − 240
+ − 241 ;; FSF-inherited brain-death.
+ − 242 (defun minor-mode-key-binding (key &optional accept-default)
+ − 243 "Find the visible minor mode bindings of KEY.
+ − 244 Return an alist of pairs (MODENAME . BINDING), where MODENAME is
+ − 245 the symbol which names the minor mode binding KEY, and BINDING is
+ − 246 KEY's definition in that mode. In particular, if KEY has no
+ − 247 minor-mode bindings, return nil. If the first binding is a
+ − 248 non-prefix, all subsequent bindings will be omitted, since they would
+ − 249 be ignored. Similarly, the list doesn't include non-prefix bindings
+ − 250 that come after prefix bindings.
+ − 251
+ − 252 If optional argument ACCEPT-DEFAULT is non-nil, recognize default
+ − 253 bindings; see the description of `lookup-key' for more details about this."
+ − 254 (let ((tail minor-mode-map-alist)
+ − 255 a s v)
+ − 256 (while tail
+ − 257 (setq a (car tail)
+ − 258 tail (cdr tail))
+ − 259 (and (consp a)
+ − 260 (symbolp (setq s (car a)))
+ − 261 (boundp s)
+ − 262 (symbol-value s)
+ − 263 ;; indirect-function deals with autoloadable keymaps
+ − 264 (setq v (indirect-function (cdr a)))
+ − 265 (setq v (lookup-key v key accept-default))
+ − 266 ;; Terminate loop, with v set to non-nil value
+ − 267 (setq tail nil)))
+ − 268 v))
+ − 269
+ − 270
+ − 271 (defun current-minor-mode-maps ()
+ − 272 "Return a list of keymaps for the minor modes of the current buffer."
+ − 273 (let ((l '())
+ − 274 (tail minor-mode-map-alist)
+ − 275 a s v)
+ − 276 (while tail
+ − 277 (setq a (car tail)
+ − 278 tail (cdr tail))
+ − 279 (and (consp a)
+ − 280 (symbolp (setq s (car a)))
+ − 281 (boundp s)
+ − 282 (symbol-value s)
+ − 283 ;; indirect-function deals with autoloadable keymaps
+ − 284 (setq v (indirect-function (cdr a)))
+ − 285 (setq l (cons v l))))
+ − 286 (nreverse l)))
+ − 287
+ − 288
+ − 289 ;;#### What a crock
+ − 290 (defun define-prefix-command (name &optional mapvar)
+ − 291 "Define COMMAND as a prefix command.
+ − 292 A new sparse keymap is stored as COMMAND's function definition.
+ − 293 If second optional argument MAPVAR is not specified,
+ − 294 COMMAND's value (as well as its function definition) is set to the keymap.
+ − 295 If a second optional argument MAPVAR is given and is not `t',
+ − 296 the map is stored as its value.
+ − 297 Regardless of MAPVAR, COMMAND's function-value is always set to the keymap."
+ − 298 (let ((map (make-sparse-keymap name)))
+ − 299 (fset name map)
+ − 300 (cond ((not mapvar)
+ − 301 (set name map))
+ − 302 ((eq mapvar 't)
+ − 303 )
+ − 304 (t
+ − 305 (set mapvar map)))
+ − 306 name))
+ − 307
+ − 308
+ − 309 ;;; Converting vectors of events to a read-equivalent form.
+ − 310 ;;; This is used both by call-interactively (for the command history)
+ − 311 ;;; and by macros.el (for saving keyboard macros to a file).
+ − 312
+ − 313 ;; #### why does (events-to-keys [backspace]) return "\C-h"?
+ − 314 ;; BTW, this function is a mess, and macros.el does *not* use it, in
+ − 315 ;; spite of the above comment. `format-kbd-macro' is used to save
+ − 316 ;; keyboard macros to a file.
+ − 317 (defun events-to-keys (events &optional no-mice)
+ − 318 "Given a vector of event objects, returns a vector of key descriptors,
+ − 319 or a string (if they all fit in the ASCII range).
+ − 320 Optional arg NO-MICE means that button events are not allowed."
+ − 321 (if (and events (symbolp events)) (setq events (vector events)))
+ − 322 (cond ((stringp events)
+ − 323 events)
+ − 324 ((not (vectorp events))
+ − 325 (signal 'wrong-type-argument (list 'vectorp events)))
+ − 326 ((let* ((length (length events))
+ − 327 (string (make-string length 0))
+ − 328 c ce
+ − 329 (i 0))
+ − 330 (while (< i length)
+ − 331 (setq ce (aref events i))
+ − 332 (or (eventp ce) (setq ce (character-to-event ce)))
+ − 333 ;; Normalize `c' to `?c' and `(control k)' to `?\C-k'
+ − 334 ;; By passing t for the `allow-meta' arg we could get kbd macros
+ − 335 ;; with meta in them to translate to the string form instead of
+ − 336 ;; the list/symbol form; but I expect that would cause confusion,
+ − 337 ;; so let's use the list/symbol form whenever there's
+ − 338 ;; any ambiguity.
+ − 339 (setq c (event-to-character ce))
+ − 340 (if (and c
+ − 341 (key-press-event-p ce))
+ − 342 (cond ((symbolp (event-key ce))
2828
+ − 343 (if (get (event-key ce) 'character-of-keysym)
428
+ − 344 ;; Don't use a string for `backspace' and `tab' to
+ − 345 ;; avoid that unpleasant little ambiguity.
+ − 346 (setq c nil)))
+ − 347 ((and (= (event-modifier-bits ce) 1) ;control
+ − 348 (integerp (event-key ce)))
+ − 349 (let* ((te (character-to-event c)))
+ − 350 (if (and (symbolp (event-key te))
2828
+ − 351 (get (event-key te) 'character-of-keysym))
428
+ − 352 ;; Don't "normalize" (control i) to tab
+ − 353 ;; to avoid the ambiguity in the other direction
+ − 354 (setq c nil))
+ − 355 (deallocate-event te)))))
+ − 356 (if c
+ − 357 (aset string i c)
+ − 358 (setq i length string nil))
+ − 359 (setq i (1+ i)))
+ − 360 string))
+ − 361 (t
+ − 362 (let* ((length (length events))
+ − 363 (new (copy-sequence events))
+ − 364 event mods key
+ − 365 (i 0))
+ − 366 (while (< i length)
+ − 367 (setq event (aref events i))
+ − 368 (cond ((key-press-event-p event)
+ − 369 (setq mods (event-modifiers event)
+ − 370 key (event-key event))
+ − 371 (if (numberp key)
+ − 372 (setq key (intern (make-string 1 key))))
+ − 373 (aset new i (if mods
+ − 374 (nconc mods (cons key nil))
+ − 375 key)))
+ − 376 ((misc-user-event-p event)
+ − 377 (aset new i (list 'menu-selection
+ − 378 (event-function event)
+ − 379 (event-object event))))
+ − 380 ((or (button-press-event-p event)
+ − 381 (button-release-event-p event))
+ − 382 (if no-mice
+ − 383 (error
+ − 384 "Mouse events can't be saved in keyboard macros."))
+ − 385 (setq mods (event-modifiers event)
+ − 386 key (intern (format "button%d%s"
+ − 387 (event-button event)
+ − 388 (if (button-release-event-p event)
+ − 389 "up" ""))))
+ − 390 (aset new i (if mods
+ − 391 (nconc mods (cons key nil))
+ − 392 key)))
+ − 393 ((or (and event (symbolp event))
+ − 394 (and (consp event) (symbolp (car event))))
+ − 395 (aset new i event))
+ − 396 (t
+ − 397 (signal 'wrong-type-argument (list 'eventp event))))
+ − 398 (setq i (1+ i)))
+ − 399 new))))
+ − 400
+ − 401
+ − 402 (defun next-key-event ()
+ − 403 "Return the next available keyboard event."
+ − 404 (let (event)
+ − 405 (while (not (key-press-event-p (setq event (next-command-event))))
+ − 406 (dispatch-event event))
+ − 407 event))
+ − 408
+ − 409 (defun key-sequence-list-description (keys)
+ − 410 "Convert a key sequence KEYS to the full [(modifiers... key)...] form.
502
+ − 411 Argument KEYS can be in any form accepted by `define-key' function.
+ − 412 The output is always in a canonical form, meaning you can use this
+ − 413 function to determine if two key sequence specifications are equivalent
+ − 414 by comparing the respective outputs of this function using `equal'."
428
+ − 415 (let ((vec
502
+ − 416 (cond ((vectorp keys)
+ − 417 keys)
+ − 418 ((stringp keys)
+ − 419 (vconcat keys))
+ − 420 (t
+ − 421 (vector keys)))))
+ − 422 (flet ((event-to-list (ev)
+ − 423 (append (event-modifiers ev) (list (event-key ev)))))
+ − 424 (mapvector
+ − 425 #'(lambda (key)
+ − 426 (let* ((full-key
+ − 427 (cond ((key-press-event-p key)
+ − 428 (event-to-list key))
+ − 429 ((characterp key)
+ − 430 (event-to-list (character-to-event key)))
+ − 431 ((listp key)
+ − 432 (copy-sequence key))
+ − 433 (t
+ − 434 (list key))))
+ − 435 (keysym (car (last full-key))))
+ − 436 (if (characterp keysym)
+ − 437 (setcar (last full-key) (intern (char-to-string keysym))))
+ − 438 full-key))
+ − 439 vec))))
428
+ − 440
+ − 441
+ − 442 ;;; Support keyboard commands to turn on various modifiers.
+ − 443
+ − 444 ;;; These functions -- which are not commands -- each add one modifier
+ − 445 ;;; to the following event.
+ − 446
+ − 447 (defun event-apply-alt-modifier (ignore-prompt)
+ − 448 (event-apply-modifier 'alt))
+ − 449 (defun event-apply-super-modifier (ignore-prompt)
+ − 450 (event-apply-modifier 'super))
+ − 451 (defun event-apply-hyper-modifier (ignore-prompt)
+ − 452 (event-apply-modifier 'hyper))
+ − 453 (defun event-apply-shift-modifier (ignore-prompt)
+ − 454 (event-apply-modifier 'shift))
+ − 455 (defun event-apply-control-modifier (ignore-prompt)
+ − 456 (event-apply-modifier 'control))
+ − 457 (defun event-apply-meta-modifier (ignore-prompt)
+ − 458 (event-apply-modifier 'meta))
+ − 459
+ − 460 ;;; #### `key-translate-map' is ignored for now.
+ − 461 (defun event-apply-modifier (symbol)
+ − 462 "Return the next key event, with a modifier flag applied.
+ − 463 SYMBOL is the name of this modifier, as a symbol.
+ − 464 `function-key-map' is scanned for prefix bindings."
+ − 465 (let (events binding)
+ − 466 ;; read keystrokes scanning `function-key-map'
+ − 467 (while (keymapp
+ − 468 (setq binding
+ − 469 (lookup-key
+ − 470 function-key-map
+ − 471 (vconcat
+ − 472 (setq events
+ − 473 (append events (list (next-key-event)))))))))
+ − 474 (if binding ; found a binding
+ − 475 (progn
+ − 476 ;; allow for several modifiers
+ − 477 (if (and (symbolp binding) (fboundp binding))
+ − 478 (setq binding (funcall binding nil)))
+ − 479 (setq events (append binding nil))
+ − 480 ;; put remaining keystrokes back into input queue
+ − 481 (setq unread-command-events
+ − 482 (mapcar 'character-to-event (cdr events))))
+ − 483 (setq unread-command-events (cdr events)))
+ − 484 ;; add a modifier SYMBOL to the first keystroke or event
+ − 485 (vector
+ − 486 (append (list symbol)
+ − 487 (delq symbol
+ − 488 (aref (key-sequence-list-description (car events)) 0))))))
+ − 489
+ − 490 (defun synthesize-keysym (ignore-prompt)
+ − 491 "Read a sequence of keys, and returned the corresponding key symbol.
+ − 492 The characters must be from the [-_a-zA-Z0-9]. Reading is terminated
+ − 493 by RET (which is discarded)."
+ − 494 (let ((continuep t)
+ − 495 event char list)
+ − 496 (while continuep
+ − 497 (setq event (next-key-event))
+ − 498 (cond ((and (setq char (event-to-character event))
+ − 499 (or (memq char '(?- ?_))
+ − 500 (eq ?w (char-syntax char (standard-syntax-table)))))
+ − 501 ;; Advance a character.
+ − 502 (push char list))
+ − 503 ((or (memq char '(?\r ?\n))
+ − 504 (memq (event-key event) '(return newline)))
+ − 505 ;; Legal termination.
+ − 506 (setq continuep nil))
+ − 507 (char
+ − 508 ;; Illegal character.
+ − 509 (error "Illegal character in keysym: %c" char))
+ − 510 (t
+ − 511 ;; Illegal event.
+ − 512 (error "Event has no character equivalent: %s" event))))
+ − 513 (vector (intern (concat "" (nreverse list))))))
+ − 514
+ − 515 ;; This looks dirty. The following code should maybe go to another
+ − 516 ;; file, and `create-console-hook' should maybe default to nil.
+ − 517 (add-hook
+ − 518 'create-console-hook
+ − 519 #'(lambda (console)
+ − 520 (letf (((selected-console) console))
+ − 521 (define-key function-key-map [?\C-x ?@ ?h] 'event-apply-hyper-modifier)
+ − 522 (define-key function-key-map [?\C-x ?@ ?s] 'event-apply-super-modifier)
+ − 523 (define-key function-key-map [?\C-x ?@ ?m] 'event-apply-meta-modifier)
+ − 524 (define-key function-key-map [?\C-x ?@ ?S] 'event-apply-shift-modifier)
+ − 525 (define-key function-key-map [?\C-x ?@ ?c] 'event-apply-control-modifier)
+ − 526 (define-key function-key-map [?\C-x ?@ ?a] 'event-apply-alt-modifier)
+ − 527 (define-key function-key-map [?\C-x ?@ ?k] 'synthesize-keysym))))
+ − 528
+ − 529 ;;; keymap.el ends here