emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: is this possible using the new rectangle mark mode?


From: Thierry Volpiatto
Subject: Re: is this possible using the new rectangle mark mode?
Date: Sat, 01 Feb 2014 08:24:16 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> kill a rectangle marked region ending with a line that is not the
>> longest line like:
>
>>     aaaaaaaaaaaaaaaaaaaaa
>>     bbbbbbbbbbbbbbbb
>>     ccccccccc
>
> The "new rectangle-mark-mode" just provides a different UI to the
> same old rectangle commands available since forever.  So yes for the
> above: put point before the first "c" then C-x SPC then move cursor to
> after the last "a" and finally C-w.
>
>> and yank it to these lines:
>
>>     1
>>     2
>>     3
>
> Yup: put point before "1" and hit C-y.
>
>> and I want it to be either this:
>
>>     aaaaaaaaaaaaaaaaaaaaa1
>>     bbbbbbbbbbbbbbbb2
>>     ccccccccc3
>
> No, this is not a rectangle.
>
>> or this one:
>
>>     aaaaaaaaaaaaaaaaaaaaa1
>>     bbbbbbbbbbbbbbbb     2
>>     ccccccccc            3
>
> Yes, that's the one you should get.
>
> And yes, the first question's answer would have been "no" if the longest
> line was the "bbb" one.

Just tried the new rectangle-mark-mode and I like it.

For the above what you need is a `extend-rectangle-to-end' function:

Mark a small rectangle on the first characters and
extend it to end (bound here to C-x r e):

bbbbbbbbbbbbbbbb
aaaaaaaaaaaaaaaaaaaaa
ccccccccc

now you have (marked):

bbbbbbbbbbbbbbbb     
aaaaaaaaaaaaaaaaaaaaa
ccccccccc            

Hit C-x r k
Go to 1 and C-x r y

bbbbbbbbbbbbbbbb     1
aaaaaaaaaaaaaaaaaaaaa2
ccccccccc            3


You can find this function at:

https://github.com/thierryvolpiatto/emacs-tv-config/blob/master/rectangle-utils.el

--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997




reply via email to

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