0

I use emacs within screen in SSH for most of my work, and would like to be able to copy text from one session to another. I currently use the mouse to select, but this is problematic for three reasons:

  1. Spacing often gets messed up, particularly tabs
  2. I have to get temporarily out of vertical screen split to copy (lest the other half get copied as well)
  3. I can't copy more than one vertical screen's worth of text

And of course, it slows me down by requiring taking my hands off the keyboard. Is there a way to use some command similar to emacs kill-ring buffers to paste between screen sessions with the keyboard?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Max Ghenis
  • 14,783
  • 16
  • 84
  • 132

1 Answers1

-1

I have not used screen for years, so I cannot give you a screen based answer, but there is other things you can try:

  1. If emacs are in same machine, use emacs in daemon mode, and emacsclient. Your can have same emacs session across several screen sessions. Since it is the same emacs session, the kill ring is the same and cut and pasting is trivial (your 3 problems are solved). If files are in different hosts, just open them from the same emacs session in one host via ssh (emacs can open remote files using tramp).

  2. Use tmux as a replacement of screen. It is more scriptable and configurable. You can use copy-mode in tmux to copy and paste tmux buffers, that you can select with emacs-like key combos. While those buffers may span across more than one "tmux page", copy-mode is not able to scroll over emacs buffer (it scrolls over tmux buffer). So thos does not solve your #3 problem.

  3. Create a emacs key binding to "paste" a region of file into a temp file (write-region) and another to read from that same file file.

juanleon
  • 9,220
  • 30
  • 41