If I paste text from, for example, the browser into emacs, the emacs cursor is often already at the position where I want to paste the text. If I would use emacs in console mode, I could just move the mouse over the text and press the middle button (if I had gpm disabled). But when using emacs in X (window) mode, I have to move the mouse cursor at the exact position where I want to past the text.

Is there a way to tell emacs to use the current emacs cursor position for pasting, instead of the mouse cursor position?

I hope you get my problem. :-)

  • Good question, I noticed I lacked this functionality in certain scenarios. But looking back I would say I prefer standard behavior in about half the cases. Would be nice to have both modes quickly accessible at all times. Feb 6, 2015 at 2:03
  • I only wish I could upvote this more. I'm baffled by the fact that the default is to paste where the mouse is located!
    – jrennie
    Aug 25, 2020 at 13:08

1 Answer 1


Try this setting:

(setq mouse-yank-at-point t)
  • Great, although this settings doesn't show up on M-x mouse-yank... auto-complete, it works when I put this in my .emacs :-)
    – Flow
    Sep 1, 2011 at 19:44
  • 3
    That's because it's a variable, not a function. You could use M-x set-variable RET mouse-yank-at-point (and completion should work here) Sep 2, 2011 at 11:39
  • 1
    This should be the default setting IMHO.
    – sjas
    Jun 15, 2017 at 16:48
  • Extra clarity: use the middle mouse button to paste your text at point, otherwise, you'll reset the position of point and you'll still paste at the mouse's position.
    – mistige
    Dec 16, 2019 at 15:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.