Today I Learned…

…about the delete-horizontal-space command (bound to Meta+\). It deletes all spaces and tabs around the point. You can delete just the white space before the point by specifying the universal argument. I learned about the command from a reddit post by rmberYou that listed some useful Emacs packages.

The post suggested hungry-delete but then added a note about delete-horizontal-space. The suggestion for delete-horizontal-space came from a comment where the command cycle-spacing (bound to Meta+Space) is also discussed. One invocation of cycle-spacing deletes all the spaces but one. Two invocations deletes all the spaces, and three invocations puts things back the way they were.

I use the cycle-spacing command all the time (although only in its single invocation mode; I’d forgotten about the rest) but delete-horizontal-space is new so I’ve learned another useful Emacs command. The day has not been wasted.

This entry was posted in General and tagged . Bookmark the permalink.