1 ;;; mime-setup.el --- setup file for tm viewer and composer.
3 ;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: mail, news, MIME, multimedia, multilingual, encoded-word
8 ;; This file is part of tm (Tools for MIME).
10 ;; This program is free software; you can redistribute it and/or
11 ;; modify it under the terms of the GNU General Public License as
12 ;; published by the Free Software Foundation; either version 2, or (at
13 ;; your option) any later version.
15 ;; This program is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ;; General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
29 (autoload 'mime/editor-mode "tm-edit"
30 "Minor mode for editing MIME message." t)
31 (autoload 'mime-decode-header-in-buffer "eword-decode"
32 "Decode MIME encoded-words in message header." t)
34 (defun mime-setup-decode-message-header ()
37 (goto-char (point-min))
40 (if (re-search-forward
41 (concat "^" (regexp-quote mail-header-separator) "$")
46 (mime-decode-header-in-buffer)
47 (set-buffer-modified-p nil)
50 (add-hook 'mime/editor-mode-hook 'mime-setup-decode-message-header)
56 (defvar mime-setup-use-sc nil
57 "If it is not nil, mime-setup requires sc-setup. [mime-setup.el]")
59 (defvar mime-setup-use-signature t
60 "If it is not nil, mime-setup sets up to use signature.el.
63 (defvar mime-setup-default-signature-key "\C-c\C-s"
64 "*Key to insert signature. [mime-setup.el]")
66 (defvar mime-setup-signature-key-alist '((mail-mode . "\C-c\C-w"))
67 "Alist of major-mode vs. key to insert signature. [mime-setup.el]")
73 (defun mime-setup-set-signature-key ()
74 (let ((key (or (cdr (assq major-mode mime-setup-signature-key-alist))
75 mime-setup-default-signature-key)))
76 (define-key (current-local-map) key (function insert-signature))
79 (if mime-setup-use-signature
81 (autoload 'insert-signature "signature" "Insert signature" t)
82 (add-hook 'mime/editor-mode-hook 'mime-setup-set-signature-key)
83 (setq gnus-signature-file nil)
84 (setq mail-signature nil)
85 (setq message-signature nil)
100 (add-hook 'mu-cite/pre-cite-hook 'mime-decode-header-in-buffer)
103 ;;; @ for mail-mode, RMAIL and VM
106 (add-hook 'mail-setup-hook 'mime-decode-header-in-buffer)
107 (add-hook 'mail-setup-hook 'mime/editor-mode 'append)
108 (add-hook 'mail-send-hook 'mime-editor/maybe-translate)
109 (set-alist 'mime-editor/split-message-sender-alist
113 (funcall send-mail-function)
119 (defun mime-setup-mh-draft-setting ()
121 (make-local-variable 'mail-header-separator)
122 (setq mail-header-separator "--------")
124 (goto-char (point-min))
125 (setq buffer-read-only nil)
126 (if (re-search-forward "^-*$" nil t)
128 (replace-match mail-header-separator)
129 (set-buffer-modified-p (buffer-modified-p))
133 (add-hook 'mh-letter-mode-hook 'mime-setup-mh-draft-setting t)
134 (add-hook 'mh-before-send-letter-hook 'mime-editor/maybe-translate)
140 (add-hook 'news-reply-mode-hook 'mime/editor-mode)
141 (add-hook 'news-inews-hook 'mime-editor/maybe-translate)
144 ;;; @ for message (September Gnus 0.58 or later)
147 (defun message-maybe-setup-default-charset ()
149 (and (boundp 'gnus-summary-buffer)
150 (buffer-live-p gnus-summary-buffer)
152 (set-buffer gnus-summary-buffer)
153 default-mime-charset))))
156 (make-local-variable 'default-mime-charset)
157 (setq default-mime-charset charset)
160 (or (boundp 'epoch::version)
162 (add-hook 'message-setup-hook 'mime/editor-mode)
163 (add-hook 'message-setup-hook 'message-maybe-setup-default-charset)
164 (add-hook 'message-send-hook 'mime-editor/maybe-translate)
165 (add-hook 'message-header-hook 'eword-encode-header)
171 (require 'message-mime)
179 (provide 'mime-setup)
181 (run-hooks 'mime-setup-load-hook)
183 ;;; mime-setup.el ends here