From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Bob Weiner Newsgroups: gmane.emacs.devel Subject: Problem quitting properly from transient keymap with one keystroke Date: Wed, 18 Oct 2017 23:13:41 -0400 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1508382854 19685 195.159.176.226 (19 Oct 2017 03:14:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 19 Oct 2017 03:14:14 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 19 05:14:01 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 1e51HO-0002cx-5p for ged-emacs-devel@m.gmane.org; Thu, 19 Oct 2017 05:13:54 +0200 Original-Received: from localhost ([::1]:47279 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e51HV-0004jo-Li for ged-emacs-devel@m.gmane.org; Wed, 18 Oct 2017 23:14:01 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50842) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e51HL-0004iR-Gq for emacs-devel@gnu.org; Wed, 18 Oct 2017 23:13:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e51HG-0003nc-Oe for emacs-devel@gnu.org; Wed, 18 Oct 2017 23:13:51 -0400 Original-Received: from mail-qk0-f179.google.com ([209.85.220.179]:48706) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e51HG-0003m8-KN for emacs-devel@gnu.org; Wed, 18 Oct 2017 23:13:46 -0400 Original-Received: by mail-qk0-f179.google.com with SMTP id d67so8809869qkg.5 for ; Wed, 18 Oct 2017 20:13:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=CW/zWq/IXtsIfoGAmlr0oU0KfL9Kokj9MywgQYv9yik=; b=GCyCVJYqjqvX+2OtWP3RGt0xbLzo8kvTQSjBQiBLhwYAZLUCx5SLet4H0fuvATcc5v BBkq3Jum+zDiuejaOugZdZlKQ40gO7q89iRXnfU5wLfTjmLJJ3Ps2Jm15hWD+tNmVIgO pth1G4ssMnatbF/9UoxakNhzNMqYP/R/+j2lPAmo85tonkr9h6xpvvu3ZP1AcB8PmfRr oF51EovuizPJwjsINU0IO07K2C1iB9faoHMgoNWGDYe0/SomyAkjFtuckyuCetWtKnOJ bl9pJc1WQxtuRygKUylxk+5Q0rzrpSa6Odil9RjL9K1MXXhpjfOr1HxA5o/hE8jtXpZZ wt4w== X-Gm-Message-State: AMCzsaUo/gheYVsYXx2ODYurpJCP4CQ/SbL24rjRA6Dvh7KzLyyxftSv ++5PSLc7PmKnUxt7tp6Y669SOQ== X-Google-Smtp-Source: ABhQp+SPHCFiJn4ytdQL2U+UUicE3TXhQMdFuZHExU1IGzgPzH+kEGrUnCEPid4z9N+PaNVVCxkwXA== X-Received: by 10.55.22.146 with SMTP id 18mr185595qkw.281.1508382824748; Wed, 18 Oct 2017 20:13:44 -0700 (PDT) Original-Received: from bka-iMac.local.gnu.org (ool-2f1481cf.dyn.optonline.net. [47.20.129.207]) by smtp.gmail.com with ESMTPSA id n31sm4691102qtf.62.2017.10.18.20.13.43 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2017 20:13:44 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.220.179 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:219624 Archived-At: I am using set-transient-map to create an overriding keymap that provides quick access to frame and window functions. I have both a stay-in-transient-map function and an on-exit function defined that are sent as parameters to the set-transient-map call. Everything is working as desired except for disabling the transient map. Both C-g and q should disable the transient map and run the on-exit function I have defined. I am using inhibit-quit set to t to control the operation of C-g. Both C-g and q set a flag which informs the stay-in-transient-map function to disable the keymap. The on-exit function then is called after the keymap is disabled and for C-g, (keyboard-quit) is called. The problem is that set-transient-map uses pre-command-hook to test the stay-in-transient-map function and to exit, so if a keystroke sets the flag read by the stay-in-transient-map function to disable the transient map, this check is not done until another key is pressed because the pre-command-hook is not run again until then (so the code doesn't see the flag change until then). 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. Is there any clean way to exit and abort from a transient keymap upon a single key press? I have tried manually invoking (from the post-command-hook) the disable function that set-transient-keymap returns, but have not gotten that to work either. FYI, when I mention a key, I mean a bound key within the current keymaps. Thanks, Bob