Since I've been using whitespace.el, I've noticed that most of the
rectangle functions are very intrusive: they put whitespaces in unexpected
places. The reasons are:
1/ move-to-column doesn't make any difference between converting a tab into
space and adding spaces at the end of a line. This is now fixed.
2/ operate-on-rectangle does too much blind work, notably messing with the end
of the line even for functions like string-rectangle which shouldn't be
concerned.
So I've rewritten rect.el to correct these problems. The rectangle
functions now avoid inserting spaces in unwanted places, unless a prefix is
given for some of them, in which case the old behavior is (sort of) used. Here
are examples of the differences, if anybody wants to comment the changes I
propose. There's notably something on which I'm not completely decided yet:
for the functions with a prefix, we could push even farther the choice:
- don't add unnecessary blanks at all (no prefix)
- add blanks on non empty lines only
- add blanks blindly (current prefix meaning)
Given a rectangle on the following lines, corners are noted with `*' (white
spaces are converted to underscores):
123*45
1234
123
12
12345678*90
delete-rectangle:
================
old one / new one with a prefix:
-------------------------------
123
123
123
12_
___
12390
new one without prefix:
----------------------
123
123
123
12
12390
open-rectangle:
==============
old one:
-------
123_____45
123_____4
123_____
12_____
_____
123_____4567890
new one with a prefix:
---------------------
123_____45
123_____4
123_____
12______
________
123_____4567890
new one without prefix:
----------------------
123_____45
123_____4
123
12
123_____4567890
string-rectangle ("***"):
========================
old one:
-------
123***45_____
123***4_
123***_____
12 ***_____
***_____
123***4567890
new one:
-------
123***45
123***4
123***
12 ***
***
123***4567890
clear-rectangle:
===============
old one / new one with a prefix:
-------------------------------
123_____
123_____
123_____
12______
________
123_____90
new one without prefix:
------------------------
123
123
123
12
123_____90
--
/ / _ _ Didier Verna
http://www.inf.enst.fr/~verna/
- / / - / / /_/ / ENST, INFRES C201.1 mailto:vernaļ¼ inf.enst.fr
/_/ / /_/ / /__ / 46 rue Barrault Tel. +33 (1) 45 81 73 46
75013 Paris, France Fax. +33 (1) 45 81 31 19