From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mathias Dahl Newsgroups: gmane.emacs.help Subject: Re: No copy-rectangle-as-kill? Date: Wed, 01 Jun 2005 15:01:52 +0200 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1117630896 881 80.91.229.2 (1 Jun 2005 13:01:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 1 Jun 2005 13:01:36 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jun 01 15:01:30 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DdSpA-0004f7-L6 for geh-help-gnu-emacs@m.gmane.org; Wed, 01 Jun 2005 14:59:56 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DdSuS-0004jR-NP for geh-help-gnu-emacs@m.gmane.org; Wed, 01 Jun 2005 09:05:24 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 29 Original-X-Trace: individual.net 20Txj7zN99kapHKpQNjTpQ0/6T3imHAz69DmWfx6dDBvenW9+V User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (windows-nt) Cancel-Lock: sha1:dpTnucOawIDHT4H1pmlNMa2CGfM= Original-Xref: shelby.stanford.edu gnu.emacs.help:131668 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:27128 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:27128 "Chris F.A. Johnson" writes: > On Wed, 01 Jun 2005 at 09:50 GMT, Hattuari wrote: >> Am I overlooking something, or is there no command in Emacs to copy a >> rectangle into the last killed rectangle "special place" without also >> removing it from the current buffer? I gotta tell y'all, XEmacs has better >> rectangle support than Emacs. ;) > > (defun copy-rectangle-as-kill () > (interactive) > (save-excursion > (kill-rectangle (mark) (point)) > (exchange-point-and-mark) > (yank-rectangle))) I like this better: (defun copy-rectangle-as-kill (start end) "Copy rectangle with corners at point and mark; save as last killed one. Calling from program, supply two args START and END, buffer positions. But in programs you might prefer to use `extract-rectangle'." (interactive "r") (setq killed-rectangle (extract-rectangle start end)) (message "Rectangle saved.")) It does not feel right to me messing with the buffer just to get a copy of some of it. /Mathias