[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Keybindings for () and kill-region
From: |
collger |
Subject: |
Re: Keybindings for () and kill-region |
Date: |
24 Feb 2007 06:36:39 -0800 |
User-agent: |
G2/1.0 |
On Feb 19, 12:28 pm, "Noah Tye" <n...@tyes.us> wrote:
> I've rebound C-w to backward-kill-word. What's a good replacement
> binding for kill-region? (I've tried C-c C-k, but that's used by the
> Python major mode.)
>
> Also, I'd like to bind C-J and C-K to '(' and ')'. Is there a way to
> do this?
>
> Thanks in advance.
In fact. You don't need to rebind the key sequence.
Because c-w is a no-op when region selection is not activated.
so.. we can...
(defun backward-delete-word-if-not-in-region ()
"hooker, backward-kill-word when nothing in selection"
(interactive)
(if (equal mark-active nil)
(backward-kill-word 1)
(kill-region (point) (mark-marker))))
(global-set-key "\C-w" 'backward-delete-word-if-not-in-region)