From d25cc9a9b8c09d90b138f78e12854fac30b98409 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Fri, 22 Dec 2000 13:18:19 +0000 Subject: [PATCH] (delete-key-deletes-forward-mode): Simplify. Also backspace key combinations, depending on delete-key-deletes-forward. --- lisp/simple.el | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 7987ab217b3..d7fab489621 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4037,16 +4037,26 @@ For more details, see `delete-key-deletes-forward'." (cond ((or (memq window-system '(x w32 mac pc)) (memq system-type '(ms-dos windows-nt))) - (if delete-key-deletes-forward - (progn - (define-key global-map [delete] 'delete-char) - (define-key global-map [C-delete] 'kill-word) - (define-key esc-map [C-delete] 'kill-sexp) - (define-key global-map [C-M-delete] 'kill-sexp)) - (define-key esc-map [C-delete] 'backward-kill-sexp) - (define-key global-map [C-M-delete] 'backward-kill-sexp) - (define-key global-map [C-delete] 'backward-kill-word) - (define-key global-map [delete] 'delete-backward-char))) + (let ((bindings + `(([delete] [backspace] delete-char delete-backward-char) + ([C-delete] [C-backspace] kill-word backward-kill-word) + ([M-delete] [M-backspace] kill-word backward-kill-word) + ([C-M-delete] [C-M-backspace] kill-sexp backward-kill-sexp) + (,esc-map + [C-delete] [C-backspace] kill-sexp backward-kill-sexp)))) + (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 (nth 2 binding)) + (binding2 (nth 3 binding))) + (unless delete-key-deletes-forward + (let ((temp binding1)) + (setq binding1 binding2 binding2 temp))) + (define-key map key1 binding1) + (define-key map key2 binding2)))))) (t (if delete-key-deletes-forward (progn -- 2.39.2