aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-10-09 05:05:57 +0000
committerStefan Monnier2007-10-09 05:05:57 +0000
commitaf162764274b84270d80109978e2f448ac416d18 (patch)
tree9f11f17d51009211d8ac0ebb4b29a0d23d476d63
parent4f4a84ec801ea0d62d32a1b5679def1e16d3f813 (diff)
downloademacs-af162764274b84270d80109978e2f448ac416d18.tar.gz
emacs-af162764274b84270d80109978e2f448ac416d18.zip
(xterm-alternatives-map): New map.
(terminal-init-xterm): Use it. Bind xterm-function-map in input-decode-map.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/term/xterm.el140
2 files changed, 84 insertions, 60 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 87747db0822..aa2a8235c32 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
12007-10-09 Stefan Monnier <monnier@iro.umontreal.ca> 12007-10-09 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * term/xterm.el (xterm-alternatives-map): New map.
4 (terminal-init-xterm): Use it.
5 Bind xterm-function-map in input-decode-map.
6
3 * term/x-win.el (x-alternatives-map): New var. 7 * term/x-win.el (x-alternatives-map): New var.
4 (x-setup-function-keys): Use it. 8 (x-setup-function-keys): Use it.
5 9
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index de206c159c7..13a453434a2 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -375,6 +375,81 @@
375 map) 375 map)
376 "Function key map overrides for xterm.") 376 "Function key map overrides for xterm.")
377 377
378(defvar xterm-alternatives-map
379 (let ((map (make-sparse-keymap)))
380 ;; The terminal initialization C code file might have initialized
381 ;; function keys F13->F60 from the termcap/terminfo information.
382 ;; On a PC-style keyboard these keys correspond to
383 ;; MODIFIER-FUNCTION_KEY, where modifier is S-, C, A-, C-S-. The code
384 ;; here substitutes the corresponding definitions in function-key-map.
385 ;; The mapping from escape sequences to Fn is done in input-decode-map
386 ;; whereas this here mapping is done in local-function-key-map so that
387 ;; bindings to f45 still work, in case your keyboard really has an f45
388 ;; key rather than C-S-f9.
389 (define-key map [f13] [S-f1])
390 (define-key map [f14] [S-f2])
391 (define-key map [f15] [S-f3])
392 (define-key map [f16] [S-f4])
393 (define-key map [f17] [S-f5])
394 (define-key map [f18] [S-f6])
395 (define-key map [f19] [S-f7])
396 (define-key map [f20] [S-f8])
397 (define-key map [f21] [S-f9])
398 (define-key map [f22] [S-f10])
399 (define-key map [f23] [S-f11])
400 (define-key map [f24] [S-f12])
401
402 (define-key map [f25] [C-f1])
403 (define-key map [f26] [C-f2])
404 (define-key map [f27] [C-f3])
405 (define-key map [f28] [C-f4])
406 (define-key map [f29] [C-f5])
407 (define-key map [f30] [C-f6])
408 (define-key map [f31] [C-f7])
409 (define-key map [f32] [C-f8])
410 (define-key map [f33] [C-f9])
411 (define-key map [f34] [C-f10])
412 (define-key map [f35] [C-f11])
413 (define-key map [f36] [C-f12])
414
415 (define-key map [f37] [C-S-f1])
416 (define-key map [f38] [C-S-f2])
417 (define-key map [f39] [C-S-f3])
418 (define-key map [f40] [C-S-f4])
419 (define-key map [f41] [C-S-f5])
420 (define-key map [f42] [C-S-f6])
421 (define-key map [f43] [C-S-f7])
422 (define-key map [f44] [C-S-f8])
423 (define-key map [f45] [C-S-f9])
424 (define-key map [f46] [C-S-f10])
425 (define-key map [f47] [C-S-f11])
426 (define-key map [f48] [C-S-f12])
427
428 (define-key map [f49] [A-f1])
429 (define-key map [f50] [A-f2])
430 (define-key map [f51] [A-f3])
431 (define-key map [f52] [A-f4])
432 (define-key map [f53] [A-f5])
433 (define-key map [f54] [A-f6])
434 (define-key map [f55] [A-f7])
435 (define-key map [f56] [A-f8])
436 (define-key map [f57] [A-f9])
437 (define-key map [f58] [A-f10])
438 (define-key map [f59] [A-f11])
439 (define-key map [f60] [A-f12])
440
441 ;; Map common bindings for wheel events. Again we do this in
442 ;; local-function-key-map rather than input-decode-map because we cannot
443 ;; be sure this is right, so if you really have a mouse-4 button rather
444 ;; than a wheel, you can bind it to whatever you want, to override
445 ;; this remapping.
446 (define-key map [*-mouse-4] [wheel-up])
447 (define-key map [*-mouse-5] [wheel-down])
448 (define-key map [*-mouse-6] [wheel-left])
449 (define-key map [*-mouse-7] [wheel-right])
450 map)
451 "Keymap of possible alternative meanings for some keys.")
452
378;; List of terminals for which modify-other-keys has been turned on. 453;; List of terminals for which modify-other-keys has been turned on.
379(defvar xterm-modify-other-keys-terminal-list nil) 454(defvar xterm-modify-other-keys-terminal-list nil)
380 455
@@ -387,72 +462,17 @@
387 (string-match "\\`rxvt" (getenv "COLORTERM" (selected-frame)))) 462 (string-match "\\`rxvt" (getenv "COLORTERM" (selected-frame))))
388 (tty-run-terminal-initialization (selected-frame) "rxvt") 463 (tty-run-terminal-initialization (selected-frame) "rxvt")
389 464
390 ;; The terminal initialization C code file might have initialized 465 (let ((map (copy-keymap xterm-alternatives-map)))
391 ;; function keys F13->F60 from the termcap/terminfo information. 466 (set-keymap-parent map (keymap-parent) local-function-key-map)
392 ;; On a PC-style keyboard these keys correspond to 467 (set-keymap-parent local-function-key-map map))
393 ;; MODIFIER-FUNCTION_KEY, where modifier is S-, C, A-, C-S-. The code
394 ;; here substitutes the corresponding definitions in function-key-map.
395 ;; This substitution is needed because if a key definition is found in
396 ;; function-key-map, there are no further lookups in other keymaps.
397 (substitute-key-definition [f13] [S-f1] local-function-key-map)
398 (substitute-key-definition [f14] [S-f2] local-function-key-map)
399 (substitute-key-definition [f15] [S-f3] local-function-key-map)
400 (substitute-key-definition [f16] [S-f4] local-function-key-map)
401 (substitute-key-definition [f17] [S-f5] local-function-key-map)
402 (substitute-key-definition [f18] [S-f6] local-function-key-map)
403 (substitute-key-definition [f19] [S-f7] local-function-key-map)
404 (substitute-key-definition [f20] [S-f8] local-function-key-map)
405 (substitute-key-definition [f21] [S-f9] local-function-key-map)
406 (substitute-key-definition [f22] [S-f10] local-function-key-map)
407 (substitute-key-definition [f23] [S-f11] local-function-key-map)
408 (substitute-key-definition [f24] [S-f12] local-function-key-map)
409
410 (substitute-key-definition [f25] [C-f1] local-function-key-map)
411 (substitute-key-definition [f26] [C-f2] local-function-key-map)
412 (substitute-key-definition [f27] [C-f3] local-function-key-map)
413 (substitute-key-definition [f28] [C-f4] local-function-key-map)
414 (substitute-key-definition [f29] [C-f5] local-function-key-map)
415 (substitute-key-definition [f30] [C-f6] local-function-key-map)
416 (substitute-key-definition [f31] [C-f7] local-function-key-map)
417 (substitute-key-definition [f32] [C-f8] local-function-key-map)
418 (substitute-key-definition [f33] [C-f9] local-function-key-map)
419 (substitute-key-definition [f34] [C-f10] local-function-key-map)
420 (substitute-key-definition [f35] [C-f11] local-function-key-map)
421 (substitute-key-definition [f36] [C-f12] local-function-key-map)
422
423 (substitute-key-definition [f37] [C-S-f1] local-function-key-map)
424 (substitute-key-definition [f38] [C-S-f2] local-function-key-map)
425 (substitute-key-definition [f39] [C-S-f3] local-function-key-map)
426 (substitute-key-definition [f40] [C-S-f4] local-function-key-map)
427 (substitute-key-definition [f41] [C-S-f5] local-function-key-map)
428 (substitute-key-definition [f42] [C-S-f6] local-function-key-map)
429 (substitute-key-definition [f43] [C-S-f7] local-function-key-map)
430 (substitute-key-definition [f44] [C-S-f8] local-function-key-map)
431 (substitute-key-definition [f45] [C-S-f9] local-function-key-map)
432 (substitute-key-definition [f46] [C-S-f10] local-function-key-map)
433 (substitute-key-definition [f47] [C-S-f11] local-function-key-map)
434 (substitute-key-definition [f48] [C-S-f12] local-function-key-map)
435
436 (substitute-key-definition [f49] [A-f1] local-function-key-map)
437 (substitute-key-definition [f50] [A-f2] local-function-key-map)
438 (substitute-key-definition [f51] [A-f3] local-function-key-map)
439 (substitute-key-definition [f52] [A-f4] local-function-key-map)
440 (substitute-key-definition [f53] [A-f5] local-function-key-map)
441 (substitute-key-definition [f54] [A-f6] local-function-key-map)
442 (substitute-key-definition [f55] [A-f7] local-function-key-map)
443 (substitute-key-definition [f56] [A-f8] local-function-key-map)
444 (substitute-key-definition [f57] [A-f9] local-function-key-map)
445 (substitute-key-definition [f58] [A-f10] local-function-key-map)
446 (substitute-key-definition [f59] [A-f11] local-function-key-map)
447 (substitute-key-definition [f60] [A-f12] local-function-key-map)
448 468
449 (let ((map (copy-keymap xterm-function-map))) 469 (let ((map (copy-keymap xterm-function-map)))
450 470
451 ;; Use inheritance to let the main keymap override those defaults. 471 ;; Use inheritance to let the main keymap override those defaults.
452 ;; This way we don't override terminfo-derived settings or settings 472 ;; This way we don't override terminfo-derived settings or settings
453 ;; made in the .emacs file. 473 ;; made in the .emacs file.
454 (set-keymap-parent map (keymap-parent local-function-key-map)) 474 (set-keymap-parent map (keymap-parent input-decode-map))
455 (set-keymap-parent local-function-key-map map))) 475 (set-keymap-parent input-decode map)))
456 476
457 (xterm-register-default-colors) 477 (xterm-register-default-colors)
458 ;; This recomputes all the default faces given the colors we've just set up. 478 ;; This recomputes all the default faces given the colors we've just set up.