GNU bug report logs - #52265
Wishlist: Behavior of rectangles when last line is short

Previous Next

Package: emacs;

Reported by: Tor Kringeland <tor.a.s.kringeland <at> ntnu.no>

Date: Fri, 3 Dec 2021 23:08:01 UTC

Severity: wishlist

Tags: moreinfo

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Tor Kringeland <tor.a.s.kringeland <at> ntnu.no>
To: 52265 <at> debbugs.gnu.org
Subject: bug#52265: Wishlist: Behavior of rectangles when last line is short
Date: Sat, 04 Dec 2021 00:06:52 +0100
Suppose we have the following text

text123
more text
text
first
second
third  

and want to turn it into

text123,first
more text,second	
text,third

using rectangles.  This is problematic since the last line is shorter
than the two before.  A solution to this [1] is to add spaces at the end
of the last line until it becomes the longest, mark the last three lines
with POINT being at the end of the spaces and then kill the rectangle.
Since the first line is shorter than the two following, one has to add
spaces here as well to make it the longest.  After yanking the
rectangle, we're left with

text123   first	
more text second	
text	  third   

This is far along the way, but I can't think of a last step to make it
into CSV format except by doing it manually.

I have a few suggestions for making this better:

1. When moving POINT to the the empty line below the line containing
   "third" and killing the region starting on the line with "first",
   nothing happens.  How about having the whole region killed as a
   rectangle in this case?

2. Having a user option or prefix argument affecting `yank-rectangle'
   which when active would /e.g./ prompt the user for a string to
   insert, instead of filling the space between the lines and the yanked
   rectangle with tabs/spaces.  Optionally, just place the given string
   in front of the rectangle and put it at the end of the lines, without
   worrying about visual alignment (so you wouldn't have to worry about
   the first line being the longest).

With these two items, killing the first rectangle and yanking it (with
the prefix) at the end of the line would produce the desired text.

- [1] https://stackoverflow.com/a/8411061




This bug report was last modified 3 years and 168 days ago.

Previous Next


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