[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Looking up and CALLING a key binding
From: |
Xah Lee |
Subject: |
Re: Looking up and CALLING a key binding |
Date: |
Wed, 7 Jan 2009 10:08:57 -0800 (PST) |
User-agent: |
G2/1.0 |
On Jan 6, 7:14 am, TheLonelyStar <nabb...@lonely-star.org> wrote:
> Hi,
>
> I need this for the following two things:
>
> 1. I want to bind a key (the tab key) to a special function which can fail.
> If the function fails, I want to call the original binding of the key
> (which is differerent depending on which mode I am in).
>
> 2. I want to bind a key to the insertion of a little code snippet.
> i.E. { -> to
> {
> |}
>
> But since in many modes the "{" and "}" keys are bound to some special
> function, I want to call these keybindings for the insertions of the "{" and
> "}".
do it like this:
(funcall (lookup-key (current-global-map) (kbd "M-r")))
this will find out the function assigned to the key “Alt+r”, then call
the function.
Xah
∑ http://xahlee.org/
☄