From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: How does `undo` know that `keyboard-quit`has been called? Date: Fri, 07 Nov 2014 17:02:00 -0500 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1415397759 26685 80.91.229.3 (7 Nov 2014 22:02:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 7 Nov 2014 22:02:39 +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 Nov 07 23:02:32 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Xmrc0-0004rg-3v for geh-help-gnu-emacs@m.gmane.org; Fri, 07 Nov 2014 23:02:32 +0100 Original-Received: from localhost ([::1]:34057 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xmrbz-00058P-Op for geh-help-gnu-emacs@m.gmane.org; Fri, 07 Nov 2014 17:02:31 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xmrbi-00057O-JL for help-gnu-emacs@gnu.org; Fri, 07 Nov 2014 17:02:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xmrbb-0003Gy-4f for help-gnu-emacs@gnu.org; Fri, 07 Nov 2014 17:02:14 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:41057) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xmrba-0003Gs-UC for help-gnu-emacs@gnu.org; Fri, 07 Nov 2014 17:02:07 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XmrbZ-0004Rs-SC for help-gnu-emacs@gnu.org; Fri, 07 Nov 2014 23:02:05 +0100 Original-Received: from 75-119-235-29.dsl.teksavvy.com ([75.119.235.29]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Nov 2014 23:02:05 +0100 Original-Received: from monnier by 75-119-235-29.dsl.teksavvy.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Nov 2014 23:02:05 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 13 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 75-119-235-29.dsl.teksavvy.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:siYJE0y/DTYlv9Ro+nNunyhJ8w4= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:100841 Archived-At: > I would like to write a command that behaves like `undo`, that is: a command > that reverses its behaviour when the user calls `keyboard-quit`. I have read > the Lisp code for both `undo` and `keyboard-quit` and I can't understand how > `undo` achieves such behaviour. (I know that I could always advise > `keyboard-quit`.) undo reverses its behavior after any other command than undo. I.e. keyboard-quit is not special in this respect. The only part that's special about keyboard-quit is that if you use it like that, it typically doesn't do anything else (well, it beeps). Stefan