Skip to main content

I like to move it! (Emacs version)

There is currently a reddit thread about what people like to bind to M-n, M-p. Someone posted s?he likes to move lines of text around with these bindings. I have heard about this feature before but somehow forgot about it.

Working on my recently published emacs project I thought it would be nice to add the ability to do this with any text object. A few parentheses later I had it implemented and have to say, I quite like it. Here is a demo for you, showing me moving lines, words and textblocks around:


The above is also possible with strings, defuns, comments and so on. Here is another short example, where I’m flipping expressions around:


This demonstrates one of the benefits you get when using the text object concept. You can generalize actions to work on all objects your editor knows about.

See you in parendise!

Comments on Reddit