Mercurial > emacs
comparison lisp/simple.el @ 105712:3f36e4d4d40c
* simple.el (normal-erase-is-backspace-mode): Use input-decode-map
rather than fiddling with global-map bindings, since it should only
affect per-terminal settings.
See http://bugs.gentoo.org/show_bug.cgi?id=289709.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 22 Oct 2009 19:31:43 +0000 |
parents | eb03599b0d98 |
children | 6b8dce5c4461 |
comparison
equal
deleted
inserted
replaced
105711:834e4fdbe74a | 105712:3f36e4d4d40c |
---|---|
6413 (cond ((or (memq window-system '(x w32 ns pc)) | 6413 (cond ((or (memq window-system '(x w32 ns pc)) |
6414 (memq system-type '(ms-dos windows-nt))) | 6414 (memq system-type '(ms-dos windows-nt))) |
6415 (let* ((bindings | 6415 (let* ((bindings |
6416 `(([M-delete] [M-backspace]) | 6416 `(([M-delete] [M-backspace]) |
6417 ([C-M-delete] [C-M-backspace]) | 6417 ([C-M-delete] [C-M-backspace]) |
6418 (,esc-map | 6418 ([?\e C-delete] [?\e C-backspace]))) |
6419 [C-delete] [C-backspace]))) | |
6420 (old-state (lookup-key local-function-key-map [delete]))) | 6419 (old-state (lookup-key local-function-key-map [delete]))) |
6421 | 6420 |
6422 (if enabled | 6421 (if enabled |
6423 (progn | 6422 (progn |
6424 (define-key local-function-key-map [delete] [?\C-d]) | 6423 (define-key local-function-key-map [delete] [?\C-d]) |
6425 (define-key local-function-key-map [kp-delete] [?\C-d]) | 6424 (define-key local-function-key-map [kp-delete] [?\C-d]) |
6426 (define-key local-function-key-map [backspace] [?\C-?])) | 6425 (define-key local-function-key-map [backspace] [?\C-?]) |
6426 (dolist (b bindings) | |
6427 ;; Not sure if input-decode-map is really right, but | |
6428 ;; keyboard-translate-table (used below) only works | |
6429 ;; for integer events, and key-translation-table is | |
6430 ;; global (like the global-map, used earlier). | |
6431 (define-key input-decode-map (car b) nil) | |
6432 (define-key input-decode-map (cadr b) nil))) | |
6427 (define-key local-function-key-map [delete] [?\C-?]) | 6433 (define-key local-function-key-map [delete] [?\C-?]) |
6428 (define-key local-function-key-map [kp-delete] [?\C-?]) | 6434 (define-key local-function-key-map [kp-delete] [?\C-?]) |
6429 (define-key local-function-key-map [backspace] [?\C-?])) | 6435 (define-key local-function-key-map [backspace] [?\C-?]) |
6430 | 6436 (dolist (b bindings) |
6431 ;; Maybe swap bindings of C-delete and C-backspace, etc. | 6437 (define-key input-decode-map (car b) (cadr b)) |
6432 (unless (equal old-state (lookup-key local-function-key-map [delete])) | 6438 (define-key input-decode-map (cadr b) (car b)))))) |
6433 (dolist (binding bindings) | |
6434 (let ((map global-map)) | |
6435 (when (keymapp (car binding)) | |
6436 (setq map (car binding) binding (cdr binding))) | |
6437 (let* ((key1 (nth 0 binding)) | |
6438 (key2 (nth 1 binding)) | |
6439 (binding1 (lookup-key map key1)) | |
6440 (binding2 (lookup-key map key2))) | |
6441 (define-key map key1 binding2) | |
6442 (define-key map key2 binding1))))))) | |
6443 (t | 6439 (t |
6444 (if enabled | 6440 (if enabled |
6445 (progn | 6441 (progn |
6446 (keyboard-translate ?\C-h ?\C-?) | 6442 (keyboard-translate ?\C-h ?\C-?) |
6447 (keyboard-translate ?\C-? ?\C-d)) | 6443 (keyboard-translate ?\C-? ?\C-d)) |