2 ;;; $Id: signature.el,v 1.6 1994/08/03 04:42:40 morioka Exp $
3 ;;; Modified by Yasuo OKABE 1994/08/01
10 (defvar signature-insert-at-eof nil
11 "*Insert signature at the end of file if non-nil.")
13 (defvar signature-file-name "~/.signature"
14 "*Name of file containing the user's signature.")
16 (defvar signature-file-alist nil)
21 ;;; (setq signature-file-alist
22 ;;; '((("Newsgroups" . "zxr") . "~/.signature-sun")
23 ;;; (("To" . "uramimi") . "~/.signature-sun")
24 ;;; (("Newsgroups" . "jokes") . "~/.signature-jokes")
25 ;;; (("To" . "tea") . "~/.signature-jokes")
26 ;;; (("To" . ("sim" "oku")) . "~/.signature-formal")
29 (defun signature/get-signature-file-name ()
31 (let ((r signature-file-alist) cell b f)
35 (if (setq f (message/get-field-body (car b)))
36 (cond ((listp (cdr b))
39 (if (string-match (car r) f)
40 (throw 'tag (cdr cell))
46 (if (string-match (cdr b) f)
47 (throw 'tag (cdr cell))
54 (defun signature/insert-signature-at-point (&optional arg)
55 "Insert the file named by signature-file-name at the current point."
60 (read-file-name "Insert your signature: "
61 (concat signature-file-name "-")
64 (signature/get-signature-file-name)))))
65 (insert-file-contents signature)
66 (set-buffer-modified-p (buffer-modified-p)))) ; force mode line update
68 (defun signature/insert-signature-at-eof (&optional arg)
69 "Insert the file named by signature-file-name at the end of file."
74 (read-file-name "Insert your signature: "
75 (concat signature-file-name "-")
78 (signature/get-signature-file-name)))))
80 (if (file-readable-p signature)
82 (goto-char (point-max))
86 (insert-file-contents signature)
87 (set-buffer-modified-p (buffer-modified-p)) ; force mode line update
90 (defun insert-signature (&optional arg)
91 "Insert the file named by signature-file-name. It is inserted at the
92 end of file if signature-insert-at-eof in non-nil, and otherwise at
93 the current point. A prefix argument enables user to specify a file
94 named <signature-file-name>-DISTRIBUTION interactively."
96 (if signature-insert-at-eof
97 (call-interactively 'signature/insert-signature-at-eof)
98 (call-interactively 'signature/insert-signature-at-point)))