7

IntelliJ has a keybind on a double-tap of Shift. I'm curious if Emacs can emulate this functionality - my first thought was key-chord.el, since it allows double taps of regular keys like qq. But, reading the key-chord.el documentation, it doesn't seem like it's possible to use modifiers keys as the keybind.

Any other packages that might be able to duplicate this functionality ?

gempesaw
  • 173
  • 3

2 Answers2

6

Applications written with/for GUI frameworks such as X11 can generally receive individual key-up/key-down events, so it would be possible if only Emacs exposed that functionality to the land of Elisp, but it doesn't.

For a surprise though, in e.g. an X11 frame, hit C-h k, then click down with your mouse, drag it around, and release it somewhere. The up/down functionality is there for mouse buttons already, and even dragging is considered a key. Scrolling the mouse wheel likewise; it even generates double- and triple- events.

Anyway, for modkeys, we're sadly out of luck until someone patches the C code. What you might also try is mess with your X keymap; possibly a key can be made a modkey and a normal key simultaneously, but I don't know.

TaylanKammer
  • 626
  • 5
  • 5
2

See https://stackoverflow.com/questions/26500567/can-i-bind-something-to-alt-meta

I admit to being surprised that IntelliJ can do that, as I was under the impression that all applications would be in the same boat when it came to receiving input from modifier keys alone.

If someone can provide some details, I'd be interested. My initial guess is that it's related to terminal limitations? (in which case GUI Emacs might in theory be able to do likewise, but possibly not without breaking terminal compatibility?)

phils
  • 48,657
  • 3
  • 76
  • 115
  • Yeah, it's apparently the default keybinding for [searching everywhere](https://www.jetbrains.com/idea/help/searching-everywhere.html) – gempesaw Nov 19 '14 at 20:53