pic-a-sig
There are lots of random signature programs out there. There are several
for Emacs. My pic-a-sig may not be the most elegant but it has a few nice
features a couple of which I think are uncommon:
- You can mix random and static content within your .signature
file. It doesn't have to be all random.
- pic-a-sig is fully interactive from within Emacs. You can see the
signature before you send it, edit it, or delete it and generate another.
- You can fudge your selection with the interactive sig-cheat
function. Maybe you have 50 sigs in your .pic-a-sig file and 15 of
them contain the word "cooking." If your current message is
related to cooking then you can sig-cheat to make sure you get a
random sigline related to cooking.
- select-sig-at-point makes it easy to insert a random line
anywhere you feel like it.
The only drawback being that you need to use Emacs. Normally this is not a
drawback, but perhaps you're using a mailer that doesn't allow external
editors.
Okay here's how it works. Get the pic-a-sig code below and put it in your
.emacs. Then make a file in your home directory called
.pic-a-sig containing your random signatures, one per line. You
can have random sigs which span multiple lines, but you must represent the
linebreaks with ^M (Ctrl-Q-RETURN). A newline represents the end
of a sig.
Next edit your .signature file, or whatever file your mailer is
going to insert into the editor. The magic string that pic-a-sig looks for
is $$Sig$$. So you can have a .signature like this:
--
Adrian Hosey
Grand High Poobah
$$Sig$$
and the last line will be replaced with a random sig.
The provided pic-a-sig code already hooks pic-a-sig to
write-file-hooks. The first time you save the buffer you'll see
$$Sig$$ be replaced. If you want to cheat instead, run the
sig-cheat function before saving the buffer.
sig-cheat will prompt you for a pattern and select a line from
.pic-a-sig that contains the pattern.
You can access sig-cheat and select-sig-at-point with
Meta-x or you can bind them to key combos like this:
(global-set-key "\C-x\C-a" 'select-sig-at-point)
TODO
- An optional way to store metadata keywords with sig lines. So perhaps
you have a sig line related to cooking but it does not contain the string
"cooking". With metadata keywords that sig line could still
match a sig-cheat of "cooking".
- Another metadata field that tags when a sig line has been used. Used
sigs are not eligible to be used again until all the sigs have been used
once. i.e. we cycle thru the entire file in random order, then clear the
tags and restart.
- You can easily delete a sig and then insert another using
select-sig-at-point. But you cannot easily do another
sig-cheat. You have to re-enter $$Sig$$ and then you can
sig-cheat again. Adding sig-cheat-at-point would be
trivial, I just haven't.
- Once pic-a-sig is hooked up any instance of $$Sig$$
will be replaced, even if you don't want it be! (While writing
.signature for instance...) Depending on the mailer we could
probably do some heuristic on the buffer name to see whether or not we're
editing a mail message. Or maybe there's a way for Emacs to know the name
of its parent process?
With the exception of the last one those all smell of overengineering, but
they would be fun. There is a certain (small?) class of people who love to
express themselves with sigs. A couple friends of mine wrote sig
generators that composed a haiku based on the message body.
Maintained by Adrian Hosey
alh@warhound.org
Back to warhound.org