Mercurial > emacs
annotate lisp/mail/metamail.el @ 56512:d341e83af4f2
Removed the various "echo." lines from lisp\makefile.w32-in and nt\makefile.w32-in.
They caused mingw32-make.exe bootstrap to fail with the following error if cmd.exe
was being used as the shell:
"process_begin: CreateProcess((null), echo., ...) failed."
I replaced the "@echo." lines in nt\makefile.w32-in with "@echo ." This writes a .
to the screen but that is far more desirable than make bootstrap failing.
I replaced the "echo. ..." line in lisp\makefile.w32-in with "echo ;;; ...". This
writes an extra comment line to loaddefs.el. Again this is far more desirable than
make bootstrap failing.
NOTE: I am using cmd.exe as my shell when building Emacs with MinGW instead of
the sh.exe that comes with msys because when I use sh.exe as my shell, loaddefs.el
does not get properly generated and I get various auto load errors.
author | Ben Key <bkey1@tampabay.rr.com> |
---|---|
date | Sat, 24 Jul 2004 04:52:27 +0000 |
parents | e8824c4f5f7e |
children | 18a818a2ee7c 8e5779acd195 |
rev | line source |
---|---|
4171 | 1 ;;; metamail.el --- Metamail interface for GNU Emacs |
2 | |
22154
86791cda515c
Update copyright notice.
Richard M. Stallman <rms@gnu.org>
parents:
18964
diff
changeset
|
3 ;; Copyright (C) 1993, 1996 Free Software Foundation, Inc. |
4171 | 4 |
5 ;; Author: Masanobu UMEDA <umerin@mse.kyutech.ac.jp> | |
6 ;; Keywords: mail, news, mime, multimedia | |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
14169 | 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. | |
4171 | 24 |
25 ;;; Commentary: | |
26 | |
33414 | 27 ;; Note: Metamail does not have all the options which are compatible with |
28 ;; the environment variables. For that reason, metamail.el has to | |
4171 | 29 ;; hack the environment variables. In addition, there is no way to |
30 ;; display all header fields without extra informative body messages | |
33414 | 31 ;; which are suppressed by the "-q" option. |
4171 | 32 |
33 ;; The idea of using metamail to process MIME messages is from | |
34 ;; gnus-mime.el by Spike <Spike@world.std.com>. | |
35 | |
36 ;;; Code: | |
37 | |
17663
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
38 (defgroup metamail nil |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
39 "Metamail interface for Emacs." |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
40 :group 'mail |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
41 :group 'hypermedia |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
42 :group 'processes) |
4171 | 43 |
17663
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
44 (defcustom metamail-program-name "metamail" |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
45 "*Metamail program name." |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
46 :type 'string |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
47 :group 'metamail) |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
48 |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
49 (defcustom metamail-mailer-name "emacs" |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
50 "*Mailer name set to MM_MAILER environment variable." |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
51 :type 'string |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
52 :group 'metamail) |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
53 |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
54 (defvar metamail-environment '("KEYHEADS=*" "MM_QUIET=1") |
4171 | 55 "*Environment variables passed to `metamail'. |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
56 It must be a list of strings that have the format ENVVARNAME=VALUE. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
57 It is not expected to be altered globally by `set' or `setq'. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
58 Instead, change its value temporary using `let' or `let*' form.") |
4171 | 59 |
17663
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
60 (defcustom metamail-switches '("-x" "-d" "-z") |
4171 | 61 "*Switches for `metamail' program. |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
62 `-z' is required to remove zap file. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
63 It is not expected to be altered globally by `set' or `setq'. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
64 Instead, change its value temporary using `let' or `let*' form. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
65 `-m MAILER' argument is automatically generated from the |
17663
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
66 `metamail-mailer-name' variable." |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
67 :type '(repeat (string :tag "Switch")) |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
68 :group 'metamail) |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
69 |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
70 ;;;###autoload |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
71 (defun metamail-interpret-header () |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
72 "Interpret a header part of a MIME message in current buffer. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
73 Its body part is not interpreted at all." |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
74 (interactive) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
75 (save-excursion |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
76 (let* ((buffer-read-only nil) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
77 (metamail-switches ;Inhibit processing an empty body. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
78 (append metamail-switches '("-c" "text/plain" "-E" "7bit"))) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
79 (end (progn |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
80 (goto-char (point-min)) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
81 (search-forward "\n\n" nil 'move) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
82 ;; An extra newline is inserted by metamail if there |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
83 ;; is no body part. So, insert a dummy body by |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
84 ;; itself. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
85 (insert "\n") |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
86 (point)))) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
87 (metamail-region (point-min) end nil nil 'nodisplay) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
88 ;; Remove an extra newline inserted by myself. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
89 (goto-char (point-min)) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
90 (if (search-forward "\n\n\n" nil t) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
91 (delete-char -1)) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
92 ))) |
4171 | 93 |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
94 ;;;###autoload |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
95 (defun metamail-interpret-body (&optional viewmode nodisplay) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
96 "Interpret a body part of a MIME message in current buffer. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
97 Optional argument VIEWMODE specifies the value of the |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
98 EMACS_VIEW_MODE environment variable (defaulted to 1). |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
99 Optional argument NODISPLAY non-nil means buffer is not |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
100 redisplayed as output is inserted. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
101 Its header part is not interpreted at all." |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
102 (interactive "p") |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
103 (save-excursion |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
104 (let ((contype nil) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
105 (encoding nil) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
106 (end (progn |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
107 (goto-char (point-min)) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
108 (search-forward "\n\n" nil t) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
109 (point)))) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
110 ;; Find Content-Type and Content-Transfer-Encoding from the header. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
111 (save-restriction |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
112 (narrow-to-region (point-min) end) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
33414
diff
changeset
|
113 (setq contype |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
114 (or (mail-fetch-field "Content-Type") "text/plain")) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
33414
diff
changeset
|
115 (setq encoding |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
116 (or (mail-fetch-field "Content-Transfer-Encoding") "7bit"))) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
117 ;; Interpret the body part only. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
118 (let ((metamail-switches ;Process body part only. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
119 (append metamail-switches |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
120 (list "-b" "-c" contype "-E" encoding)))) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
121 (metamail-region end (point-max) viewmode nil nodisplay)) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
122 ;; Mode specific hack. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
123 (cond ((eq major-mode 'rmail-mode) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
124 ;; Adjust the marker of this message if in Rmail mode buffer. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
125 (set-marker (aref rmail-message-vector (1+ rmail-current-message)) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
126 (point-max)))) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
127 ))) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
128 |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
129 ;;;###autoload |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
130 (defun metamail-buffer (&optional viewmode buffer nodisplay) |
4171 | 131 "Process current buffer through `metamail'. |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
132 Optional argument VIEWMODE specifies the value of the |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
133 EMACS_VIEW_MODE environment variable (defaulted to 1). |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
134 Optional argument BUFFER specifies a buffer to be filled (nil |
4171 | 135 means current). |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
136 Optional argument NODISPLAY non-nil means buffer is not |
4171 | 137 redisplayed as output is inserted." |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
138 (interactive "p") |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
139 (metamail-region (point-min) (point-max) viewmode buffer nodisplay)) |
4171 | 140 |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
141 ;;;###autoload |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
142 (defun metamail-region (beg end &optional viewmode buffer nodisplay) |
4171 | 143 "Process current region through 'metamail'. |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
144 Optional argument VIEWMODE specifies the value of the |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
145 EMACS_VIEW_MODE environment variable (defaulted to 1). |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
146 Optional argument BUFFER specifies a buffer to be filled (nil |
4171 | 147 means current). |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
148 Optional argument NODISPLAY non-nil means buffer is not |
4171 | 149 redisplayed as output is inserted." |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
150 (interactive "r\np") |
4171 | 151 (let ((curbuf (current-buffer)) |
152 (buffer-read-only nil) | |
26039
fb6b9c37cdc4
Use make-temp-file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25419
diff
changeset
|
153 (metafile (make-temp-file "metamail")) |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
154 (option-environment |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
33414
diff
changeset
|
155 (list (format "EMACS_VIEW_MODE=%d" |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
156 (if (numberp viewmode) viewmode 1))))) |
4171 | 157 (save-excursion |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
158 ;; Gee! Metamail does not ouput to stdout if input comes from |
4171 | 159 ;; stdin. |
18964
10af35406220
(metamail-region): Don't bind kanji-fileio-code
Richard M. Stallman <rms@gnu.org>
parents:
17663
diff
changeset
|
160 (let ((selective-display nil)) ;Disable ^M to nl translation. |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
161 (write-region beg end metafile nil 'nomessage)) |
4171 | 162 (if buffer |
163 (set-buffer buffer)) | |
164 (setq buffer-read-only nil) | |
165 ;; Clear destination buffer. | |
166 (if (eq curbuf (current-buffer)) | |
167 (delete-region beg end) | |
168 (delete-region (point-min) (point-max))) | |
169 ;; We have to pass the environment variable KEYHEADS to display | |
170 ;; all header fields. Metamail should have an optional argument | |
171 ;; to pass such information directly. | |
172 (let ((process-environment | |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
173 (append process-environment |
18964
10af35406220
(metamail-region): Don't bind kanji-fileio-code
Richard M. Stallman <rms@gnu.org>
parents:
17663
diff
changeset
|
174 metamail-environment option-environment)) |
10af35406220
(metamail-region): Don't bind kanji-fileio-code
Richard M. Stallman <rms@gnu.org>
parents:
17663
diff
changeset
|
175 (coding-system-for-read 'undecided)) |
4171 | 176 (apply (function call-process) |
177 metamail-program-name | |
178 nil | |
179 t ;Output to current buffer | |
180 (not nodisplay) ;Force redisplay | |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
181 (append metamail-switches |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
182 (list "-m" (or metamail-mailer-name "emacs")) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
183 (list metafile)))) |
4171 | 184 ;; `metamail' may not delete the temporary file! |
185 (condition-case error | |
186 (delete-file metafile) | |
187 (error nil)) | |
188 ))) | |
189 | |
190 (provide 'metamail) | |
191 | |
52401 | 192 ;;; arch-tag: 52c0cb6f-d800-4776-9789-f0275cb5490e |
4171 | 193 ;;; metamail.el ends here |