1 ;;; mime-setup.el --- setup file for MIME viewer and composer.
3 ;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
7 ;; $Id: mime-setup.el,v 0.9 1997-03-07 14:30:34 morioka Exp $
8 ;; Keywords: MIME, multimedia, multilingual, mail, news
10 ;; This file is part of SEMI (SEMI is Emacs MIME Interfaces).
12 ;; This program is free software; you can redistribute it and/or
13 ;; modify it under the terms of the GNU General Public License as
14 ;; published by the Free Software Foundation; either version 2, or (at
15 ;; your option) any later version.
17 ;; This program is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ;; General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
32 (autoload 'turn-on-mime-edit "mime-edit"
33 "Unconditionally turn on MIME-Edit minor mode." t)
35 (autoload 'eword-decode-header "eword-decode"
36 "Decode MIME encoded-words in header fields." t)
38 (defun mime-setup-decode-message-header ()
41 (goto-char (point-min))
44 (if (re-search-forward
45 (concat "^" (regexp-quote mail-header-separator) "$")
51 (set-buffer-modified-p nil)
54 (add-hook 'mime-edit-mode-hook 'mime-setup-decode-message-header)
60 (defvar mime-setup-use-signature t
61 "If it is not nil, mime-setup sets up to use signature.el.
64 (defvar mime-setup-default-signature-key "\C-c\C-s"
65 "*Key to insert signature. [mime-setup.el]")
67 (defvar mime-setup-signature-key-alist '((mail-mode . "\C-c\C-w"))
68 "Alist of major-mode vs. key to insert signature. [mime-setup.el]")
74 (defun mime-setup-set-signature-key ()
75 (let ((key (or (cdr (assq major-mode mime-setup-signature-key-alist))
76 mime-setup-default-signature-key)))
77 (define-key (current-local-map) key (function insert-signature))
80 (if mime-setup-use-signature
82 (autoload 'insert-signature "signature" "Insert signature" t)
83 (add-hook 'mime-edit-mode-hook 'mime-setup-set-signature-key)
84 (setq gnus-signature-file nil)
85 (setq mail-signature nil)
86 (setq message-signature nil)
93 (add-hook 'mu-cite/pre-cite-hook 'eword-decode-header)
96 ;;; @ for mail-mode, RMAIL and VM
99 (add-hook 'mail-setup-hook 'eword-decode-header)
100 (add-hook 'mail-setup-hook 'turn-on-mime-edit 'append)
101 (add-hook 'mail-send-hook 'mime-edit-maybe-translate)
102 (set-alist 'mime-edit-split-message-sender-alist
106 (funcall send-mail-function)
112 (defun mime-setup-mh-draft-setting ()
114 (make-local-variable 'mail-header-separator)
115 (setq mail-header-separator "--------")
117 (goto-char (point-min))
118 (setq buffer-read-only nil)
119 (if (re-search-forward "^-*$" nil t)
121 (replace-match mail-header-separator)
122 (set-buffer-modified-p (buffer-modified-p))
126 (add-hook 'mh-letter-mode-hook 'mime-setup-mh-draft-setting t)
127 (add-hook 'mh-before-send-letter-hook 'mime-edit-maybe-translate)
130 ;;; @ for message (September Gnus 0.58 or later)
133 (defun message-maybe-setup-default-charset ()
135 (and (boundp 'gnus-summary-buffer)
136 (buffer-live-p gnus-summary-buffer)
138 (set-buffer gnus-summary-buffer)
139 default-mime-charset))))
142 (make-local-variable 'default-mime-charset)
143 (setq default-mime-charset charset)
146 (or (boundp 'epoch::version)
148 (add-hook 'message-setup-hook 'turn-on-mime-edit)
149 (add-hook 'message-setup-hook 'message-maybe-setup-default-charset)
150 (add-hook 'message-send-hook 'mime-edit-maybe-translate)
151 (add-hook 'message-header-hook 'eword-encode-header)
157 (require 'message-mime)
165 (provide 'mime-setup)
167 (run-hooks 'mime-setup-load-hook)
169 ;;; mime-setup.el ends here