Skip to content

Instantly share code, notes, and snippets.

@v2e4lisp
Created August 6, 2014 05:28
Show Gist options
  • Save v2e4lisp/3f03b629ee84642086c1 to your computer and use it in GitHub Desktop.
Save v2e4lisp/3f03b629ee84642086c1 to your computer and use it in GitHub Desktop.
copy to clipboard from emacs in terminal
;; copy to clipboard from emacs in terminal
;;
;; if you use emacs in tmux you should enable pbcopy in tmux first
;; http://superuser.com/questions/231130/unable-to-use-pbcopy-while-in-tmux-session
(defun pbcopy-region (start end)
(interactive "r")
(pbcopy (buffer-substring start end)))
(defun pbcopy (string)
(shell-command (concat "echo "
(shell-quote-argument string)
" | pbcopy")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment