abo-abo / avy

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

only call goto when avy-action is not set by dispatch action #274

Closed artenator closed 5 years ago

artenator commented 5 years ago

hey! this is my first PR, so feedback is greatly appreciated as I am a new contributor and not super familiar with the codebase.

I noticed a bug with avy-goto-line with the newer dispatch action features.

Example of these bugs: Let's assume M-g is set as avy-goto-line.

  1. If you press M-g X dj (kill-stay), you are expected to kill the line marked by dj, and stay at the current position of the point. What actually happens is you kill the line and go to the line as well. This is because (avy-action-goto r) is called regardless of whether a dispatch action has been set.

  2. Another example is M-g t dh (teleport), which should teleport the selected line at dh to the current point position without moving the point. In this situation, the selected line is transported to the point position, but the point is still taken to the original selected line position at dh. Again, this is because (avy-action-goto r) is called regardless of the action set in avy-action

The solution I came up with is to only call avy-action-goto when avy-action has been left to its default value set in avy--line of #'identity

Thanks! Let me know what you think.

abo-abo commented 5 years ago

Merged, thanks. I only rewrote the commit message to match the repo style, and replaced the introduced tab with spaces.