--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
Subject: |
confirm 2a6ed1370e3de638ad83b341fc2013495b16e55e |
If you reply to this message, keeping the Subject: header intact,
Mailman will discard the held message. Do this if the message is
spam. If you reply to this message and include an Approved: header
with the list password in it, the message will be approved for posting
to the list. The Approved: header can also appear in the first line
of the body of the reply.
--- End Message ---