[Top][All Lists]

[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 <address@hidden>

> > 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 :)

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
rectangle gets copied:


.. which was not the intention.

But with this advice, \\[universal-argument] \\[copy-rectangle-as-kill] on
same region will copy the below rectangle:


.. 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

reply via email to

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