* Re: DWIM when yanking strings with leading or trailing spaces - an idea
[not found] <mailman.6655.1457033503.843.help-gnu-emacs@gnu.org>
@ 2016-03-03 23:25 ` Joost Kremers
2016-03-04 6:06 ` Marcin Borkowski
[not found] ` <mailman.6683.1457071595.843.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 8+ messages in thread
From: Joost Kremers @ 2016-03-03 23:25 UTC (permalink / raw)
To: help-gnu-emacs
Marcin Borkowski wrote:
> --8<---------------cut here---------------start------------->8---
> aaa bbb ccc ddd eee fff
> --8<---------------cut here---------------end--------------->8---
>
> into
>
> --8<---------------cut here---------------start------------->8---
> aaa ddd eee bbb ccc fff
> --8<---------------cut here---------------end--------------->8---
,----
| aaa bbb ccc ddd! eee fff
`----
M-- M-2 M-t M-3 M-f M-- M-2 M-t
Et voilà! ;-)
--
Joost Kremers joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: DWIM when yanking strings with leading or trailing spaces - an idea
2016-03-03 23:25 ` DWIM when yanking strings with leading or trailing spaces - an idea Joost Kremers
@ 2016-03-04 6:06 ` Marcin Borkowski
[not found] ` <mailman.6683.1457071595.843.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 8+ messages in thread
From: Marcin Borkowski @ 2016-03-04 6:06 UTC (permalink / raw)
To: Joost Kremers; +Cc: help-gnu-emacs
On 2016-03-04, at 00:25, Joost Kremers <joost.m.kremers@gmail.com> wrote:
> Marcin Borkowski wrote:
>> --8<---------------cut here---------------start------------->8---
>> aaa bbb ccc ddd eee fff
>> --8<---------------cut here---------------end--------------->8---
>>
>> into
>>
>> --8<---------------cut here---------------start------------->8---
>> aaa ddd eee bbb ccc fff
>> --8<---------------cut here---------------end--------------->8---
>
>
> ,----
> | aaa bbb ccc ddd! eee fff
> `----
>
> M-- M-2 M-t M-3 M-f M-- M-2 M-t
>
> Et voilà! ;-)
OK, I can also prove that every permutation can be decomposed into
a superposition of transpositions.
;-)
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.6683.1457071595.843.help-gnu-emacs@gnu.org>]
* Re: DWIM when yanking strings with leading or trailing spaces - an idea
[not found] ` <mailman.6683.1457071595.843.help-gnu-emacs@gnu.org>
@ 2016-03-04 8:50 ` Joost Kremers
2016-03-04 9:11 ` Marcin Borkowski
[not found] ` <mailman.6691.1457083030.843.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 8+ messages in thread
From: Joost Kremers @ 2016-03-04 8:50 UTC (permalink / raw)
To: help-gnu-emacs
EN:SiS(9)
Marcin Borkowski wrote:
> OK, I can also prove that every permutation can be decomposed into
> a superposition of transpositions.
>
> ;-)
By all means. ;-)
I just wanted to say (but perhaps I should actually have said it ;-)
that I personally rarely find myself wishing Emacs would insert that
extra space. I either use transpose-words couple of times, with or
without prefix arguments, or I kill the relevant word together with a
space before or after and yank it in such a way that that space is in
the right position. (I admit I get it wrong sometimes...)
What I do run into from time to time, is wanting to transpose clauses
within a sentence and having to manually adjust the punctuation and
possibly an "and" or an "or". But I suspect we'll have to plug Emacs
into Skynet first before it can be taught to autocorrect such cases.
Anyway, my opinion shouldn't stop you from creating such a package, of
course. I mean, it bugs you, so that should be enough of a reason,
right? ;-)
--
Joost Kremers joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: DWIM when yanking strings with leading or trailing spaces - an idea
2016-03-04 8:50 ` Joost Kremers
@ 2016-03-04 9:11 ` Marcin Borkowski
[not found] ` <mailman.6691.1457083030.843.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 8+ messages in thread
From: Marcin Borkowski @ 2016-03-04 9:11 UTC (permalink / raw)
To: Joost Kremers; +Cc: help-gnu-emacs
On 2016-03-04, at 09:50, Joost Kremers <joost.m.kremers@gmail.com> wrote:
> EN:SiS(9)
> Marcin Borkowski wrote:
>> OK, I can also prove that every permutation can be decomposed into
>> a superposition of transpositions.
>>
>> ;-)
>
> By all means. ;-)
>
> I just wanted to say (but perhaps I should actually have said it ;-)
> that I personally rarely find myself wishing Emacs would insert that
> extra space. I either use transpose-words couple of times, with or
> without prefix arguments, or I kill the relevant word together with a
> space before or after and yank it in such a way that that space is in
> the right position. (I admit I get it wrong sometimes...)
And in my case, the problem happens more often. The reason is that
I work in a journal as a copyeditor/proofreader, and I move around whole
clauses quite a lot.
> What I do run into from time to time, is wanting to transpose clauses
> within a sentence and having to manually adjust the punctuation and
> possibly an "and" or an "or". But I suspect we'll have to plug Emacs
> into Skynet first before it can be taught to autocorrect such cases.
In one case, it's easy: I have a function which inserts a dash, killing
any other punctuation in that place, and if region is active, it
surrounds it with dashes. /Extremely/ useful. Also, this:
http://mbork.pl/2015-10-31_Smart_comma_and_other_punctuation .
> Anyway, my opinion shouldn't stop you from creating such a package, of
> course. I mean, it bugs you, so that should be enough of a reason,
>
> right? ;-)
Yes and no. It's on the limit of the "automation horizon" (see
https://xkcd.com/1205/) ;-)
Best,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.6691.1457083030.843.help-gnu-emacs@gnu.org>]
* Re: DWIM when yanking strings with leading or trailing spaces - an idea
[not found] ` <mailman.6691.1457083030.843.help-gnu-emacs@gnu.org>
@ 2016-03-04 9:45 ` Joost Kremers
2016-03-04 12:57 ` Marcin Borkowski
0 siblings, 1 reply; 8+ messages in thread
From: Joost Kremers @ 2016-03-04 9:45 UTC (permalink / raw)
To: help-gnu-emacs
Marcin Borkowski wrote:
> In one case, it's easy: I have a function which inserts a dash, killing
> any other punctuation in that place, and if region is active, it
> surrounds it with dashes. /Extremely/ useful. Also, this:
> http://mbork.pl/2015-10-31_Smart_comma_and_other_punctuation .
Nice.
For me, though, this:
,----
| And now that I have this, I think I could do a similar thing with C-t,
| so that it transposes two chars before the point (as opposed as two
| chars around the point) if there is a space before the point.
`----
would be a bad idea, because I often use `transpose-chars' to correct
things like "th emistake". Which I unfortunately type quite often...
>> Anyway, my opinion shouldn't stop you from creating such a package, of
>> course. I mean, it bugs you, so that should be enough of a reason,
>>
>> right? ;-)
>
> Yes and no. It's on the limit of the "automation horizon" (see
> https://xkcd.com/1205/) ;-)
So you basically posted your question looking for an excuse to do some
coding? ;-)
--
Joost Kremers joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: DWIM when yanking strings with leading or trailing spaces - an idea
2016-03-04 9:45 ` Joost Kremers
@ 2016-03-04 12:57 ` Marcin Borkowski
0 siblings, 0 replies; 8+ messages in thread
From: Marcin Borkowski @ 2016-03-04 12:57 UTC (permalink / raw)
To: Joost Kremers; +Cc: help-gnu-emacs
On 2016-03-04, at 10:45, Joost Kremers <joost.m.kremers@gmail.com> wrote:
> Marcin Borkowski wrote:
>> In one case, it's easy: I have a function which inserts a dash, killing
>> any other punctuation in that place, and if region is active, it
>> surrounds it with dashes. /Extremely/ useful. Also, this:
>> http://mbork.pl/2015-10-31_Smart_comma_and_other_punctuation .
>
> Nice.
Thanks!
> For me, though, this:
>
> ,----
> | And now that I have this, I think I could do a similar thing with C-t,
> | so that it transposes two chars before the point (as opposed as two
> | chars around the point) if there is a space before the point.
> `----
>
> would be a bad idea, because I often use `transpose-chars' to correct
> things like "th emistake". Which I unfortunately type quite often...
Ah, I see. I seldom make this kind of mistake. Though it turned out
I didn't do that anyway.
>>> Anyway, my opinion shouldn't stop you from creating such a package, of
>>> course. I mean, it bugs you, so that should be enough of a reason,
>>>
>>> right? ;-)
>>
>> Yes and no. It's on the limit of the "automation horizon" (see
>> https://xkcd.com/1205/) ;-)
>
> So you basically posted your question looking for an excuse to do some
> coding? ;-)
Exactly. ;-) As Emperor Palpatine once put it, "now feel the power of
procrastination!"
Best,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
^ permalink raw reply [flat|nested] 8+ messages in thread
* DWIM when yanking strings with leading or trailing spaces - an idea
@ 2016-03-03 19:31 Marcin Borkowski
2016-03-03 19:45 ` Kaushal Modi
0 siblings, 1 reply; 8+ messages in thread
From: Marcin Borkowski @ 2016-03-03 19:31 UTC (permalink / raw)
To: Help Gnu Emacs mailing list
Hi folks,
take this example:
--8<---------------cut here---------------start------------->8---
Lorem ipsum -!-dolor sit amet.
--8<---------------cut here---------------end--------------->8---
As usual, -!- denotes the point (which can be here because e.g. of an
earlier C-left).
Now press C-backspace, C-right, C-y.
This is the result:
--8<---------------cut here---------------start------------->8---
Lorem doloripsum sit amet.
--8<---------------cut here---------------end--------------->8---
Some other text processing software, whose name will not be mentioned,
does "the right thing" in such a case, i.e., produces
--8<---------------cut here---------------start------------->8---
Lorem dolor ipsum sit amet.
--8<---------------cut here---------------end--------------->8---
Why couldn't Emacs do this? Of course, optionally. I could spend some
time working on this issue, and e.g. submit the result to Elpa. Would
anyone be interested?
Of course, this particular example is rather bad, since a simple M-t
would do. But you get the idea, and quite often transposing is not
enough, e.g., when you want to transform
--8<---------------cut here---------------start------------->8---
aaa bbb ccc ddd eee fff
--8<---------------cut here---------------end--------------->8---
into
--8<---------------cut here---------------start------------->8---
aaa ddd eee bbb ccc fff
--8<---------------cut here---------------end--------------->8---
Best,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-03-04 12:57 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.6655.1457033503.843.help-gnu-emacs@gnu.org>
2016-03-03 23:25 ` DWIM when yanking strings with leading or trailing spaces - an idea Joost Kremers
2016-03-04 6:06 ` Marcin Borkowski
[not found] ` <mailman.6683.1457071595.843.help-gnu-emacs@gnu.org>
2016-03-04 8:50 ` Joost Kremers
2016-03-04 9:11 ` Marcin Borkowski
[not found] ` <mailman.6691.1457083030.843.help-gnu-emacs@gnu.org>
2016-03-04 9:45 ` Joost Kremers
2016-03-04 12:57 ` Marcin Borkowski
2016-03-03 19:31 Marcin Borkowski
2016-03-03 19:45 ` Kaushal Modi
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).