tm4.7.0. tm4_7_0 tm4_7_1 tm4_8_1 tm4_8_2 tm4_8_3 tm4_8_4 tm5_0 tm5_1 tm5_12 tm5_13 tm5_15 tm5_16 tm5_18 tm5_21 tm5_21_1 tm5_21_2 tm5_21_3 tm5_21_4 tm5_21_5 tm5_21_6 tm5_21_7 tm5_21_8 tm5_5 tm5_9 tm5_9_1 tm6_10 tm6_11 tm6_14 tm6_15 tm6_16 tm6_18 tm6_19 tm6_19_1 tm6_20 tm6_21 tm6_22 tm6_22_1 tm6_22_2 tm6_22_3 tm6_50 tm6_54 tm6_58 tm6_63 tm6_67 tm6_70 tm6_71 tm6_72 tm6_73 tm6_74 tm6_76 tm6_76_1 tm6_76_2 tm6_77 tm6_78 tm6_78_1 tm6_78_2 tm6_79 tm6_8 tm6_80 tm6_80_1 tm6_83 tm6_88 tm6_9 tm6_92 tm7_6 tm7_9
authormorioka <morioka>
Mon, 2 Mar 1998 13:30:28 +0000 (13:30 +0000)
committermorioka <morioka>
Mon, 2 Mar 1998 13:30:28 +0000 (13:30 +0000)
signature.el [new file with mode: 0644]

diff --git a/signature.el b/signature.el
new file mode 100644 (file)
index 0000000..c1362d2
--- /dev/null
@@ -0,0 +1,98 @@
+;;;
+;;; $Id: signature.el,v 1.6 1994/08/03 04:42:40 morioka Exp $
+;;; Modified by Yasuo OKABE 1994/08/01
+;;; 
+
+(provide 'signature)
+
+(require 'tl-header)
+
+(defvar signature-insert-at-eof nil
+  "*Insert signature at the end of file if non-nil.")
+
+(defvar signature-file-name "~/.signature"
+  "*Name of file containing the user's signature.")
+
+(defvar signature-file-alist nil)
+
+;;;
+;;; Example:
+;;;
+;;; (setq signature-file-alist
+;;;      '((("Newsgroups" . "zxr")   . "~/.signature-sun")
+;;;        (("To" . "uramimi")       . "~/.signature-sun")
+;;;        (("Newsgroups" . "jokes") . "~/.signature-jokes")
+;;;        (("To" . "tea")           . "~/.signature-jokes")
+;;;        (("To" . ("sim" "oku"))   . "~/.signature-formal")
+;;;        ))
+
+(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)
+                          (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))
+
+(defun signature/insert-signature-at-point (&optional arg)
+  "Insert the file named by signature-file-name at the current point."
+  (interactive "P")
+  (let ((signature
+        (expand-file-name
+         (if arg
+             (read-file-name "Insert your signature: "
+                             (concat signature-file-name "-")
+                             signature-file-name
+                             nil)
+           (signature/get-signature-file-name)))))
+    (insert-file-contents signature)
+    (set-buffer-modified-p (buffer-modified-p)))) ; force mode line update
+
+(defun signature/insert-signature-at-eof (&optional arg)
+  "Insert the file named by signature-file-name at the end of file."
+  (interactive "P")
+  (let ((signature
+        (expand-file-name
+         (if arg
+             (read-file-name "Insert your signature: "
+                             (concat signature-file-name "-")
+                             signature-file-name
+                             nil)
+           (signature/get-signature-file-name)))))
+    (save-excursion
+      (if (file-readable-p signature)
+         (progn
+           (goto-char (point-max))
+           (if (not (bolp))
+               (insert "\n"))
+           (delete-blank-lines)
+           (insert-file-contents signature)
+           (set-buffer-modified-p (buffer-modified-p)) ; force mode line update
+           )))))
+
+(defun insert-signature (&optional arg)
+  "Insert the file named by signature-file-name.  It is inserted at the
+end of file if signature-insert-at-eof in non-nil, and otherwise at
+the current point.  A prefix argument enables user to specify a file
+named <signature-file-name>-DISTRIBUTION interactively."
+  (interactive "P")
+  (if signature-insert-at-eof
+       (call-interactively 'signature/insert-signature-at-eof)
+    (call-interactively 'signature/insert-signature-at-point)))