Last active
July 3, 2023 11:58
-
-
Save ossdev-somewhere/4362498 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-string (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