Skip to content

Instantly share code, notes, and snippets.

@ramen
Created October 1, 2010 21:38
Show Gist options
  • Save ramen/606906 to your computer and use it in GitHub Desktop.
Save ramen/606906 to your computer and use it in GitHub Desktop.
(defun move-region-up (arg)
(interactive "p")
(unless mark-active (mark-line 1))
(kill-region (region-beginning) (region-end))
(unwind-protect
(forward-line (- arg))
(yank))
(setq deactivate-mark nil))
(defun move-region-down (arg)
(interactive "p")
(unless mark-active (mark-line 1))
(kill-region (region-beginning) (region-end))
(unwind-protect
(forward-line arg)
(yank))
(setq deactivate-mark nil))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment