abo-abo / avy

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

avy-action-kill-stay Killed: Text, minibuffer msg, hidden by Mark set #230

Open duianto opened 6 years ago

duianto commented 6 years ago

When teleporting some text, then the minibuffer shows the message Mark set. But the messages buffer shows that the killed text was printed as Killed: <killed text> before Mark set. The first message is never seen without opening the messages buffer.

Steps to reproduce

  1. Start Emacs
  2. Type:
    one
    two
    three
  3. Move the cursor the the o in one.
  4. Call M-x avy-goto-line
  5. Press t to start a teleport action
  6. Press s to target the second line two

Observed

The minibuffer shows Mark set, but the messages buffer shows:

Killed: two
Mark set

Expected

The minibuffer should probably show the Killed: two message.

Possible cause

The avy-action-kill-stay function calls: (message "Killed: %s" (current-kill 0)) https://github.com/abo-abo/avy/blob/6459f7f12aef1e71ff5e265b1edb414fd81123e6/avy.el#L683

But when the avy-action-kill-stay function is done, then avy-action-teleport ends up calling (yank) https://github.com/abo-abo/avy/blob/6459f7f12aef1e71ff5e265b1edb414fd81123e6/avy.el#L696 which prints Mark set to the minibuffer. That replaces the Killed: two text before one is able to see it.

Possible solution:

I'm not sure if it's important to see the Mark set message. If not, then maybe the yank command could be replaced with:

(insert (car kill-ring))

Or maybe the killed message could be shown after the yank command, then the Mark set message will still be visible in the messages buffer. But I'm not sure how this could be done, since the message and yank command are called in different functions.