[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

kill-rectangle, yank-rectangle and copy-rectangle

From: Antti Sykäri
Subject: kill-rectangle, yank-rectangle and copy-rectangle
Date: Tue, 28 Aug 2001 22:44:11 +0300
User-agent: Mutt/1.2.5i


I found that GNU Emacs, version 20.7.2, has commands kill-rectangle and
yank-rectangle, but it is missing a command which would copy a rectangle. I
think that having one would be more consistent; copying rectangular regions
should implemented as well as copying normal regions (M-w).

Now you would have to do the following in order to copy a rectangular

<Select a region>
C-x r k          ; kill the region
<Go to upper left corner of the place where the region was>
C-x r y          ; copy the region back

and then do whatever you wanted to do with the copied rectangle in the first

A friend of mine worked around this with the following kludge:

(defun copy-rectangle (start end) (interactive "r")
  (let ((point (point)))
    (kill-rectangle start end) (goto-char start)
    (yank-rectangle) (goto-char point)))

Of course, real implementation might be something similar to kill-region (I
haven't looked into the elisp code.)

I also am of the humble opinion that the keyboard commands for those two
were set somewhat non-sensibly. Currently these keys are:

C-x r k     kill-rectangle
C-x r y     yank-rectangle

I would find it much more logical and consistent if these would be,
for example (this is how I configured them since I don't want to learn
two sets for keys for cut'n'paste):

C-x r M-w   copy-rectangle
C-x r C-y   yank-rectangle
C-x r C-w   kill-rectangle

These are similar to M-w (copy), C-w (kill) and C-y (paste).


Antti Sykäri

reply via email to

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