all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dave Benjamin <ramen@lackingtalent.com>
To: help-gnu-emacs@gnu.org
Subject: Moving regions up and down by lines
Date: Sat, 30 Jun 2007 10:25:35 -0700	[thread overview]
Message-ID: <smwhi.542100$6P2.509197@newsfe16.phx> (raw)

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

             reply	other threads:[~2007-06-30 17:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-30 17:25 Dave Benjamin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-06-30 21:32 Moving regions up and down by lines martin rudalics
     [not found] <mailman.2886.1183239069.32220.help-gnu-emacs@gnu.org>
2007-07-01  6:48 ` Dave Benjamin
2007-07-01 12:05 martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='smwhi.542100$6P2.509197@newsfe16.phx' \
    --to=ramen@lackingtalent.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.