abo-abo / avy

Jump to things in Emacs tree-style
1.72k stars 110 forks source link

Added option to display candidates from avy-goto-line-above (and below) in reverse order #236

Closed walseb closed 6 years ago

walseb commented 6 years ago

One of my main problems with using avy for vertical movements is that using avy-goto-line would bring up all the easiest to type keys at the top, avy-goto-line-below solved this by having the easiest to type characters closest to the cursor, but avy-goto-line-above can't do this, and instead displays the easiest to reach keys at the top. The result is vertical movements taking more keypresses, and making it harder for muscle memory to build up (since you now have to memorize two sets of keys, one for going up and one for going down). To fix this I added a parameter to allow the user to choose if they want their keys going from bottom to top (should reversing keys like this be default behaviour for avy-goto-line-above?). I also thought having a key for going one line down was a waste of keys, so i added the option of defining your own scope when calling avy-goto-line-above and below (should the scope described also be default behaviour?).

I also fixed up the comments of avy-goto-subword-0 a bit (didn't notice the order was wrong in my last pull request)

Also, i'm not sure if line 1434 was the best way to do it (i wanted nreverse to be run on candidates if bottom-up was non-nil)

walseb commented 6 years ago

Just to help visualise, this is what avy avy-goto-line-above looks like out of the box right now 1524001322 And this is what it would look like if reversing key order was default behaviour 1524001293

Edit: I just noticed the first picture has a problem with avy-background t. I tried using master and it has the same problem. Not sure why it works properly if the candidates are reversed

walseb commented 6 years ago

In the last two commits I made it so that the scope of avy-goto-line-above and below can be controlled using an offset, instead of just a range, this is because when you are calling avy-goto-line-above or below, you already want a range (from the cursor up or down) since otherwise you would have called avy-goto-line and supplied that with a range. The offset allows you to for example make avy wait 3 characters before printing out keys. Again, i'm not sure if this is the best way to do it since i'm pretty new to elisp, so please tell me if there is anything I can do better (for example can you can do the calculation with offset inside the parameter field?)

walseb commented 6 years ago

@abo-abo In case you forgot and have time, this PR is still open

abo-abo commented 6 years ago

Hi, thanks for the reminder. I like the PR. But I need an Emacs Copyright Assignment for changes over 15 lines. Do you have one? See README for more info.

walseb commented 6 years ago

I just sent a request for one, I will remind you again when all the paperwork is done

abo-abo commented 6 years ago

Thanks.

walseb commented 6 years ago

@abo-abo The paperwork is done! What should I do now? Paste the signed PDF here?

abo-abo commented 6 years ago

@walseb Thanks, I think I see you on the copyright.list file. But the email address is different, and there's no name on your Github account. So it's difficult to make the connection (not just for me, but for other people and automated tools).

Could you please squash the PR into a single commit using email s.wal...@gmail.com? Or ask the copyright clerk to also add the current email on your commit to the copyright.list file?

walseb commented 6 years ago

@abo-abo Sorry, I didn't pay much attention when creating the account. Everything is fixed now.

abo-abo commented 6 years ago

Merged, thanks.