Skip to content

Instantly share code, notes, and snippets.

@pclouds
Created March 25, 2009 02:44
Show Gist options
  • Save pclouds/84520 to your computer and use it in GitHub Desktop.
Save pclouds/84520 to your computer and use it in GitHub Desktop.
(defun xsel-select-text (text &optional push)
"See `x-select-text'."
(let* ((process-connection-type nil)
(proc (start-process "xsel" nil "xsel" "-b" "-i")))
(process-send-string proc text)
(process-send-eof proc)))
(defun xsel-selection-value ()
"See `x-cut-buffer-or-selection-value'."
(shell-command-to-string "xsel -b -o"))
;;;###autoload
(defun xsel-enable ()
(interactive)
(setq interprogram-cut-function 'xsel-select-text)
(setq interprogram-paste-function 'xsel-selection-value))
;;;###autoload
(defun xsel-disable ()
(interactive)
(setq interprogram-cut-function nil)
(setq interprogram-paste-function nil))
(provide 'xsel)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment