[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Moving regions up and down by lines
From: |
Dave Benjamin |
Subject: |
Moving regions up and down by lines |
Date: |
Sat, 30 Jun 2007 10:25:35 -0700 |
User-agent: |
Mozilla-Thunderbird 2.0.0.4 (X11/20070622) |
Greetings,
I have these two functions defined, which allow me to move the region up
and down by one or more lines, displacing the text around it. This works
pretty well, but after the call to yank, the region is no longer
selected (I use transient-mark-mode). I've tried calling
exchange-point-and-mark after the yank, but it has no effect. Does
anyone know how to accomplish this?
(defun move-region-up (arg)
(interactive "p")
(kill-region (region-beginning) (region-end))
(unwind-protect
(previous-line arg)
(yank)))
(defun move-region-down (arg)
(interactive "p")
(kill-region (region-beginning) (region-end))
(unwind-protect
(next-line arg)
(yank)))
Thanks,
Dave
- Moving regions up and down by lines,
Dave Benjamin <=