Emacs and remote X Windows [![gnu.jpg](/space/gnu.jpg)](http://gnu.org/software/emacs/) 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 [Emacs](http://gnu.org/software/emacs/) on my work machine and display them locally on my laptop. 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 [my .emacs](http://ryan.barrett.name/dotfiles/emacs): (setq interprogram-cut-function nil) (setq interprogram-paste-function nil) 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: (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)))) This binds **Esc M-w** to copy to the X selection and **Esc C-y** to paste from the X selection or cut buffer. See also: * [emacs X resources](/space/emacs X resources) * [synchronizing GNU screen's paste buffer and the X selection](/space/synchronizing GNU screen's paste buffer and the X selection) * [why I don't run shells inside Emacs](/space/why I don't run shells inside Emacs)