diff options
| author | Eli Zaretskii | 2001-05-04 10:02:56 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2001-05-04 10:02:56 +0000 |
| commit | 6d28be1ddd6500a1c80547f937173f63cdaf39e5 (patch) | |
| tree | f872573af33deb63b87294bc077a873c9307a2fb | |
| parent | fdea67e752f9da69f93333fe62c6dfb72e45e899 (diff) | |
| download | emacs-6d28be1ddd6500a1c80547f937173f63cdaf39e5.tar.gz emacs-6d28be1ddd6500a1c80547f937173f63cdaf39e5.zip | |
Bind c-electric-delete-forward to C-d and c-electric-backspace to DEL.
| -rw-r--r-- | lisp/progmodes/cc-mode.el | 30 |
1 files 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 @@ | |||
| 198 | ;; fill-paragraph-or-region. | 198 | ;; fill-paragraph-or-region. |
| 199 | (substitute-key-definition 'fill-paragraph-or-region 'c-fill-paragraph | 199 | (substitute-key-definition 'fill-paragraph-or-region 'c-fill-paragraph |
| 200 | c-mode-base-map global-map) | 200 | c-mode-base-map global-map) |
| 201 | ;; Caution! Enter here at your own risk. We are trying to support | 201 | ;; Bind the electric deletion functions to C-d and DEL. Emacs 21 |
| 202 | ;; several behaviors and it gets disgusting. :-( | 202 | ;; automatically maps the [delete] and [backspace] keys to these two |
| 203 | ;; | 203 | ;; depending on window system and user preferences. (In earlier |
| 204 | (if (boundp 'delete-key-deletes-forward) | 204 | ;; versions it's possible to do the same by using `function-key-map'.) |
| 205 | (progn | 205 | (define-key c-mode-base-map "\C-d" 'c-electric-delete-forward) |
| 206 | ;; In XEmacs 20 it is possible to sanely define both backward | 206 | (define-key c-mode-base-map "\177" 'c-electric-backspace) |
| 207 | ;; and forward deletion behavior under X separately (TTYs are | 207 | (when (boundp 'delete-key-deletes-forward) |
| 208 | ;; forever beyond hope, but who cares? XEmacs 20 does the | 208 | ;; In XEmacs 20 and later we fix the forward and backward deletion |
| 209 | ;; right thing with these too). | 209 | ;; behavior by binding the keysyms for the [delete] and |
| 210 | (define-key c-mode-base-map [delete] 'c-electric-delete) | 210 | ;; [backspace] keys directly, and use `delete-forward-p' or |
| 211 | (define-key c-mode-base-map [backspace] 'c-electric-backspace)) | 211 | ;; `delete-key-deletes-forward' to decide what [delete] should do. |
| 212 | ;; In XEmacs 19, Emacs 19, and Emacs 20, we use this to bind | 212 | (define-key c-mode-base-map [delete] 'c-electric-delete) |
| 213 | ;; backwards deletion behavior to DEL, which both Delete and | 213 | (define-key c-mode-base-map [backspace] 'c-electric-backspace)) |
| 214 | ;; Backspace get translated to. There's no way to separate this | ||
| 215 | ;; behavior in a clean way, so deal with it! Besides, it's been | ||
| 216 | ;; this way since the dawn of BOCM. | ||
| 217 | (define-key c-mode-base-map "\177" 'c-electric-backspace)) | ||
| 218 | ;; these are new keybindings, with no counterpart to BOCM | 214 | ;; these are new keybindings, with no counterpart to BOCM |
| 219 | (define-key c-mode-base-map "," 'c-electric-semi&comma) | 215 | (define-key c-mode-base-map "," 'c-electric-semi&comma) |
| 220 | (define-key c-mode-base-map "*" 'c-electric-star) | 216 | (define-key c-mode-base-map "*" 'c-electric-star) |