key-combo icon indicating copy to clipboard operation
key-combo copied to clipboard

To be a superset of key-chord, this will require timeout.

Open AntonyBlakey opened this issue 10 years ago • 3 comments

Using

(key-combo-define-global (kbd "x") '(key-combo-execute-original helm-M-x))

I would expect that a quick xx would give me helm-M-x, but x delay x shouldn't trigger it.

e.g

(defvar key-chord-two-keys-delay 0.1    ; 0.05 or 0.1
  "Max time delay between two key press to be considered a key chord.")

(defvar key-chord-one-key-delay 0.2 ; 0.2 or 0.3 to avoid first autorepeat
  "Max time delay between two press of the same key to be considered a key chord.
This should normally be a little longer than `key-chord-two-keys-delay'.")

AntonyBlakey avatar Apr 07 '15 15:04 AntonyBlakey

Hm. Superset was a bit of stretch.

It would be quite easy to implement a global setting but then you would like to have combos that are not affected by delays. The best strategy would be to add some sort of specification for this right inside key-combo-define* declarations. You might also want to have delays only between first and second press but not between second and third.

I am planning to extend key-combo declarations for arbitrary options, but I am not sure of exact syntax as yet. In your example it could be something along:

(key-combo-define-global (kbd "x") '(key-combo-execute-original (helm-M-x :delay 0.2)))

How useful is this feature in general? It gets pretty close to random behavior. On the back of your mind you always need to track how fast you type the keys.

vspinu avatar Apr 08 '15 00:04 vspinu

The key feature of key-chording is the speed between consecutive presses (or in the case of chords, which consecutive technically isn't, simultaneous presses). It's not so much that you track how fast you type.

In any case, I'm not sure that this needs to be a strict superset, I was just making the point about the stated aim. Personally, I'm happy with key-chord, hydra and abo-abo/xah-lee's modal focus, to which your package makes a nice addition. Making them all work together is the trick.

AntonyBlakey avatar Apr 08 '15 04:04 AntonyBlakey

Let's keep it open as a reminder. I will have a look into it in due time. Thanks.

vspinu avatar Apr 08 '15 12:04 vspinu