Skip to content

Instantly share code, notes, and snippets.

@krbullock
Created March 26, 2012 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krbullock/2206167 to your computer and use it in GitHub Desktop.
Save krbullock/2206167 to your computer and use it in GitHub Desktop.
Here's a better way:
(defun jeg2s-yank-and-select ()
"This is a test command for how to create a selection."
(interactive)
(let (deactivate-mark)
(kill-new "selected")
(yank)
(exchange-point-and-mark)))
(global-set-key (kbd "C-c y") 'jeg2s-yank-and-select)
; See http://www.gnu.org/software/emacs/manual/html_node/elisp/The-Mark.html#index-deactivate_002dmark-2507
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment