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: Very Specific Key Press Behaviour Date: Mon, 22 Jun 2009 22:20:42 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <011c4c7d-d1ea-4783-b79b-982d41b10d5e@y9g2000yqg.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 1245767785 7091 80.91.229.12 (23 Jun 2009 14:36:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 23 Jun 2009 14:36:25 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jun 23 16:36:18 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 1MJ76f-0007OR-BP for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Jun 2009 16:36:17 +0200 Original-Received: from localhost ([127.0.0.1]:53813 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MJ76e-0001TI-Po for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Jun 2009 10:36:16 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!y33g2000prg.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 30 Original-NNTP-Posting-Host: 76.102.12.87 Original-X-Trace: posting.google.com 1245734442 5740 127.0.0.1 (23 Jun 2009 05:20:42 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 23 Jun 2009 05:20:42 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y33g2000prg.googlegroups.com; posting-host=76.102.12.87; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.31 Safari/530.5, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:170225 X-Mailman-Approved-At: Tue, 23 Jun 2009 10:25:15 -0400 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:65450 Archived-At: On Jun 22, 1:37 pm, Nordl=C3=B6w wrote: > On Jun 22, 10:33 pm, Nordl=C3=B6w wrote: > > > How can I bind an action to a key when it is pressed the n:th time, > > possibly with different behaviour the 3:rd time compared to the 2:nd > > and 1:st time. Can I combine it with define-prefix-command? > > > This is what I have now: > > - TAB: Show Completion Menu - currently through define-prefix-command > > () > > - TAB + X: Perform Completion of type X > > - TAB + X: here means press TAB, release it and then press X. if i understand you correctly, you want the TAB key to perform a action, and perform another action when TAB is followed by another key. I don't think you can do that. Your tab key is a prefix key, you cannot have prefix key perform a action. you might hack it with OS's help, such as how Windows's Alt key behaves or the Windows Log key, but that's kinda outside of emacs. however, if you want a key combo to perform different action depending how many times that key combo has been pressed, you can do it by comparing the var last-command and this-command. Xah =E2=88=91 http://xahlee.org/ =E2=98=84