From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.bugs Subject: Re: copy-rectangle-to-kill-ring Date: Wed, 10 Jan 2007 23:14:09 -0700 Message-ID: References: <459D4A35.3060403@zksw.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1168496066 19443 80.91.229.12 (11 Jan 2007 06:14:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 11 Jan 2007 06:14:26 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jan 11 07:14:25 2007 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1H4tCi-0002vp-5U for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Jan 2007 07:14:24 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H4tCh-0007rV-Qj for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Jan 2007 01:14:23 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H4tCf-0007rQ-2x for bug-gnu-emacs@gnu.org; Thu, 11 Jan 2007 01:14:21 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H4tCc-0007rE-P7 for bug-gnu-emacs@gnu.org; Thu, 11 Jan 2007 01:14:20 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H4tCc-0007rB-Jy for bug-gnu-emacs@gnu.org; Thu, 11 Jan 2007 01:14:18 -0500 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1H4tCc-0004LH-9W for bug-gnu-emacs@gnu.org; Thu, 11 Jan 2007 01:14:18 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1H4tCY-0008UI-MX for bug-gnu-emacs@gnu.org; Thu, 11 Jan 2007 07:14:14 +0100 Original-Received: from c-24-9-156-178.hsd1.co.comcast.net ([24.9.156.178]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 11 Jan 2007 07:14:14 +0100 Original-Received: from kevin.d.rodgers by c-24-9-156-178.hsd1.co.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 11 Jan 2007 07:14:14 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: bug-gnu-emacs@gnu.org Original-Lines: 35 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: c-24-9-156-178.hsd1.co.comcast.net User-Agent: Thunderbird 1.5.0.9 (Macintosh/20061207) In-Reply-To: X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:15522 Archived-At: 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