<?xml version="1.0"?>
<!DOCTYPE content [ <!ENTITY nbsp " "> ]>
<rdf:RDF xml:base="http://snarfed.org/rdf"
         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:dc="http://purl.org/dc/elements/1.1/">

<rdf:Description rdf:about="http://snarfed.org">
  <dc:title> snarfed.org  </dc:title>
  <dc:description> draw group stream of consciousness </dc:description>
  <dc:creator> Ryan Barrett &lt;snarfed at ryanb dot org&gt; </dc:creator>
  <dc:language> en </dc:language>
  <dc:format> text/html </dc:format>
  <dc:rights> Copyright 2002-2007 Ryan Barrett </dc:rights>
</rdf:Description>

<rdf:Description rdf:about="http://snarfed.org/space/synchronizing%20GNU%20screen%27s%20paste%20buffer%20and%20the%20X%20selection">
  <dc:title> synchronizing GNU screen's paste buffer and the X selection </dc:title>
  <dc:creator> Ryan Barrett &lt;snarfed at ryanb dot org&gt; </dc:creator>
  <dc:date> 2003-01-01T05:00:00Z </dc:date>
  <dc:language> en </dc:language>
  <dc:format> text/html </dc:format>
  <dc:rights> Copyright 2002-2007 Ryan Barrett </dc:rights>

  <content>
    <p><a href="http://www.gnu.org/software/screen/"><img src="/space/terminal.jpg" alt="terminal.jpg" title="" /></a><a href="http://gnu.org/software/emacs/"><img src="/space/gnu.jpg" alt="gnu.jpg" title="" /></a><a href="http://x.org/"><img src="/space/X_logo.png" alt="/space/X_logo.png" title="" /></a></p>

<p>I
hate the mouse. It's good for some things, but not my work. Switching between
the mouse and the keyboard wreaks havoc on my muscle memory and fine-motor flow.
Thanks to <a href="http://gnu.org/software/emacs/">Emacs</a>,
<a href="http://iki.fi/tuomov/ion">Ion</a>, <a href="http://www.washington.edu/pine/">Pine</a>,
<a href="http://gaim.sf.net">Gaim</a>, and <a href="http://getfirefox.com">Firefox</a> (God bless
<a href="http://www.mozilla.org/access/type-ahead/">Find As You Type</a>), I can do
everything I need to with the keyboard. The only thing I <em>can't</em> do with the
keyboard is copy text from a terminal. And that irks me.</p>

<p>In the past, this has driven me to desperate measures, including <a href="/space/why I don't run shells inside Emacs">running shells
inside Emacs</a>. I currently use <a href="http://www.gnu.org/software/screen/">GNU
screen</a>'s <a href="http://www.delorie.com/gnu/docs/screen/screen_73.html">copy/scrollback
mode</a>, with a hack to
integrate it with X Windows' clipboard.</p>

<p>This command in <a href="http://ryan.barrett.name/dotfiles/screenrc">my .screenrc</a>
copies screen's paste buffer into the X primary selection. It runs automatically
when you press > to set the second mark in copy/scrollback mode.</p>

<div class='p-shadow'><pre><code># set the second mark, write to the screen-exchange
# file, and use xsel to synchronize the paste buffer
# with the X selection.
bindkey -m &gt; eval "stuff ' '" writebuf "exec sh -c 'xsel -n &lt; /tmp/screen-exchange'"
</code></pre></div>

<p><br class='clearing' />Note that this uses <a href="http://www.vergenet.net/~conrad/software/xsel/">Conrad Parker's
xsel</a> (<em>not</em> <a href="http://www.niksula.cs.hut.fi/~vherva/xsel/">Ville Herva's
xsel</a>), which needs to be somewhere
in your PATH.</p>

<p>See also:</p>

<ul>
<li><a href="/space/Emacs keybindings in GNU screen's copy-scrollback mode">Emacs keybindings in GNU screen's copy-scrollback mode</a></li>
<li><a href="/space/why I don't run shells inside Emacs">why I don't run shells inside Emacs</a></li>
<li><a href="http://ratpoison.elektrubadur.se/mouseless_paste">RatPoison Wiki: mouseless
paste</a></li>
<li><a href="/space/autocutsel clipboard and primary patch">autocutsel clipboard and primary patch</a></li>
<li><a href="/space/control arrow keys in rxvt, tcsh, and emacs">control arrow keys in rxvt, tcsh, and emacs</a></li>
<li><a href="/space/Emacs and remote X Windows">Emacs and remote X Windows</a></li>
</ul>

  </content>

  <rdf:Seq>

<rdf:li>
<rdf:Description rdf:about="#1167832104.38">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> synchronizing GNU screen's paste buffer and the X selection </dc:title>
  <dc:creator> jorges </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    THANKS!
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1178526103.65">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> synchronizing GNU screen's paste buffer and the X selection </dc:title>
  <dc:creator> Dan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    That is nice, but I don't think you go far enough... What about mapping C-a to C-x (making commands much more Emacs finger friendly) ... For example, I am now totally stuck on C-a p for 'switching buffers' after C-a c in screen. For this to be 'Emacs' it should be C-x b...<br />
<br />
Removing the C-a would be a start...<br />
<br />
Thanks for the others though... but where is C-f / C-b ? did you already define that in your rvxt ? (for me it just kills copy mode) .<br />
<br />
I guess I am looking for a very Emacs like shell, without running shell in Emacs...
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1204084425.58">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> synchronizing GNU screen's paste buffer and the X selection </dc:title>
  <dc:creator> will </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    hrmm. im very willing to try this but what i really need is a way to have screen read from the clipboard. i need the file it uses if any. its fairly easy to do in screen irssi/other app via /exec appname command ie. in irssi {/exec firefox www.google.com} you dont really need the writing to clipboard. i need a way to make screen read clipboard. is it possible
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1205617372.21">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> synchronizing GNU screen's paste buffer and the X selection </dc:title>
  <dc:creator> raf </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    what about that?<br />
bindkey &lt; eval "stuff ' '" "exec sh -c 'xsel -o &gt; /tmp/screen-exchange'" readbuf
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1218523014.99">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> synchronizing GNU screen's paste buffer and the X selection </dc:title>
  <dc:creator> czadman </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    If you would like full featured keyboard control over firefox user vimperator extension for firefox. I know it is vim-like extension, but is quite powerful.<br />
<br />
Cheers
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1228399648.65">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> synchronizing GNU screen's paste buffer and the X selection </dc:title>
  <dc:creator> Gunnar Thielebein </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    this .screen config borks up vim completly but as you are emacs guy don't think this will bother you ;-)
  </content>
</rdf:Description>
</rdf:li>

  </rdf:Seq>
</rdf:Description>
</rdf:RDF>
