When I click with the middle mouse button that usually inserts the primary selection at the point where I clicked. However, the same button opens flyspell's context menu when I click on a misspelled word. The problem is that when I use the context menu to, e.g., save a word to the dictionary, this also inserts the primary selection after the flyspell action is finished. I thought that this problem may be due to a mess-up in my configuration but I can also reproduce this with
emacs -Q. How can I fix this?
Steps to reproduce:
Insert the following sentence (in the scratch buffer):
Here is a sentence with a mistaake.
M-x flyspell-buffer, the word mistaake is highlighted.
Double click on sentence to select it.
Click middle mouse button (mouse-2) on mistaake, choose the correct spelling mistake from the context memu.
Result: mistaake is replaced with missentecetake.
I found some really old bug reports that sound related (going back to 2005) but no working solution.