help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Single-use keybindings?


From: Eric Abrahamsen
Subject: Re: Single-use keybindings?
Date: Sun, 23 Jul 2017 15:18:07 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> A few times I've found myself wanting the ability to set a single-use
>> keybinding: the next time the user hits "q" (or what have you), run this
>> command, then reset "q" to whatever it was before.
>>
>> This feels hacky, obviously, but more importantly it feels like I'm
>> not using the right tools, or misusing what I've got. Has anyone else
>> wanted to do this? Any better solutions? Maybe I should be using a minor
>> mode that turns itself off after use, or...
>
> After thinking about it: I implemented something like this myself.
> Because resetting is tricky - and sometimes even something that you
> don't want! - I just use a key binding that was unbound before.  So I
> simply don't use any kind of resetting.  Hitting the key (again) when it
> makes no sense may result in an error.  That's the case for other keys,
> too, so...
>
>
> Michael.

This would have the added bonus that you have more freedom to make that
new keybinding do "more stuff". The only downside is that the user has
to learn and remember a new key. My use-case is still bare-bones enough
that I'll stick with the transient key map, but your approach makes
plenty of sense.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]