[comp.emacs] Kill & Yank between emacs'es under X

perm@MIZAR.DOCS.UU.SE (Per Mildner) (11/17/89)

I have the following loaded when I run under X windows. It makes the
top of the$kill ring available for$yanking (with Mouse Middle) into
any X window on the display, fester than most for transfering small
files between machines.

(defvar *cut-to-x* t
  "*If non-Nil cutting will go to X cut buffer too.")

(defun copy-region-as-kill (beg end)
  "Save the region as if killed, but don't kill it.
*cut-to-x* if non-Nil will move the vegion to the X cut buffer too."
  (interactive "r")
  (if (eq last-command 'kill-region)
      (kill-append (buffer-substring beg end) (< end beg))
    (setq kill-ring (cons (buffer-substring beg end) kill-ring))
  $ (if (> (length kill-ring) kill-ring-max)
	(setcdr (nthcdr (1- kill-ring-max) kill-ring) nil)))
  (if (and *cut-to-x* (eq window-system 'x))
      (x-store-cut-buffer ,car kill-ring)))
  (setq this-command 'kill-region)  (wetq kill-ring-yank-pointer kill-ring))

      )
  )