<rdf:Description rdf:about="http://snarfed.org/space/Emacs%20and%20remote%20X%20Windows">
  <dc:title> Emacs and remote X Windows </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-2009 Ryan Barrett </dc:rights>

  <content>
    <p><a href="http://gnu.org/software/emacs/"><img src="/space/gnu.jpg" alt="gnu.jpg" title="" /></a></p>

<p>I
work at home occasionally, using plain old SSH to VPN in to work. I forward X
Windows over SSH, so I can run shells and
<a href="http://gnu.org/software/emacs/">Emacs</a> on my work machine and display them
locally on my laptop.</p>

<p>This works ok, but it can be dog slow at times. The biggest annoyance is the
kill ring. Whenever Emacs kills or yanks text, it synchronizes itself with the X
Windows clipboard so you can copy and paste between Emacs and other apps.
However, I don't do that much, and it causes a noticeable lag if you're
displaying remotely. So, I turn it off with this elisp in <a href="/space/dotfiles/emacs">my
.emacs</a>:</p>

<div class='p-shadow'><pre><code>(setq interprogram-cut-function nil)
(setq interprogram-paste-function nil)
</code></pre></div>

<p><br class='clearing' />Of course, the obvious drawback is that you suddently can't copy or paste
between Emacs and other programs. When I need to, I use this elisp:</p>

<div class='p-shadow'><pre><code>(global-set-key [(escape) (meta w)]
  (lambda ()
    (interactive)
    (eval-expression
      '(setq interprogram-cut-function
             'x-select-text))
    (kill-ring-save (region-beginning) (region-end))
    (eval-expression
      '(setq interprogram-cut-function nil))))

(global-set-key [(escape) (control y)]
  (lambda ()
    (interactive)
    (eval-expression
      '(setq interprogram-paste-function
             'x-cut-buffer-or-selection-value))
    (yank)
    (eval-expression
      '(setq interprogram-paste-function nil))))
</code></pre></div>

<p><br class='clearing' />This binds <strong>Esc M-w</strong> to copy to the X selection and <strong>Esc C-y</strong> to paste from
the X selection or cut buffer.</p>

<p>See also:</p>

<ul>
<li><a href="/space/emacs X resources">emacs X resources</a></li>
<li><a href="/space/synchronizing GNU screen's paste buffer and the X selection">synchronizing GNU screen's paste buffer and the X
selection</a></li>
<li><a href="/space/why I don't run shells inside Emacs">why I don't run shells inside Emacs</a></li>
</ul>

  </content>

  <rdf:Seq>

<rdf:li>
<rdf:Description rdf:about="#1125998366.0">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> Emacs and remote X Windows-1 </dc:title>
  <dc:creator> t_therkelsen </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    
Thanks for this little tidbit of info.  No more twiddling my thumbs on ctrl-k's :-)<p class="paragraph"/>Oh, btw, at least in XEmacs you can use C-insert (copy) and Sh-insert (paste) to use the clipboard-sharing copy feature.  Don't know if this works in Emacs, though.<p class="paragraph"/>/TT

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

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