Emacs: Pasting with the mouse without moving the point – mouse-yank-at-point

Posted: - Modified: | emacs

W- has been taking notes in Org Mode in Emacs, despite being a long-time Vim user. He likes org-indent’s virtual spaces over the way the Vim plugin for Org inserts actual spaces, and evil-mode provides a reasonable compromise in terms of keyboard shortcuts. I have been successfully resisting the urge to overwhelm him with tips. :)

He mentioned that he was thinking of going back to Vim because of one little thing he couldn’t get used to: mouse pasting behaviour. In vim in a Linux console, pasting with middle-click puts the text where the point is, no matter where you click. In Emacs in a GUI, middle-clicking moves the point and then pastes, so you have to be more careful about clicking where you want the text to go. I hardly ever use the mouse to paste, since C-y is more convenient for me, but everyone’s got their own workflow.

To make sure he didn’t feel any pressure from me to continue with Emacs, I nodded and suggested a few note-taking things he might try if he went back to the Vim world, like using pandoc to convert his Org Mode notes to Markdown. But Org Mode is awesome, so out of curiosity, I searched for “emacs don’t move point middle click”, which led me to a StackExchange answer, which had the exact thing we needed. W- added the following line to his ~/.emacs.d/init.el:

(setq mouse-yank-at-point t)

Now middle-clicking pastes at the current location instead of moving it. Yay!

I think it’s awesome that at some point, someone decided to make that configurable, and someone asked about it and someone else answered, and all that can be found with the words I used. Yay community!

You can comment with Disqus or you can e-mail me at sacha@sachachua.com.