-
-
Save hadisfr/eff8a0a7134aae7017cc9d3977dae869 to your computer and use it in GitHub Desktop.
Emacs-nox <-> X11 clipboard transfer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; You need "xsel" program. | |
(defun x-paste () | |
"insert text on X11's clipboard to current buffer." | |
(interactive) | |
(insert (shell-command-to-string "xsel -b"))) | |
(defun x-copy () | |
"copy text on local kill-ring to X11's clipboard." | |
(interactive) | |
(copy-region-as-kill (point) (mark t)) | |
(let ((process-connection-type nil)) | |
(let ((proc (start-process "xsel" "*Messages*" "xsel" "-i" "-b"))) | |
(process-send-string proc (car kill-ring)) | |
(process-send-eof proc)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment