From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Problem quitting properly from transient keymap with one keystroke Date: Fri, 20 Oct 2017 11:13:44 -0400 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1508512526 28134 195.159.176.226 (20 Oct 2017 15:15:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 20 Oct 2017 15:15:26 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 20 17:15:22 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e5Z0u-0005FY-DG for ged-emacs-devel@m.gmane.org; Fri, 20 Oct 2017 17:15:08 +0200 Original-Received: from localhost ([::1]:54448 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5Z11-0006Es-Mk for ged-emacs-devel@m.gmane.org; Fri, 20 Oct 2017 11:15:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33657) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5Z0I-0005lU-M1 for emacs-devel@gnu.org; Fri, 20 Oct 2017 11:14:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5Z0F-0006fn-FL for emacs-devel@gnu.org; Fri, 20 Oct 2017 11:14:30 -0400 Original-Received: from [195.159.176.226] (port=54594 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e5Z0F-0006ew-8K for emacs-devel@gnu.org; Fri, 20 Oct 2017 11:14:27 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1e5Yzt-0006Ad-5J for emacs-devel@gnu.org; Fri, 20 Oct 2017 17:14:05 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 27 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:Ljs3mj9HAsxMLGU2xqXWrPW9cFE= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:219650 Archived-At: >> > I can't just add a post-command-hook that calls the transient map >> > disable function because calling (keyboard-quit) from the >> > post-command-hook triggers an error and I imagine that is not a proper >> > usage scenario. >> Why do you need a post-command-hook? > HyControl uses post-command-hook to persist a prefix-argument value across > commands and to continually display a help message in the minibuffer until > exit. But neither of those activities seem related to calling the exit function or calling keyboard-quit. > ​​Just curious, why does set-transient-map use pre-command-hook instead of > post-command-hook​ to test whether or not to keep the transient-map > enabled? Because we need to know which is the next command before we know whether to exit or not: E.g. after hitting C-u we don't know yet whether to exit, it's only once the user hits the next key that we know whether to exit (e.g. she pressed `a`) or stay (e.g. she pressed `5`). And when she presses `a`, we need to exit *before* running the command bound to `a`: sometimes it could be OK to linger on until the end of the command bound to `a`, but not in general. Stefan