From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.help Subject: Re: Looking up and CALLING a key binding Date: Wed, 7 Jan 2009 10:08:57 -0800 (PST) Organization: http://groups.google.com Message-ID: <362bfee7-cf0f-4832-b89c-52b30b902c19@d42g2000prb.googlegroups.com> References: <21291485.post@talk.nabble.com> <5e307aad-4ae3-4527-8fef-cee66fd9c2aa@o40g2000prn.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1231387490 12362 80.91.229.12 (8 Jan 2009 04:04:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 Jan 2009 04:04:50 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 08 05:06:00 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LKm8x-0002Vf-SO for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Jan 2009 05:05:52 +0100 Original-Received: from localhost ([127.0.0.1]:44427 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LKm7f-0004y7-RB for geh-help-gnu-emacs@m.gmane.org; Wed, 07 Jan 2009 23:03:55 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!d42g2000prb.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 32 Original-NNTP-Posting-Host: 69.226.219.185 Original-X-Trace: posting.google.com 1231351737 18308 127.0.0.1 (7 Jan 2009 18:08:57 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 7 Jan 2009 18:08:57 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: d42g2000prb.googlegroups.com; posting-host=69.226.219.185; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:165830 X-Mailman-Approved-At: Wed, 07 Jan 2009 23:03:35 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:61171 Archived-At: On Jan 6, 7:14 am, TheLonelyStar 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 fai= l. > 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 =E2=80=9CAlt+r=E2=80=9D= , then call the function. Xah =E2=88=91 http://xahlee.org/ =E2=98=84