From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: harven Newsgroups: gmane.emacs.help Subject: Re: Capture ALL keystrokes Date: Fri, 30 May 2008 02:57:48 -0700 (PDT) Organization: http://groups.google.com Message-ID: <2dccffc3-e20a-4d28-86f6-4932c175073b@t54g2000hsg.googlegroups.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1212144137 13433 80.91.229.12 (30 May 2008 10:42:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 30 May 2008 10:42:17 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri May 30 12:42:58 2008 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 1K223f-0004Wn-R3 for geh-help-gnu-emacs@m.gmane.org; Fri, 30 May 2008 12:42:04 +0200 Original-Received: from localhost ([127.0.0.1]:50800 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K222t-0002yr-RN for geh-help-gnu-emacs@m.gmane.org; Fri, 30 May 2008 06:41:15 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newsfeed.stanford.edu!postnews.google.com!t54g2000hsg.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 20 Original-NNTP-Posting-Host: 82.240.200.149 Original-X-Trace: posting.google.com 1212141468 9177 127.0.0.1 (30 May 2008 09:57:48 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 30 May 2008 09:57:48 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: t54g2000hsg.googlegroups.com; posting-host=82.240.200.149; posting-account=hanW0AoAAADuR-PIr5jGeb298Y3jGR7p User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:159001 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:54363 Archived-At: On May 29, 12:36 pm, "Ben Forbes" wrote: > When some keystroke A is entered, I set a flag, and I want this flag > to be unset if any keystroke is entered except some keystroke B. So > basically, I only want keystroke B to have any effect if it is > preceded by keystroke A. How can I do this? Be more specific about what you are trying to achieve. Bound the following command to key A. Pressing the A key inserts the letter A. It then executes the command newline repeatedly if B is pressed any amount of time. (defun my-command () "After key A, key B executes the command newline repeatedly" (interactive) (insert "A") (while (equal (setq key (read-event)) ?B) (next-line)) (push key unread-command-events)) (global-set-key "A" 'my-command)