X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=signature.el;h=e577f907ad1697f607ae7d4ed755bb26897bef1d;hb=refs%2Ftags%2Ftm7_24;hp=c1362d2f44e0fcc375460ac8bcc94b0bdb84aa0f;hpb=e8da5161c2ceaa38c9cf9c13dd581db4c3abd459;p=elisp%2Fsemi.git diff --git a/signature.el b/signature.el index c1362d2..e577f90 100644 --- a/signature.el +++ b/signature.el @@ -1,11 +1,20 @@ ;;; -;;; $Id: signature.el,v 1.6 1994/08/03 04:42:40 morioka Exp $ -;;; Modified by Yasuo OKABE 1994/08/01 -;;; - -(provide 'signature) +;;; signature.el --- signature utility for GNU Emacs +;;; +;;; Copyright (C) 1995 Free Software Foundation, Inc. +;;; Copyright (C) 1994,1995 MORIOKA Tomohiko +;;; Copyright (C) 1994 OKABE Yasuo +;;; +;;; Author: MORIOKA Tomohiko +;;; OKABE Yasuo (1994/08/01) +;;; Version: +;;; $Id: signature.el,v 4.0 1995/10/26 09:25:23 morioka Exp $ +;;; Keywords: mail, news, signature +;;; +;;; This file is part of tm (Tools for MIME). +;;; -(require 'tl-header) +(require 'tl-822) (defvar signature-insert-at-eof nil "*Insert signature at the end of file if non-nil.") @@ -29,27 +38,39 @@ (defun signature/get-signature-file-name () (catch 'tag (let ((r signature-file-alist) cell b f) - (while r - (setq cell (car r)) - (setq b (car cell)) - (if (setq f (message/get-field-body (car b))) - (cond ((listp (cdr b)) - (let ((r (cdr b))) - (while r - (if (string-match (car r) f) + (save-excursion + (save-restriction + (narrow-to-region + (point-min) + (progn + (goto-char (point-min)) + (if (re-search-forward + (concat "^" (regexp-quote mail-header-separator) "$") + nil t) + (match-beginning 0) + (point-max) + ))) + (while r + (setq cell (car r)) + (setq b (car cell)) + (if (setq f (rfc822/get-field-body (car b))) + (cond ((listp (cdr b)) + (let ((r (cdr b))) + (while r + (if (string-match (car r) f) + (throw 'tag (cdr cell)) + ) + (setq r (cdr r)) + )) + ) + ((stringp (cdr b)) + (if (string-match (cdr b) f) (throw 'tag (cdr cell)) - ) - (setq r (cdr r)) - )) - ) - ((stringp (cdr b)) - (if (string-match (cdr b) f) - (throw 'tag (cdr cell)) - )) - )) - (setq r (cdr r)) - )) - signature-file-name)) + )) + )) + (setq r (cdr r)) + )) + signature-file-name)))) (defun signature/insert-signature-at-point (&optional arg) "Insert the file named by signature-file-name at the current point." @@ -63,7 +84,8 @@ nil) (signature/get-signature-file-name))))) (insert-file-contents signature) - (set-buffer-modified-p (buffer-modified-p)))) ; force mode line update + (set-buffer-modified-p (buffer-modified-p)) ; force mode line update + signature)) (defun signature/insert-signature-at-eof (&optional arg) "Insert the file named by signature-file-name at the end of file." @@ -84,8 +106,10 @@ (insert "\n")) (delete-blank-lines) (insert-file-contents signature) - (set-buffer-modified-p (buffer-modified-p)) ; force mode line update - ))))) + (set-buffer-modified-p (buffer-modified-p)) + ; force mode line update + ))) + signature)) (defun insert-signature (&optional arg) "Insert the file named by signature-file-name. It is inserted at the @@ -96,3 +120,9 @@ named -DISTRIBUTION interactively." (if signature-insert-at-eof (call-interactively 'signature/insert-signature-at-eof) (call-interactively 'signature/insert-signature-at-point))) + + +;;; @ end +;;; + +(provide 'signature)