unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
Subject: Re: copy-rectangle-to-kill-ring
Date: Wed, 10 Jan 2007 23:14:09 -0700	[thread overview]
Message-ID: <eo4kjg$ipm$1@sea.gmane.org> (raw)
In-Reply-To: <eo28mk$lkl$1@sea.gmane.org>

Kevin Rodgers wrote:
> Wilmar Igl wrote:
>> sorry, I don't want to  be a nuisance. However, I'd like to suggest to
>> include a function to copy a rectangle into the kill ring which is not 
>> available at the moment (only copy-rectangle-to-register).
> 
> Do you mean "copy a rectangle so that `C-x r y' can insert it"?  Or do
> you mean "copy a rectangle so that `C-y' can insert it"?
> 
> If the former, this should do the job:
> 
> (defun copy-rectangle-as-kill (beg end)
>   "Copy rectangular region into `killed-rectangle', but don't delete it.
> The rectangle can then be yanked via \\[yank-rectangle]."
>   (interactive "r")
>   (setq killed-rectangle (extract-rectangle beg end)))

Or if the latter, how about:

(defun copy-rectangle-as-kill-region (beg end)
   "Copy rectangular region into the kill ring, but don't delete it.
The text can then be yanked via \\[yank]."
   ;; Based on copy-region-as-kill, but with no filtering:
   (interactive "r")
   (let ((text (mapconcat 'identity (extract-rectangle beg end) "\n")))
     (if (eq last-command 'kill-region)
	(kill-append text (< end beg))
       (kill-new text)))
   (if transient-mark-mode
       (setq deactivate-mark t))
   nil)

-- 
Kevin Rodgers
Denver, Colorado, USA

      reply	other threads:[~2007-01-11  6:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-04 18:40 copy-rectangle-to-kill-ring Wilmar Igl
2007-01-05 17:35 ` copy-rectangle-to-kill-ring Kevin Rodgers
2007-01-10  8:38 ` copy-rectangle-to-kill-ring Kevin Rodgers
2007-01-11  6:14   ` Kevin Rodgers [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='eo4kjg$ipm$1@sea.gmane.org' \
    --to=kevin.d.rodgers@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).