help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get the function by the keymap?


From: Adam Jiang
Subject: Re: How to get the function by the keymap?
Date: Mon, 12 Nov 2012 13:27:09 +0900

2012/11/11 Le Wang <address@hidden>
On Sun, Nov 11, 2012 at 12:09 AM, Adam Jiang <address@hidden> wrote:
> However, (delete-char) never works for me. The reason is another minor mode
> remapped the backspace key to function 'autopair-backspace'. Then, I
> realized that I need a method to fetch the function by given keymap and get
> it called rather thant have hardcoded deletion executed.
>
> How can I do that with elisp code?

You don't want to dig through the keymaps yourself.  Just take your
minor-mode out of the lookup chain and use `key-binding'.

This is what I do here:

https://github.com/lewang/rebox2/blob/master/rebox2.el#L2363

The code works like a charm. Thank you, Le.
 

The deeper problem is that I have a chain of 3 functions from
different minor-modes all bound to backspace.  They share the key
happily, but Emacs lacks the mechanism to document this calling chain
when I ask about <BACKSPACE> with C-h k.  I described the need to
solve this as a feature request
http://lists.gnu.org/archive/html/help-gnu-emacs/2012-10/msg00465.html
, but there wasn't much interest.  :(
 
It seems this is a good idea. I'd like to help but I am pretty new to elisp. I'll try to get some experience about the keybinding-chain thing first.

Best regards,
/Adam

--
Le

reply via email to

[Prev in Thread] Current Thread [Next in Thread]