GNU bug report logs - #55828
Add command to edit a rectangle arbitrarily in a separate buffer

Previous Next

Package: emacs;

Reported by: Phil Sainty <psainty <at> orcon.net.nz>

Date: Tue, 7 Jun 2022 09:25:01 UTC

Severity: wishlist

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Phil Sainty <psainty <at> orcon.net.nz>
To: bug-gnu-emacs <at> gnu.org
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>
Subject: Add command to edit a rectangle arbitrarily in a separate buffer
Date: Tue, 07 Jun 2022 21:24:30 +1200
[Message part 1 (text/plain, inline)]
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
[rectangle-edit.el (text/x-lisp, attachment)]

This bug report was last modified 2 years and 361 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.