anchored-transpose.el (a newer version is in nXhtml - but it might miss the fuzziness) defines an interactive autoloaded function to transpose portions of a region around an anchor phrase.
In other words it swaps 2 regions. For example:
`this phrase but not that word' can be transposed into `that word but not this phrase'
Here’s how.
I want this phrase but not that word. | | This is the entire phrase. | | `but not' is the anchor phrase.
First select the entire phrase and type C-x t. Then select the anchor phrase and type C-x t again. You’re done!
You can select the anchor phrase first followed by the phrase to be transposed if more convenient. Or select the 2 phrases independently. If you select 2 overlapping sections it ignores the overlap and swaps the non-overlapping sections. It even supports SecondarySelection. Somehow it can always tell what you want
Typing C-x t with nothing selected cancels a previous selection if you need to start over.
Multi-line regions transpose as easily as words. Check it out in the ElispArea at anchored-transpose.el.
21/07/2005 – A bug handling multi-line selection was fixed. Re-download your copy.
Don’t mistake me for a troll now, these are my sincere thoughts.
Sometimes I wonder what for and how people use functions like this. I mean, I understand the description of what, for example, transpose-chars does, but I never get it into my spine to actually use this. (Not that I have tried that hard really, maybe it is worth trying to learn it). I just <backspace> <backspace> <backspace> and retype instead. And now this function, even cooler, to transpose whole regions. I mean, gosh! I would love to have a situation where I could use it; it looks so cool! I almost get what we in Sweden call “performance anxiety” when I see all nice text manipulation commands that I know I could use but which seems to cumbersome to use.
Maybe it is because some people have different kind of jobs than me, where they need different kinds of text manipulation?
Or maybe they just want to look cool…
Comments? How do you use this or similar commands? Does it really save time? etc etc…
– MaDa
– Adam Duck