Posts in ‘Quick Tips’
-
Emacs Wonderful Little Tip™ #n – Don’t Manually Capitalize… Manual Capitalization Is For L00s3rs!
From November 26, 2008 @ 6:00 am
I recently picked up Emacs again after being Internet-Slapped by Yegge. It’s funny, but way back in the day after I got my first 13″ iBook (still, in my opinion, the cutest computer every made, which is saying a lot) and began to dive into wondrous Unix (we were still tcsh back then), Emacs was the first program I attempted to learn. Who’s masochistic? /me raises both hands and jumps up and down.
Anyway, I didn’t know any better at the time and over the years I got tired of trying to integrate Console based Emacs into my daily work flow. All that has thankfully changed, and my cheek still hurts like heck.
Intros aside, what I have today is a Wonderful Little Tip™ that will be accompanied by other Wonderful Little Tips™ because Emacs is the kind of app that allows you to find Wonderful Little Tips™ all the time.
I often find myself typing in a title or something to that effect which I would like to have most or all of the words capitalized. The title of this post would be an example. In regular editors, the way to do this is to capitalize every word as you go along manually. This presents a few problems.
- Because you’re in an editor other than Emacs, when you forget to capitalize things, it’s a messy process to either arrow-key or delete key backwards to the mistake, delete the mistake, and then reenter as a capital.
- Typing capital letters is hard (OK… It’s a bit of a stretch, but I wanted a list, so I needed it), requiring precise and dexterous finger movements which even for seasoned Dvorak touch-typists like myself, every once in awhile goes awry.
What is the answer to this morass of efficiency conundrums? Who will deliver my hands from this editing of death!? Enter Emacs (OK, now I feel slightly uncomfortable with the subtle Emacs=Jesus suggestion there… That’s just weird, although RMS might actually think that, after all Emacs helps people more than babies do)! Emacs provides these nice text transformation functions that work like magic. They are bound as follows
- M-u: upcase-word
- M-l: downcase-word
- M-c: capitalize-word
The relevant control sequence for our tip here is M-c. The magic of this is quite simple; Type out a phrase, and then either M-b back through the words, M-a back to the beginning of the sentence, or if it’s all on one line, C-a to the beginning of the line. Then, using a combination of M-f and M-c, capitalize to your heart’s content.
This is so much faster than actually typing out the capitalized words. I can’t verify that it would save you time to do this for every capitalization everywhere, but for a long string of them, the added benefit of not having to type a separate key sequence each time you want to capitalize a word is astonishing. In fact, it’s so astonishing that I’m going to put together a little video of this function in action…
You know… because it’s that cool.
OK, here’s the video:
Emacs Wonder: Text Transformation Control Sequences. from Tim Visher on Vimeo. -
Lifehacker Feeds For Your Every Whim (Almost)
From September 17, 2008 @ 6:00 am
I’ve been trying to comb down the noise in my feed reader lately and one of the feeds that I still wanted to be aware of but didn’t want to have to process every day was Lifehacker. Awhile ago, Gina Trapani (Note: For some reason her site is down at the moment…) had published on Lifehacker a collection of different RSS feeds that you could subscribe to if you wanted some more catered content, however I have had terrible difficulty turning up that collection in numerous attempts to search for it (BTW, if someone knows the URL for that feed list, please send it to me). However, recently I discovered something that is possibly better and probably has been posted numerous times elsewhere, but… whatever… :)
There are numerous ways to filter the content in Lifehacker. You can click on the category link at the top of the post, you can filter by author, etc. However, the tip I’m going for works with any of these, I think, because it’s a URL trick.
Once you filter the site the way you want to (say, by clicking the Highlights Tag) and the URL in the location bar has changed appropriately, simply append index.xml to the URL and, ¡voila!, you have your new feed to be added to whatever reader you choose.
Of course, if you want finer tuned control, you could go all out with Yahoo! Pipes, but that’s another story for another day I think.
Enjoy!
