X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=signature.el;h=129f28cefbdb8d0db043182c649f2a27903516b7;hb=5f9633210aaee632b411aa229f44dfe73313326b;hp=937885b3499ecd9e1982f012f4d4d1623b19a36c;hpb=f82710cfe6775797f766b80bf261e1cf2e3695f2;p=elisp%2Fsemi.git diff --git a/signature.el b/signature.el index 937885b..129f28c 100644 --- a/signature.el +++ b/signature.el @@ -1,40 +1,68 @@ ;;; -;;; signature.el --- signature utility for GNU Emacs +;;; signature.el --- a signature utility for GNU Emacs ;;; ;;; Copyright (C) 1995 Free Software Foundation, Inc. -;;; Copyright (C) 1994,1995 MORIOKA Tomohiko +;;; Copyright (C) 1994 .. 1996 MORIOKA Tomohiko ;;; Copyright (C) 1994 OKABE Yasuo +;;; Copyright (C) 1996 Artur Pioro ;;; ;;; Author: MORIOKA Tomohiko -;;; OKABE Yasuo (1994/08/01) +;;; OKABE Yasuo +;;; Artur Pioro +;;; Created: 1994/7/11 ;;; Version: -;;; $Id: signature.el,v 7.1 1995/12/14 06:22:20 morioka Exp $ +;;; $Id: signature.el,v 7.7 1996/03/14 13:39:57 morioka Exp $ ;;; Keywords: mail, news, signature ;;; ;;; This file is part of tm (Tools for MIME). ;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2, or +;;; (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with This program. If not, write to the Free Software +;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +;;; +;;; Code: (require 'tl-822) (defvar signature-insert-at-eof nil - "*Insert signature at the end of file if non-nil.") + "*Insert signature at the end of file if non-nil. [signature.el]") + +(defvar signature-delete-blank-lines-at-eof nil + "*Signature-insert-at-eof deletes blank lines at the end of file +if non-nil. [signature.el]") (defvar signature-file-name "~/.signature" - "*Name of file containing the user's signature.") + "*Name of file containing the user's signature. [signature.el]") (defvar signature-file-alist nil) +(defvar signature-file-prefix nil + "*String containing optional prefix for the signature file names") + ;;; ;;; Example: ;;; ;;; (setq signature-file-alist -;;; '((("Newsgroups" . "zxr") . "~/.signature-sun") +;;; '((("To" . signature-check-in-bbdb) . nil) +;;; (("Newsgroups" . "zxr") . "~/.signature-sun") ;;; (("To" . "uramimi") . "~/.signature-sun") ;;; (("Newsgroups" . "jokes") . "~/.signature-jokes") ;;; (("To" . "tea") . "~/.signature-jokes") ;;; (("To" . ("sim" "oku")) . "~/.signature-formal") ;;; )) +(autoload 'signature-check-in-bbdb "tm-bbdb") + (defun signature/get-signature-file-name () (catch 'tag (let ((r signature-file-alist) cell b f) @@ -58,15 +86,25 @@ (let ((r (cdr b))) (while r (if (string-match (car r) f) - (throw 'tag (cdr cell)) + (throw 'tag + (concat + signature-file-prefix (cdr cell))) ) (setq r (cdr r)) )) ) ((stringp (cdr b)) (if (string-match (cdr b) f) - (throw 'tag (cdr cell)) + (throw 'tag + (concat + signature-file-prefix (cdr cell))) )) + ((functionp (cdr b)) + (let ((name (apply (cdr b) f (cdr cell)))) + (if name + (throw 'tag + (concat signature-file-prefix name)) + ))) )) (setq r (cdr r)) )) @@ -103,7 +141,7 @@ (goto-char (point-max)) (if (not (bolp)) (insert "\n")) - ;;(delete-blank-lines) + (if signature-delete-blank-lines-at-eof (delete-blank-lines)) (insert-file-contents signature) (set-buffer-modified-p (buffer-modified-p)) ; force mode line update @@ -125,3 +163,5 @@ named -DISTRIBUTION interactively." ;;; (provide 'signature) + +;;; signature.el ends here