[Top][All Lists]

[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 (X11/20070622)


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))
      (previous-line arg)

(defun move-region-down (arg)
  (interactive "p")
  (kill-region (region-beginning) (region-end))
      (next-line arg)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]