all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: help-gnu-emacs@gnu.org
Subject: Re: Single-use keybindings?
Date: Sun, 23 Jul 2017 15:18:07 -0700	[thread overview]
Message-ID: <87k22ypzkw.fsf@ericabrahamsen.net> (raw)
In-Reply-To: 87fudmdd3g.fsf@drachen

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.




      parent reply	other threads:[~2017-07-23 22:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-23  0:52 Single-use keybindings? Eric Abrahamsen
2017-07-23  1:00 ` Drew Adams
2017-07-23  1:04   ` Eric Abrahamsen
2017-07-23  1:22   ` Eric Abrahamsen
2017-07-23  5:51 ` Emanuel Berg
2017-07-23 18:04   ` Eric Abrahamsen
2017-07-23 21:28     ` Eric Abrahamsen
2017-07-23 21:45       ` Emanuel Berg
2017-07-23 22:09         ` Eric Abrahamsen
2017-07-23 22:04 ` Michael Heerdegen
2017-07-23 22:11   ` Emanuel Berg
2017-07-23 22:18   ` Eric Abrahamsen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k22ypzkw.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.