Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How to get the function by the keymap?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Adam Jiang  
View profile  
 More options Nov 10 2012, 11:09 am
Newsgroups: gnu.emacs.help
From: Adam Jiang <jiang.a...@gmail.com>
Date: Sun, 11 Nov 2012 01:09:02 +0900
Local: Sat, Nov 10 2012 11:09 am
Subject: How to get the function by the keymap?

Hi,

I am working on a minor mode in which I want to remap [backspace] key to
different functions in different situation. The lisp code looks like

(defun smart-operator-backspace ()
  (interactive)
  (cond ((looking-back "hello"))
     (save-excursion
        (replace-regexp-in-string ".*hello" "" (match-string 1))))
     (t
        (delete-char 1))))

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?

/Adam


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eli Zaretskii  
View profile  
 More options Nov 10 2012, 11:39 am
Newsgroups: gnu.emacs.help
From: Eli Zaretskii <e...@gnu.org>
Date: Sat, 10 Nov 2012 18:38:51 +0200
Local: Sat, Nov 10 2012 11:38 am
Subject: Re: How to get the function by the keymap?

I think you want lookup-key or local-key-binding.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adam Jiang  
View profile  
 More options Nov 11 2012, 11:27 pm
Newsgroups: gnu.emacs.help
From: Adam Jiang <jiang.a...@gmail.com>
Date: Mon, 12 Nov 2012 13:27:09 +0900
Local: Sun, Nov 11 2012 11:27 pm
Subject: Re: How to get the function by the keymap?

2012/11/11 Le Wang <l26w...@gmail.com>

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

--


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »