Emacs Snooker

The key to snooker isn’t where the coloured balls go, it’s where your white ball stops. You should always be thinking about setting up your next shot. Something similar holds when using Emacs. Where will the point (cursor) be when you’ve completed your current operation?

Consider the following commands:
M-u Convert to uppercase to the end of the word
M-l Convert to lowercase to the end of the word
M-c Capitalize word

Note that the point jumps to the end of the word when each command is called. This makes it easy to jump through a string of words, changing case or capitalizing as you wish.

Now consider the following

M– M-u Convert previous word to uppercase
M– M-l Convert previous word to lowercase
M– M-c Capitalize previous word
M– means (Alt) and –

Note that the point remains where it is, at the end of the word you’ve just converted. You can’t jump back through a series of words converting as you go.

It’s like the difference between hitting C-o and hitting Enter. At first glance they both appear to do the same thing, but look at the point…
(image: www.freeimages.co.uk)

Leave a Reply

Your email address will not be published. Required fields are marked *