From: Kaushal Modi <kaushal.modi@gmail.com>
To: Joost Kremers <joostkremers@fastmail.fm>
Cc: help-gnu-emacs@gnu.org
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 [thread overview]
Message-ID: <CAFyQvY3qjF5kWg36+-RAO2mXXU2sPxF37SJGyCUDPwjQyMt4MQ@mail.gmail.com> (raw)
In-Reply-To: <87lgpwliqa.fsf@fastmail.fm>
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
next prev parent reply other threads:[~2017-05-16 19:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-16 16:34 Is it possible to move a column where column on right is variable width Angus Comber
2017-05-16 17:38 ` Kaushal Modi
2017-05-16 19:11 ` Joost Kremers
2017-05-16 19:23 ` Emanuel Berg
2017-05-16 19:32 ` Kaushal Modi [this message]
2017-05-16 18:51 ` Tomas Nordin
2017-05-16 19:14 ` Emanuel Berg
2017-05-16 21:56 ` Tomas Nordin
2017-05-17 1:17 ` Skip Montanaro
2017-05-17 2:05 ` Ben Bacarisse
2017-05-17 6:22 ` Loris Bennett
2017-05-18 6:17 ` hector
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFyQvY3qjF5kWg36+-RAO2mXXU2sPxF37SJGyCUDPwjQyMt4MQ@mail.gmail.com \
--to=kaushal.modi@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=joostkremers@fastmail.fm \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).