abo-abo / avy

Jump to things in Emacs tree-style
1.71k stars 109 forks source link

Custom avy-style/key sequence generation function #275

Open noctuid opened 5 years ago

noctuid commented 5 years ago

It would be nice if there was a way to create a custom function for generating the keys to use for overlays without having to alter avy directly. It's also somewhat confusing to me that avy-style controls both key sequence generation and the placement of overlays. I think it would make sense to use some custom key sequence generation with either pre or post, for example.

I don't have a problem with the default key generation, but someone might find this useful in the future.

abo-abo commented 5 years ago

Agreed. Would be nice to refactor avy--process-1 to re-use code more. Right now it has three paths:

All three should share the same logic instead of duplicating it.

Note that the way avy-read does it, the decoupling is easier, since (avy-tree candidates avy-keys) is created separately and only passed into avy-read.

So avy-read-de-bruijn and avy-read-words should be refactored to produce similar trees as (avy-tree candidates avy-keys), which would be passed into avy-read.