(just-one-space) should probably be excluded, when the teleported line becomes empty.
Maybe something like this:
(unless (and (bolp) (eolp))
(just-one-space))
Additional notes:
Teleport first and last word
When the first or last word of a line is teleported, then a space is left behind.
For example with this sample text:
one two three
four five six
With the cursor on o in one
M-x avy-goto-word-1
Press: t to target all words starting with t
Press: t to start the teleport action
Press: s to target the word three
This results in:
threeone two
four five six
with a space after two. (the space was not inserted by the (just-one-space) command, it remained after the word three was killed, then the just-one-space command ran, but nothing changed, since there already was a single space).
Teleporting the first word on the second line:
Continuing from the result in the example above
With the cursor on t in three
M-x avy-goto-word-1
Press f to target words starting with f
Press t to start the teleport action
Press a to target the word four
This results in:
fourthreeone two
five six
with a space before five.
Maybe the leading and trailing spaces also should be removed?
System info
Windows 10 Version 1709 (OS Build 16299.125)
GNU Emacs 25.3.1 (x86_64-w64-mingw32) of 2017-09-26
and GNU Emacs 26.0.50 (build 4, x86_64-w64-mingw32) of 2017-08-07
Avy Version 0.4.0
A space is left behind on an empty line after teleporting.
Steps to reproduce
o
inone
M-x avy-goto-line
t
(teleport action) ands
(the second line)Observed
there's a space character on the second line, It's easier to see with
M-x whitespace-mode
.Expected
No space character on the second line.
Possible cause
(just-one-space)
is called in theavy-action-kill-stay
function: https://github.com/abo-abo/avy/blob/6459f7f12aef1e71ff5e265b1edb414fd81123e6/avy.el#L682Possible solution:
(just-one-space)
should probably be excluded, when the teleported line becomes empty.Maybe something like this:
Additional notes:
Teleport first and last word
When the first or last word of a line is teleported, then a space is left behind. For example with this sample text:
o
inone
M-x avy-goto-word-1
t
to target all words starting witht
t
to start the teleport actions
to target the wordthree
with a space after
two
. (the space was not inserted by the(just-one-space)
command, it remained after the wordthree
was killed, then thejust-one-space
command ran, but nothing changed, since there already was a single space).Teleporting the first word on the second line: Continuing from the result in the example above
t
inthree
M-x avy-goto-word-1
f
to target words starting withf
t
to start the teleport actiona
to target the wordfour
with a space before
five
.Maybe the leading and trailing spaces also should be removed?
System info
Windows 10 Version 1709 (OS Build 16299.125) GNU Emacs 25.3.1 (x86_64-w64-mingw32) of 2017-09-26 and GNU Emacs 26.0.50 (build 4, x86_64-w64-mingw32) of 2017-08-07 Avy Version 0.4.0