From 28a90c44b4f5009470b6d2ecbea3b9c6e5fa5180 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 22 Oct 2009 19:31:43 +0000 Subject: [PATCH] * 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. --- lisp/ChangeLog | 5 +++++ lisp/simple.el | 30 +++++++++++++----------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5e77cb43175..3fa53ded61e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,10 @@ 2009-10-22 Stefan Monnier + * 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. + * minibuffer.el (completion-table-with-terminator): Allow to specify the terminator-regexp. diff --git a/lisp/simple.el b/lisp/simple.el index 34107edf432..ed9f57fc773 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -6415,31 +6415,27 @@ See also `normal-erase-is-backspace'." (let* ((bindings `(([M-delete] [M-backspace]) ([C-M-delete] [C-M-backspace]) - (,esc-map - [C-delete] [C-backspace]))) + ([?\e C-delete] [?\e C-backspace]))) (old-state (lookup-key local-function-key-map [delete]))) (if enabled (progn (define-key local-function-key-map [delete] [?\C-d]) (define-key local-function-key-map [kp-delete] [?\C-d]) - (define-key local-function-key-map [backspace] [?\C-?])) + (define-key local-function-key-map [backspace] [?\C-?]) + (dolist (b bindings) + ;; Not sure if input-decode-map is really right, but + ;; keyboard-translate-table (used below) only works + ;; for integer events, and key-translation-table is + ;; global (like the global-map, used earlier). + (define-key input-decode-map (car b) nil) + (define-key input-decode-map (cadr b) nil))) (define-key local-function-key-map [delete] [?\C-?]) (define-key local-function-key-map [kp-delete] [?\C-?]) - (define-key local-function-key-map [backspace] [?\C-?])) - - ;; Maybe swap bindings of C-delete and C-backspace, etc. - (unless (equal old-state (lookup-key local-function-key-map [delete])) - (dolist (binding bindings) - (let ((map global-map)) - (when (keymapp (car binding)) - (setq map (car binding) binding (cdr binding))) - (let* ((key1 (nth 0 binding)) - (key2 (nth 1 binding)) - (binding1 (lookup-key map key1)) - (binding2 (lookup-key map key2))) - (define-key map key1 binding2) - (define-key map key2 binding1))))))) + (define-key local-function-key-map [backspace] [?\C-?]) + (dolist (b bindings) + (define-key input-decode-map (car b) (cadr b)) + (define-key input-decode-map (cadr b) (car b)))))) (t (if enabled (progn -- 2.39.2