Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to select text in one Emacs window and then drag-drop it into another window of the same Emacs session?

If so, how can it be done?

share|improve this question
In what operating system? If Linux, which Desktop Environment or Window Manager? – terdon Jan 5 '14 at 16:27
I actually use both Windows 7 (Windows) and Ubuntu 13.10 (Linux). Is there a cross-platform solution? – Bleeding Fingers Jan 5 '14 at 16:29
Don't think so, but I'm not sure. Personally, I just copy/paste. – terdon Jan 5 '14 at 16:30
There are left / right mouse-up and mouse-down keys, so you could trigger paste with . . . mouse-up . . . and you could use (mouse-set-point event) before the paste -- take a look at mouse.el and mouse-copy.el and mouse-drag.el. – lawlist Jan 5 '14 at 19:44
up vote 1 down vote accepted

Define "drag-drop it into another". Mouse-dragging in Emacs selects text -- see (emacs) Mouse Commands. Do you mean pasting selected text into a different Emacs window in the same Emacs session? In a different session?

If you just want to copy text from one Emacs window to another using the mouse, then select it and then use mouse-2 to paste it. To copy+paste to a different Emacs session, you might need to set some variables (depends on your platform/setup), to have mouse selection also copy the selction to the interprogram clipboard etc. See (emacs) Primary Selection.

On MS Windows, I use these settings, FWIW:

  • mouse-2 is bound to mouse-yank-at-click
  • select-active-regions is t
  • x-select-enable-clipboard is t
  • mouse-drag-copy-region is t
share|improve this answer
I had discovered the same solution and was going to mention mouse-2 in an answer. Yes, same Emacs session. Question updated. – Bleeding Fingers Jan 7 '14 at 6:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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