Skip to content

Instantly share code, notes, and snippets.

@bmnn
Created December 20, 2013 07:04
Show Gist options
  • Save bmnn/8051364 to your computer and use it in GitHub Desktop.
Save bmnn/8051364 to your computer and use it in GitHub Desktop.
emacs; clipboard; insert; put;
;r;(url='https://groups.google.com/d/msg/gnu.emacs.help/I2_E_eJxrcc/iwpwMYTleY0J')
(defun clipboard-get ()
"Visit clipboard-temp-file, delete all text in it, yank the X
clipboard, delete trailing whitespace, go to beginning of
buffer."
(interactive)
(delete-region (point-min) (point-max))
(clipboard-yank)
(delete-trailing-whitespace)
(goto-char (point-min)))
(defun clipboard-put ()
"Copy the whole buffer to the X clipboard, kill it."
(interactive)
(clipboard-kill-ring-save (point-min) (point-max))
(save-buffer)
)
(global-set-key "\C-xg" 'clipboard-get)
(global-set-key "\C-xp" 'clipboard-put)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment