abo-abo / avy

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

Fix subword commands with custom order. #287

Closed danlei closed 4 years ago

danlei commented 4 years ago

The subword commands don't work with my custom order function settings:

(setq avy-orders-alist '((avy-goto-char . avy-order-closest)
                         (avy-goto-word-1 . avy-order-closest)
                         (avy-goto-subword-0 . avy-order-closest)))

After a bit of debugging, I found out that the normal word-based commands pass match start and end positions in candidates, while the subword commands don't. If I'm not mistaken, those end positions are always the following character in this case — so I just added that to the candidates. It might be a bit of a hack, and I didn't have the time to get a full understanding of your code, so I can't guarantee that it doesn't break something else, but it seems to get the job done.

abo-abo commented 4 years ago

Thanks.