Monday, January 14, 2008

Emacs Tip #10: sig-quote (intelligent, random signatures)

Way back when I first started using Emacs, I read email with it. A friend had some script which modified his .signature file with a random quote every 30 seconds. I thought that was kind of neat, but I wanted every email to get its own, random, quote. At the time I didn't know how to get a random number in a simple shell script, so I started writing something using Emacs directly.

A random signature wasn't enough though, I then wanted to be able to have different categories of quotes and send different people quotes from those different categories. From the documentation:

;; This mode is designed to allow a user to have quotes appended to
;; their mail and news posts according to whom/where the mail is
;; being sent. For example, one might wish to have "insightful"
;; quotes sent to Prof. Apple, and "crude" quotes to your brother
;; Sam. With this mode, upon sending a piece of mail, the email
;; addresses are scanned (this includes the To:, CC:, and BCC:
;; headers), and an appropriate quote is inserted into the letter.

Thus began my Emacs fascination.

You can download the source here.


Eric TF Bat said...

Any chance you can change or fix the CSS for your code sections, so they grow some scrollbars when they're too wide for the column? I think the trick is to put "overflow: auto" in the appropriate place. Thanks.

BFW said...

I just use vanilla Blogger, which (AFAIK) doesn't give me control like that. I need to figure out a system for displaying the code snippets better.

FWIW, I now post all my code via the Emacs wiki.

I'll look into other options available to Blogger.

Sacha Chua said...

Better yet, use % to delimit the quotes (like the fortune.el and fortune cookie package), and use BBDB to store the signature customizations.

See my post on Crazy Emacs: Personalized signatures with random taglines - I don't use fortune there, but you get the idea. =)

BFW said...

Interesting idea. I tried using BBDB once (not for signatures), but it didn't work as expected, so I dropped it.

With respect to doing this kind of integration (BBDB and fortune-style delimiters), that's interesting. I'd probably look at something like that if I were actively developing it for sure. The only catch I see with the fortune delimiters is that sig-quote needs a way to group the quotes together. Perhaps it could be changed to be a directory, with one file per quote (fortune delimited). Hmmm...