19

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. :-)

Flow
  • 1,428
  • 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. – Alexander Shcheblikin Feb 06 '15 at 02: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 '20 at 13:08

1 Answers1

22

Try this setting:

(setq mouse-yank-at-point t)
Trey Jackson
  • 4,021
  • 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 01 '11 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) – Antoine Pelisse Sep 02 '11 at 11:39
  • 1
    This should be the default setting IMHO. – sjas Jun 15 '17 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 '19 at 15:23