[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is it possible to move a column where column on right is variable wi
From: |
Kaushal Modi |
Subject: |
Re: Is it possible to move a column where column on right is variable width |
Date: |
Tue, 16 May 2017 19:32:33 +0000 |
On Tue, May 16, 2017 at 3:11 PM Joost Kremers <joostkremers@fastmail.fm>
wrote:
> > As the Description portion of the data is not of equal width,
> > using
> > rectanges gets tricky.
>
> Unless you do the totally uncool thing of adding enough spaces to
> the final line so that you can create a rectangle of the
> appropriate size. It'll cost you some geek points, but it gets the
> job done. ;-)
>
I had ended up doing a "thesis" on that topic a while back. The resultant
solution adds the right number of spaces temporarily to get the widest
required rectangle without modifying the buffer :)
https://github.com/kaushalmodi/.emacs.d/blob/df25c8cd0d84ec2af647e92db2c0c19e3097d035/setup-files/setup-editing.el#L507-L630
The main logic is inside modi/extend-rectangle--core, but then I apply it
to different function to "do the right thing".
>From the doc-string of modi/advice-select-rectangle-to-end in that code:
"Extract the rectangle so that the longest line of region is completely
included when the prefix \\[universal-argument] is used.
In the below example, ▯ is the mark and ▮ is the point.
a =▯12345;
b = 6;▮
If that region is selected and if we do \\[copy-rectangle-as-kill], the
following
rectangle gets copied:
12
6;
.. which was not the intention.
But with this advice, \\[universal-argument] \\[copy-rectangle-as-kill] on
that
same region will copy the below rectangle:
12345;
6;
.. which obviously was the actual intention.
Similar rectangle extension behavior is applied when using the
prefix \\[universal-argument] with similarly advised functions too."
--
Kaushal Modi
- Is it possible to move a column where column on right is variable width, Angus Comber, 2017/05/16
- Re: Is it possible to move a column where column on right is variable width, Kaushal Modi, 2017/05/16
- Re: Is it possible to move a column where column on right is variable width, Tomas Nordin, 2017/05/16
- Re: Is it possible to move a column where column on right is variable width, Skip Montanaro, 2017/05/16
- Re: Is it possible to move a column where column on right is variable width, Ben Bacarisse, 2017/05/16
- Re: Is it possible to move a column where column on right is variable width, Loris Bennett, 2017/05/17
- Re: Is it possible to move a column where column on right is variable width, hector, 2017/05/18