]> code.delx.au - gnu-emacs/blobdiff - lisp/mail/metamail.el
(report-emacs-bug-text-prompt): New variable.
[gnu-emacs] / lisp / mail / metamail.el
index 2c2a67874a93137a0d7a7d88dacd5d99137b99da..9c0b806bfcafd3cca183542e100d12dae22006a0 100644 (file)
@@ -1,9 +1,9 @@
 ;;; metamail.el --- Metamail interface for GNU Emacs
 
-;; Copyright (C) 1993, 1996  Masanobu UMEDA
+;; Copyright (C) 1993, 1996  Free Software Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <umerin@mse.kyutech.ac.jp>
-;; Version: $Id: /home/gd/gnu/emacs/19.0/lisp/RCS/metamail.el,v 1.5 1996/04/19 18:05:38 rms Exp eggert $
+;; Version: $Id: metamail.el,v 1.13 1999/10/15 15:45:02 monnier Exp $
 ;; Keywords: mail, news, mime, multimedia
 
 ;; This file is part of GNU Emacs.
 
 ;;; Commentary:
 
-;; The latest version will be at:
-;;     ftp://ftp.kyutech.ac.jp/pub/MultiMedia/mime/emacs-mime-tools.shar
-
-;; Note: Metamail does not have all options which is compatible with
-;; the environment variables.  For that reason, matamail.el have to
+;; Note: Metamail does not have all the options which are compatible with
+;; the environment variables.  For that reason, metamail.el has to
 ;; hack the environment variables.  In addition, there is no way to
 ;; display all header fields without extra informative body messages
-;; which are suppressed by "-q" option.
-
-;; The following definition is what I'm using with GNUS 4:
-;;(setq gnus-show-mime-method
-;;      (function
-;;       (lambda ()
-;;        (metamail-interpret-header)
-;;        (let ((metamail-switches     ;Suppress header fields in a body.
-;;               (append metamail-switches '("-q"))))
-;;          (metamail-interpret-body)))))
+;; which are suppressed by the "-q" option.
 
 ;; The idea of using metamail to process MIME messages is from
 ;; gnus-mime.el by Spike <Spike@world.std.com>.
 
 ;;; Code:
 
-(defvar metamail-program-name "metamail"
-  "*Metamail program name.")
+(defgroup metamail nil
+  "Metamail interface for Emacs."
+  :group 'mail
+  :group 'hypermedia
+  :group 'processes)
+
+(defcustom metamail-program-name "metamail"
+  "*Metamail program name."
+  :type 'string
+  :group 'metamail)
 
-(defvar metamail-mailer-name "emacs"
-  "*Mailer name set to MM_MAILER environment variable.")
+(defcustom metamail-mailer-name "emacs"
+  "*Mailer name set to MM_MAILER environment variable."
+  :type 'string
+  :group 'metamail)
 
 (defvar metamail-environment '("KEYHEADS=*" "MM_QUIET=1")
   "*Environment variables passed to `metamail'.
@@ -60,13 +58,15 @@ It must be a list of strings that have the format ENVVARNAME=VALUE.
 It is not expected to be altered globally by `set' or `setq'.
 Instead, change its value temporary using `let' or `let*' form.")
 
-(defvar metamail-switches '("-x" "-d" "-z")
+(defcustom metamail-switches '("-x" "-d" "-z")
   "*Switches for `metamail' program.
 `-z' is required to remove zap file.
 It is not expected to be altered globally by `set' or `setq'.
 Instead, change its value temporary using `let' or `let*' form.
 `-m MAILER' argument is automatically generated from the
-`metamail-mailer-name' variable.")
+`metamail-mailer-name' variable."
+  :type '(repeat (string :tag "Switch"))
+  :group 'metamail)
 
 ;;;###autoload
 (defun metamail-interpret-header ()
@@ -151,17 +151,14 @@ redisplayed as output is inserted."
   (interactive "r\np")
   (let ((curbuf (current-buffer))
        (buffer-read-only nil)
-       (metafile (make-temp-name "/tmp/metamail"))
+       (metafile (make-temp-file "metamail"))
        (option-environment
-        (list (concat "EMACS_VIEW_MODE=
+        (list (format "EMACS_VIEW_MODE=%d
                       (if (numberp viewmode) viewmode 1)))))
     (save-excursion
       ;; Gee!  Metamail does not ouput to stdout if input comes from
       ;; stdin.
-      (let ((selective-display nil)    ;Disable ^M to nl translation.
-           (kanji-fileio-code 2)       ;Write in JIS code when nemacs.
-           (file-coding-system         ;Write in JUNET style when mule.
-            (if (featurep 'mule) *junet*)))
+      (let ((selective-display nil))   ;Disable ^M to nl translation.
        (write-region beg end metafile nil 'nomessage))
       (if buffer
          (set-buffer buffer))
@@ -175,12 +172,8 @@ redisplayed as output is inserted."
       ;; to pass such information directly.
       (let ((process-environment
             (append process-environment
-                    metamail-environment option-environment)))
-       ;; Specify character coding system.
-       (if (boundp 'NEMACS)
-           (define-program-kanji-code nil metamail-program-name 2)) ;JIS
-       (if (featurep 'mule)
-           (define-program-coding-system nil metamail-program-name *junet*))
+                    metamail-environment option-environment))
+           (coding-system-for-read 'undecided))
        (apply (function call-process)
               metamail-program-name
               nil