modulo.org logo modulo.org
Code Emacs Sig Replacer
[ home about me music cv background involvements code community hosting metal log contact webmail ]

I have a few sigs that I use for different purposes, and I got tired of inserting them manually into the email I was writing.
I use emacs for my mail composition, and mutt is my MUA.

This function looks for a sig in your buffer and replaces it with your ".signature.other" file.
Otherwise, it just appends the .signature.other file to the bottom of your buffer.

It is designed to work with mutt, so it looks for a "-- \n" from the bottom of the buffer to find the signature.
I have bound this to C-c s for my convenience.

(defun jargon-sign ()
  "insert alternative signature"
  (interactive)
  (save-excursion
    (let ((sig-marker "-- \n")
	  (dot-sigfile "~/.signature.other"))
      (goto-char (point-max))
      (if (search-backward sig-marker nil t 1)
          (kill-region (point) (point-max)))
      (print '-- (current-buffer))
      (insert-file dot-sigfile))))
(global-set-key "\C-cs" 'jargon-sign)
If you like it, just drop it into your .emacs file.

All text and images ©2003-2008 Ben H Kram
http://www.modulo.org