all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Problem quitting properly from transient keymap with one keystroke
@ 2017-10-19  3:13 Bob Weiner
  2017-10-19 15:40 ` Robert Weiner
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Bob Weiner @ 2017-10-19  3:13 UTC (permalink / raw)
  To: emacs-devel

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



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-10-20 17:51 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-19  3:13 Problem quitting properly from transient keymap with one keystroke Bob Weiner
2017-10-19 15:40 ` Robert Weiner
2017-10-20 12:24 ` Stefan Monnier
2017-10-20 12:27 ` Stefan Monnier
2017-10-20 14:45   ` Robert Weiner
2017-10-20 15:13     ` Stefan Monnier
2017-10-20 16:04       ` Robert Weiner
2017-10-20 17:34         ` Stefan Monnier
2017-10-20 17:51           ` Robert Weiner
2017-10-20 12:42 ` Oleh Krehel
2017-10-20 14:32   ` Robert Weiner
2017-10-20 14:36   ` Robert Weiner
2017-10-20 14:44   ` Stefan Monnier
2017-10-20 15:26     ` Oleh Krehel
2017-10-20 17:30       ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.