bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#55828: Add command to edit a rectangle arbitrarily in a separate buf


From: Phil Sainty
Subject: bug#55828: Add command to edit a rectangle arbitrarily in a separate buffer
Date: Tue, 07 Jun 2022 21:24:30 +1200
User-agent: Orcon Webmail

At https://debbugs.gnu.org/cgi/bugreport.cgi?bug=55234#11 Michael Heerdegen wrote:
I implemented a command that lets me edit a rectangular region
in a separate buffer

I've had one of those for years as well, and always intended to
work on it some more and propose it as a standard feature.

I bind it to "C-x r e", with "C-c C-c" to write the rectangle back
to the original buffer after editing.

There are a lot of special-purpose "do X to a rectangle" commands,
but I think a command which lets you do *absolutely anything* to
a rectangle is extremely useful, and a buffer with only that text
gives you that ability pretty trivially.  I think Emacs should have
this in its standard rectangle toolkit; so here's a new feature
request for that.

For reference I've attached my version.  It's old code which knows
nothing of `rectangle-mark-mode' or other newer things, and it has
the notable flaw of introducing trailing whitespace if the rectangular
region had intersected any line endings (something I'd intended to
address before suggesting this); but it's always done the job when
I've needed it, so I'm attaching it as-is (aside from renaming it to
`rectangle-edit' which seems to be an available name-space for such
a feature).

It sounds to me as if Michael's code does more than mine -- at minimum
mine does not ask what to do with modified dimensions as described at
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=55234#17 (I just use the
original dimensions), so I'd be interested to see that.


-Phil

Attachment: rectangle-edit.el
Description: Text Data


reply via email to

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