upcase-word, you so silly23 Dec 2014
Do you know what the
most frequently used
Emacs commands are? I can confirm by my own experience that they are
previous-line (in that order).
So why do M-u -
upcase-word, M-l -
capitalize-word have such terrible synergy with Emacs's best commands?
upcase-word, this is not what I had in mind:
Learn basic key
Learn basic keySTROKE
If you say:
But how did you get the cursor in such a crazy position in the first place? You should have used M-b/M-f.
Well, I got there with
previous-line - one of the best Emacs commands!
*-word malarkey with
Here are some simple advice commands that I've just rolled:
(defadvice upcase-word (before upcase-word-advice activate) (unless (looking-back "\\b") (backward-word))) (defadvice downcase-word (before downcase-word-advice activate) (unless (looking-back "\\b") (backward-word))) (defadvice capitalize-word (before capitalize-word-advice activate) (unless (looking-back "\\b") (backward-word)))
Small explanation to the Elisp novices:
upcase-wordis called, execute the body of
unlesswe are at the beginning of the word
backward-wordonce to move to the beginning of the word
I'm intentionally not using the newest advice system here, since not everyone has yet upgraded to Emacs 24.4. In fact, I saw this gem today at Stack Overflow:
I am using Emacs 23 and cedet 1.0.1 ...