From 6d28be1ddd6500a1c80547f937173f63cdaf39e5 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 4 May 2001 10:02:56 +0000 Subject: [PATCH] Bind c-electric-delete-forward to C-d and c-electric-backspace to DEL. --- lisp/progmodes/cc-mode.el | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index a7e35a9c185..0ac23c85c27 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -198,23 +198,19 @@ ;; fill-paragraph-or-region. (substitute-key-definition 'fill-paragraph-or-region 'c-fill-paragraph c-mode-base-map global-map) - ;; Caution! Enter here at your own risk. We are trying to support - ;; several behaviors and it gets disgusting. :-( - ;; - (if (boundp 'delete-key-deletes-forward) - (progn - ;; In XEmacs 20 it is possible to sanely define both backward - ;; and forward deletion behavior under X separately (TTYs are - ;; forever beyond hope, but who cares? XEmacs 20 does the - ;; right thing with these too). - (define-key c-mode-base-map [delete] 'c-electric-delete) - (define-key c-mode-base-map [backspace] 'c-electric-backspace)) - ;; In XEmacs 19, Emacs 19, and Emacs 20, we use this to bind - ;; backwards deletion behavior to DEL, which both Delete and - ;; Backspace get translated to. There's no way to separate this - ;; behavior in a clean way, so deal with it! Besides, it's been - ;; this way since the dawn of BOCM. - (define-key c-mode-base-map "\177" 'c-electric-backspace)) + ;; Bind the electric deletion functions to C-d and DEL. Emacs 21 + ;; automatically maps the [delete] and [backspace] keys to these two + ;; depending on window system and user preferences. (In earlier + ;; versions it's possible to do the same by using `function-key-map'.) + (define-key c-mode-base-map "\C-d" 'c-electric-delete-forward) + (define-key c-mode-base-map "\177" 'c-electric-backspace) + (when (boundp 'delete-key-deletes-forward) + ;; In XEmacs 20 and later we fix the forward and backward deletion + ;; behavior by binding the keysyms for the [delete] and + ;; [backspace] keys directly, and use `delete-forward-p' or + ;; `delete-key-deletes-forward' to decide what [delete] should do. + (define-key c-mode-base-map [delete] 'c-electric-delete) + (define-key c-mode-base-map [backspace] 'c-electric-backspace)) ;; these are new keybindings, with no counterpart to BOCM (define-key c-mode-base-map "," 'c-electric-semi&comma) (define-key c-mode-base-map "*" 'c-electric-star) -- 2.39.5