Skip to content

Instantly share code, notes, and snippets.

@cybniv
Forked from yorickvP/wl-clipboard.el
Created November 12, 2019 14:18
Show Gist options
  • Save cybniv/447618be3263fc4a786ae137d7366e86 to your computer and use it in GitHub Desktop.
Save cybniv/447618be3263fc4a786ae137d7366e86 to your computer and use it in GitHub Desktop.
teach emacs to use wl-copy
(setq wl-copy-process nil)
(defun wl-copy (text)
(setq wl-copy-process (make-process :name "wl-copy"
:buffer nil
:command '("wl-copy" "-f" "-n")
:connection-type 'pipe))
(process-send-string wl-copy-process text)
(process-send-eof wl-copy-process))
(defun wl-paste ()
(if (and wl-copy-process (process-live-p wl-copy-process))
nil ; should return nil if we're the current paste owner
(shell-command-to-string "wl-paste -n | tr -d \r")))
(setq interprogram-cut-function 'wl-copy)
(setq interprogram-paste-function 'wl-paste)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment