Mercurial > emacs
annotate lisp/mail/metamail.el @ 87601:2425b933f90a
(vc-ensure-vc-buffer): Check liveness of vc-parent-buffer.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sun, 06 Jan 2008 16:02:38 +0000 |
parents | 8e27d63c45eb |
children | de499b20517a f55f9811f5d7 |
rev | line source |
---|---|
4171 | 1 ;;; metamail.el --- Metamail interface for GNU Emacs |
2 | |
74509 | 3 ;; Copyright (C) 1993, 1996, 2001, 2002, 2003, 2004, |
75347 | 4 ;; 2005, 2006, 2007 Free Software Foundation, Inc. |
4171 | 5 |
6 ;; Author: Masanobu UMEDA <umerin@mse.kyutech.ac.jp> | |
7 ;; Keywords: mail, news, mime, multimedia | |
8 | |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
78232
8e27d63c45eb
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
13 ;; the Free Software Foundation; either version 3, or (at your option) |
4171 | 14 ;; any later version. |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
14169 | 22 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
24 ;; Boston, MA 02110-1301, USA. | |
4171 | 25 |
26 ;;; Commentary: | |
27 | |
33414 | 28 ;; Note: Metamail does not have all the options which are compatible with |
29 ;; the environment variables. For that reason, metamail.el has to | |
4171 | 30 ;; hack the environment variables. In addition, there is no way to |
31 ;; display all header fields without extra informative body messages | |
33414 | 32 ;; which are suppressed by the "-q" option. |
4171 | 33 |
34 ;; The idea of using metamail to process MIME messages is from | |
35 ;; gnus-mime.el by Spike <Spike@world.std.com>. | |
36 | |
37 ;;; Code: | |
38 | |
65212
fa5b2493902e
(rmail-current-message, rmail-message-vector): Add defvars.
Juanma Barranquero <lekktu@gmail.com>
parents:
64754
diff
changeset
|
39 (defvar rmail-current-message) |
fa5b2493902e
(rmail-current-message, rmail-message-vector): Add defvars.
Juanma Barranquero <lekktu@gmail.com>
parents:
64754
diff
changeset
|
40 (defvar rmail-message-vector) |
fa5b2493902e
(rmail-current-message, rmail-message-vector): Add defvars.
Juanma Barranquero <lekktu@gmail.com>
parents:
64754
diff
changeset
|
41 |
17663
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
42 (defgroup metamail nil |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
43 "Metamail interface for Emacs." |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
44 :group 'mail |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
45 :group 'hypermedia |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
46 :group 'processes) |
4171 | 47 |
17663
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
48 (defcustom metamail-program-name "metamail" |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
49 "*Metamail program name." |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
50 :type 'string |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
51 :group 'metamail) |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
52 |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
53 (defcustom metamail-mailer-name "emacs" |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
54 "*Mailer name set to MM_MAILER environment variable." |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
55 :type 'string |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
56 :group 'metamail) |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
57 |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
58 (defvar metamail-environment '("KEYHEADS=*" "MM_QUIET=1") |
4171 | 59 "*Environment variables passed to `metamail'. |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
60 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
|
61 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
|
62 Instead, change its value temporary using `let' or `let*' form.") |
4171 | 63 |
17663
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
64 (defcustom metamail-switches '("-x" "-d" "-z") |
4171 | 65 "*Switches for `metamail' program. |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
66 `-z' is required to remove zap file. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
67 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
|
68 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
|
69 `-m MAILER' argument is automatically generated from the |
17663
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
70 `metamail-mailer-name' variable." |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
71 :type '(repeat (string :tag "Switch")) |
d2c64a1563f7
Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
17661
diff
changeset
|
72 :group 'metamail) |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
73 |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
74 ;;;###autoload |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
75 (defun metamail-interpret-header () |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
76 "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
|
77 Its body part is not interpreted at all." |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
78 (interactive) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
79 (save-excursion |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
80 (let* ((buffer-read-only nil) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
81 (metamail-switches ;Inhibit processing an empty body. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
82 (append metamail-switches '("-c" "text/plain" "-E" "7bit"))) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
83 (end (progn |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
84 (goto-char (point-min)) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
85 (search-forward "\n\n" nil 'move) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
86 ;; 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
|
87 ;; 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
|
88 ;; itself. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
89 (insert "\n") |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
90 (point)))) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
91 (metamail-region (point-min) end nil nil 'nodisplay) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
92 ;; Remove an extra newline inserted by myself. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
93 (goto-char (point-min)) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
94 (if (search-forward "\n\n\n" nil t) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
95 (delete-char -1)) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
96 ))) |
4171 | 97 |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
98 ;;;###autoload |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
99 (defun metamail-interpret-body (&optional viewmode nodisplay) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
100 "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
|
101 Optional argument VIEWMODE specifies the value of the |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
102 EMACS_VIEW_MODE environment variable (defaulted to 1). |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
103 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
|
104 redisplayed as output is inserted. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
105 Its header part is not interpreted at all." |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
106 (interactive "p") |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
107 (save-excursion |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
108 (let ((contype nil) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
109 (encoding nil) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
110 (end (progn |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
111 (goto-char (point-min)) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
112 (search-forward "\n\n" nil t) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
113 (point)))) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
114 ;; 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
|
115 (save-restriction |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
116 (narrow-to-region (point-min) end) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
33414
diff
changeset
|
117 (setq contype |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
118 (or (mail-fetch-field "Content-Type") "text/plain")) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
33414
diff
changeset
|
119 (setq encoding |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
120 (or (mail-fetch-field "Content-Transfer-Encoding") "7bit"))) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
121 ;; Interpret the body part only. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
122 (let ((metamail-switches ;Process body part only. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
123 (append metamail-switches |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
124 (list "-b" "-c" contype "-E" encoding)))) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
125 (metamail-region end (point-max) viewmode nil nodisplay)) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
126 ;; Mode specific hack. |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
127 (cond ((eq major-mode 'rmail-mode) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
128 ;; 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
|
129 (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
|
130 (point-max)))) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
131 ))) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
132 |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
133 ;;;###autoload |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
134 (defun metamail-buffer (&optional viewmode buffer nodisplay) |
4171 | 135 "Process current buffer through `metamail'. |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
136 Optional argument VIEWMODE specifies the value of the |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
137 EMACS_VIEW_MODE environment variable (defaulted to 1). |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
138 Optional argument BUFFER specifies a buffer to be filled (nil |
4171 | 139 means current). |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
140 Optional argument NODISPLAY non-nil means buffer is not |
4171 | 141 redisplayed as output is inserted." |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
142 (interactive "p") |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
143 (metamail-region (point-min) (point-max) viewmode buffer nodisplay)) |
4171 | 144 |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
145 ;;;###autoload |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
146 (defun metamail-region (beg end &optional viewmode buffer nodisplay) |
4171 | 147 "Process current region through 'metamail'. |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
148 Optional argument VIEWMODE specifies the value of the |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
149 EMACS_VIEW_MODE environment variable (defaulted to 1). |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
150 Optional argument BUFFER specifies a buffer to be filled (nil |
4171 | 151 means current). |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
152 Optional argument NODISPLAY non-nil means buffer is not |
4171 | 153 redisplayed as output is inserted." |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
154 (interactive "r\np") |
4171 | 155 (let ((curbuf (current-buffer)) |
156 (buffer-read-only nil) | |
26039
fb6b9c37cdc4
Use make-temp-file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25419
diff
changeset
|
157 (metafile (make-temp-file "metamail")) |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
158 (option-environment |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
33414
diff
changeset
|
159 (list (format "EMACS_VIEW_MODE=%d" |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
160 (if (numberp viewmode) viewmode 1))))) |
4171 | 161 (save-excursion |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
162 ;; Gee! Metamail does not ouput to stdout if input comes from |
4171 | 163 ;; stdin. |
18964
10af35406220
(metamail-region): Don't bind kanji-fileio-code
Richard M. Stallman <rms@gnu.org>
parents:
17663
diff
changeset
|
164 (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
|
165 (write-region beg end metafile nil 'nomessage)) |
4171 | 166 (if buffer |
167 (set-buffer buffer)) | |
168 (setq buffer-read-only nil) | |
169 ;; Clear destination buffer. | |
170 (if (eq curbuf (current-buffer)) | |
171 (delete-region beg end) | |
172 (delete-region (point-min) (point-max))) | |
173 ;; We have to pass the environment variable KEYHEADS to display | |
174 ;; all header fields. Metamail should have an optional argument | |
175 ;; to pass such information directly. | |
176 (let ((process-environment | |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
177 (append process-environment |
18964
10af35406220
(metamail-region): Don't bind kanji-fileio-code
Richard M. Stallman <rms@gnu.org>
parents:
17663
diff
changeset
|
178 metamail-environment option-environment)) |
10af35406220
(metamail-region): Don't bind kanji-fileio-code
Richard M. Stallman <rms@gnu.org>
parents:
17663
diff
changeset
|
179 (coding-system-for-read 'undecided)) |
4171 | 180 (apply (function call-process) |
181 metamail-program-name | |
182 nil | |
183 t ;Output to current buffer | |
184 (not nodisplay) ;Force redisplay | |
15051
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
185 (append metamail-switches |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
186 (list "-m" (or metamail-mailer-name "emacs")) |
4dbe0f673671
(metamail-mailer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14994
diff
changeset
|
187 (list metafile)))) |
4171 | 188 ;; `metamail' may not delete the temporary file! |
189 (condition-case error | |
190 (delete-file metafile) | |
191 (error nil)) | |
192 ))) | |
193 | |
194 (provide 'metamail) | |
195 | |
52401 | 196 ;;; arch-tag: 52c0cb6f-d800-4776-9789-f0275cb5490e |
4171 | 197 ;;; metamail.el ends here |