annotate lisp/mail/mh-mime.el @ 48540:283a6d8bdf2b

Comment.
author Dave Love <fx@gnu.org>
date Mon, 25 Nov 2002 19:06:07 +0000
parents 2568d5a27317
children 8aaba207e44b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38414
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 23305
diff changeset
1 ;;; mh-mime.el --- mh-e support for composing MIME messages
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
2
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
3 ;; Copyright (C) 1993, 1995, 2001, 2002 Free Software Foundation, Inc.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
5 ;; Author: Bill Wohler <wohler@newt.com>
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
6 ;; Maintainer: Bill Wohler <wohler@newt.com>
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
7 ;; Keywords: mail
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
8 ;; See: mh-e.el
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9
38414
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 23305
diff changeset
10 ;; This file is part of GNU Emacs.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11
11333
53174cfc29fa Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 11332
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; any later version.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
11333
53174cfc29fa Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 11332
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; GNU General Public License for more details.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13387
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13387
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13387
diff changeset
25 ;; Boston, MA 02111-1307, USA.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;;; Commentary:
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13387
diff changeset
29 ;; Internal support for mh-e package.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13387
diff changeset
30 ;; Support for generating an mhn composition file.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13387
diff changeset
31 ;; MIME is supported only by MH 6.8 or later.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
33 ;;; Change Log:
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
34
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
35 ;; $Id: mh-mime.el,v 1.26 2002/04/07 19:20:56 wohler Exp $
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
36
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;;; Code:
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 (provide 'mh-mime)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 (require 'mh-comp)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 ;; To do:
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 ;; paragraph code should not fill # lines if MIME enabled.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;; implement mh-auto-edit-mhn (if non-nil, \\[mh-send-letter]
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 ;; invokes mh-edit-mhn automatically before sending.)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 ;; actually, instead of mh-auto-edit-mhn,
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 ;; should read automhnproc from profile
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 ;; MIME option to mh-forward
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 ;; command to move to content-description insertion point
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
51 (defvar mh-mhn-args nil
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
52 "Extra arguments to have \\[mh-edit-mhn] pass to the \"mhn\" command.
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
53 The arguments are passed to mhn if \\[mh-edit-mhn] is given a
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
54 prefix argument. Normally default arguments to mhn are specified in the
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
55 MH profile.")
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
56
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
57 (defvar mh-edit-mhn-hook nil
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
58 "Invoked on the formatted letter by \\<mh-letter-mode-map>\\[mh-edit-mhn].")
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
59
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
60 (defun mh-have-file-command ()
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
61 "Return t if 'file' command is on the system.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
62 'file -i' is used to get MIME type of composition insertion."
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
63 (when (not (boundp 'mh-have-file-command))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
64 (load "executable" t t) ; executable-find not autoloaded in emacs20
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
65 (setq mh-have-file-command
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
66 (and (fboundp 'executable-find)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
67 (executable-find "file") ; file command exists
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
68 ; and accepts -i and -b args.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
69 (zerop (call-process "file" nil nil nil "-i" "-b"
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
70 (expand-file-name "inc" mh-progs))))))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
71 mh-have-file-command)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
72
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
73 (defun mh-file-mime-type (filename)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
74 "Return MIME type of FILENAME from file command.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
75 Returns nil if file command not on system."
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
76 (cond
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
77 ((not (mh-have-file-command))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
78 nil) ;No file command, exit now.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
79 ((not (and (file-exists-p filename)(file-readable-p filename)))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
80 nil)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
81 (t
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
82 (save-excursion
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
83 (let ((tmp-buffer (get-buffer-create mh-temp-buffer)))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
84 (set-buffer tmp-buffer)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
85 (unwind-protect
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
86 (progn
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
87 (call-process "file" nil '(t nil) nil "-b" "-i"
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
88 (expand-file-name filename))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
89 (goto-char (point-min))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
90 (if (not (re-search-forward mh-media-type-regexp nil t))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
91 nil
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
92 (match-string 0)))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
93 (kill-buffer tmp-buffer)))))))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
94
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
95 (defvar mh-mhn-compose-insert-p nil
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
96 "Buffer-local variable to know whether MIME insertion was done.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
97 Triggers an automatic call to `mh-edit-mhn' in `mh-send-letter'.")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
98 (make-variable-buffer-local 'mh-mhn-compose-insert-p)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
99
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
100 ;;; This is needed for Emacs20 which doesn't have mailcap-mime-types.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 (defvar mh-mime-content-types
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
102 '(("application/mac-binhex40") ("application/msword")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
103 ("application/octet-stream") ("application/pdf") ("application/pgp-keys")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
104 ("application/pgp-signature") ("application/pkcs7-signature")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
105 ("application/postscript") ("application/rtf")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
106 ("application/vnd.ms-excel") ("application/vnd.ms-powerpoint")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
107 ("application/vnd.ms-project") ("application/vnd.ms-tnef")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
108 ("application/wordperfect5.1") ("application/wordperfect6.0")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
109 ("application/zip")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
110
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
111 ("audio/basic") ("audio/mpeg")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
112
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
113 ("image/gif") ("image/jpeg") ("image/png")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
114
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
115 ("message/delivery-status")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
116 ("message/external-body") ("message/partial") ("message/rfc822")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
117
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
118 ("text/enriched") ("text/html") ("text/plain") ("text/rfc822-headers")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
119 ("text/richtext") ("text/xml")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
120
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
121 ("video/mpeg") ("video/quicktime"))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
122 "Legal MIME content types.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
123 See documentation for \\[mh-edit-mhn].")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
124
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
125 (defvar mh-media-type-regexp
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
126 (concat (regexp-opt '("text" "image" "audio" "video" "application"
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
127 "multipart" "message") t)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
128 "/[-.+a-zA-Z0-9]+")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
129 "Regexp matching valid media types used in MIME attachment compositions.")
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130
16862
7417db9e3f61 Rename args PATHNAME to FILENAME in various functions.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
131 (defun mh-mhn-compose-insertion (filename type description attributes)
11506
5e44b1839ed4 Update some MIME doc strings.
Karl Heuer <kwzh@gnu.org>
parents: 11333
diff changeset
132 "Add a directive to insert a MIME message part from a file.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
133 This is the typical way to insert non-text parts in a message. Arguments are
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
134 FILENAME, which tells where to find the file, TYPE, the MIME content type,
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
135 DESCRIPTION, a line of text for the Content-Description field. ATTRIBUTES is a
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
136 comma separated list of name=value pairs that is appended to the Content-Type
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
137 field of the attachment.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
138 See also \\[mh-edit-mhn]."
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
139 (interactive (let ((filename (read-file-name "Insert contents of: ")))
16862
7417db9e3f61 Rename args PATHNAME to FILENAME in various functions.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
140 (list
7417db9e3f61 Rename args PATHNAME to FILENAME in various functions.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
141 filename
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
142 (or (mh-file-mime-type filename)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
143 (completing-read "Content-Type: "
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
144 (if (and (require 'mailcap nil t)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
145 (fboundp 'mailcap-mime-types))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
146 (mapcar 'list (mailcap-mime-types))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
147 mh-mime-content-types)))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
148 (read-string "Content-Description: ")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
149 (read-string "Content-Attributes: "
23305
61483b4c169c (mh-mhn-compose-insertion): Use quotes.
Karl Heuer <kwzh@gnu.org>
parents: 16862
diff changeset
150 (concat "name=\""
61483b4c169c (mh-mhn-compose-insertion): Use quotes.
Karl Heuer <kwzh@gnu.org>
parents: 16862
diff changeset
151 (file-name-nondirectory filename)
61483b4c169c (mh-mhn-compose-insertion): Use quotes.
Karl Heuer <kwzh@gnu.org>
parents: 16862
diff changeset
152 "\"")))))
16862
7417db9e3f61 Rename args PATHNAME to FILENAME in various functions.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
153 (mh-mhn-compose-type filename type description attributes ))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154
16862
7417db9e3f61 Rename args PATHNAME to FILENAME in various functions.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
155 (defun mh-mhn-compose-type (filename type
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 &optional description attributes comment)
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
157 (setq mh-mhn-compose-insert-p t)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 (beginning-of-line)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 (insert "#" type)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 (and attributes
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 (insert "; " attributes))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 (and comment
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 (insert " (" comment ")"))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 (insert " [")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 (and description
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 (insert description))
16862
7417db9e3f61 Rename args PATHNAME to FILENAME in various functions.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
167 (insert "] " (expand-file-name filename))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 (insert "\n"))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170
16862
7417db9e3f61 Rename args PATHNAME to FILENAME in various functions.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
171 (defun mh-mhn-compose-anon-ftp (host filename type description)
11506
5e44b1839ed4 Update some MIME doc strings.
Karl Heuer <kwzh@gnu.org>
parents: 11333
diff changeset
172 "Add a directive for a MIME anonymous ftp external body part.
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
173 This directive tells MH to include a reference to a
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
174 message/external-body part retrievable by anonymous FTP. Arguments
16862
7417db9e3f61 Rename args PATHNAME to FILENAME in various functions.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
175 are HOST and FILENAME, which tell where to find the file, TYPE, the
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
176 MIME content type, and DESCRIPTION, a line of text for the
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
177 Content-description header. See also \\[mh-edit-mhn]."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 (interactive (list
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 (read-string "Remote host: ")
16862
7417db9e3f61 Rename args PATHNAME to FILENAME in various functions.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
180 (read-string "Remote filename: ")
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
181 (completing-read "External Content-Type: "
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
182 (if (and (require 'mailcap nil t)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
183 (fboundp 'mailcap-mime-types))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
184 (mapcar 'list (mailcap-mime-types))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
185 mh-mime-content-types))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
186 (read-string "External Content-Description: ")))
16862
7417db9e3f61 Rename args PATHNAME to FILENAME in various functions.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
187 (mh-mhn-compose-external-type "anon-ftp" host filename
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 type description))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189
16862
7417db9e3f61 Rename args PATHNAME to FILENAME in various functions.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
190 (defun mh-mhn-compose-external-compressed-tar (host filename description)
11506
5e44b1839ed4 Update some MIME doc strings.
Karl Heuer <kwzh@gnu.org>
parents: 11333
diff changeset
191 "Add a directive to include a MIME reference to a compressed tar file.
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
192 The file should be available via anonymous ftp. This directive
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
193 tells MH to include a reference to a message/external-body part.
16862
7417db9e3f61 Rename args PATHNAME to FILENAME in various functions.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
194 Arguments are HOST and FILENAME, which tell where to find the file, and
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
195 DESCRIPTION, a line of text for the Content-description header.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 See also \\[mh-edit-mhn]."
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 (interactive (list
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 (read-string "Remote host: ")
16862
7417db9e3f61 Rename args PATHNAME to FILENAME in various functions.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
199 (read-string "Remote filename: ")
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 (read-string "Tar file Content-description: ")))
16862
7417db9e3f61 Rename args PATHNAME to FILENAME in various functions.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
201 (mh-mhn-compose-external-type "anon-ftp" host filename
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 "application/octet-stream"
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 description
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 "type=tar; conversions=x-compress"
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205 "mode=image"))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207
16862
7417db9e3f61 Rename args PATHNAME to FILENAME in various functions.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
208 (defun mh-mhn-compose-external-type (access-type host filename type
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209 &optional description
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 attributes extra-params comment)
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
211 (setq mh-mhn-compose-insert-p t)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 (beginning-of-line)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 (insert "#@" type)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 (and attributes
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 (insert "; " attributes))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216 (and comment
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217 (insert " (" comment ") "))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 (insert " [")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 (and description
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 (insert description))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 (insert "] ")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 (insert "access-type=" access-type "; ")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223 (insert "site=" host)
16862
7417db9e3f61 Rename args PATHNAME to FILENAME in various functions.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
224 (insert "; name=" (file-name-nondirectory filename))
7417db9e3f61 Rename args PATHNAME to FILENAME in various functions.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
225 (insert "; directory=\"" (file-name-directory filename) "\"")
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226 (and extra-params
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
227 (insert "; " extra-params))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228 (insert "\n"))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
230 (defun mh-mhn-compose-forw (&optional description folder messages)
11506
5e44b1839ed4 Update some MIME doc strings.
Karl Heuer <kwzh@gnu.org>
parents: 11333
diff changeset
231 "Add a forw directive to this message, to forward a message with MIME.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232 This directive tells MH to include the named messages in this one.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233 Arguments are DESCRIPTION, a line of text for the Content-description header,
11506
5e44b1839ed4 Update some MIME doc strings.
Karl Heuer <kwzh@gnu.org>
parents: 11333
diff changeset
234 and FOLDER and MESSAGES, which name the message(s) to be forwarded.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235 See also \\[mh-edit-mhn]."
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236 (interactive (list
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237 (read-string "Forw Content-description: ")
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
238 (mh-prompt-for-folder "Message from" mh-sent-from-folder nil)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 (read-string (format "Messages%s: "
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 (if mh-sent-from-msg
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241 (format " [%d]" mh-sent-from-msg)
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
242 "")))))
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
243 (setq mh-mhn-compose-insert-p t)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 (beginning-of-line)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245 (insert "#forw [")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 (and description
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247 (not (string= description ""))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248 (insert description))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 (insert "]")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 (and folder
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 (not (string= folder ""))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 (insert " " folder))
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
253 (if (and messages
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
254 (not (string= messages "")))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255 (let ((start (point)))
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
256 (insert " " messages)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257 (subst-char-in-region start (point) ?, ? ))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 (if mh-sent-from-msg
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259 (insert " " (int-to-string mh-sent-from-msg))))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260 (insert "\n"))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
262 (defun mh-edit-mhn (&optional extra-args)
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
263 "Format the current draft for MIME, expanding any mhn directives.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
264
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
265 Process the current draft with the mhn program, which, using directives
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
266 already inserted in the draft, fills in all the MIME components and header
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
267 fields.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
268
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 This step should be done last just before sending the message.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
270
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
271 The `\\[mh-revert-mhn-edit]' command undoes this command. The arguments in the
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
272 list `mh-mhn-args' are passed to mhn if this function is passed an optional
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
273 prefix argument EXTRA-ARGS.
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
274
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
275 For assistance with creating mhn directives to insert various types of
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
276 components in a message, see \\[mh-mhn-compose-insertion] (generic insertion
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
277 from a file), \\[mh-mhn-compose-anon-ftp] (external reference to file via
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
278 anonymous ftp), \\[mh-mhn-compose-external-compressed-tar] \ \(reference to
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
279 compressed tar file via anonymous ftp), and \\[mh-mhn-compose-forw] (forward
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
280 message). If these helper functions are used, `mh-edit-mhn' is run
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
281 automatically when the draft is sent.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
282
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
283 The mhn program is part of MH version 6.8 or later."
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
284 (interactive "*P")
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 (save-buffer)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286 (message "mhn editing...")
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
287 (cond
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
288 (mh-nmh-p
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
289 (mh-exec-cmd-error nil
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
290 "mhbuild" (if extra-args mh-mhn-args) buffer-file-name))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
291 (t
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
292 (mh-exec-cmd-error (format "mhdraft=%s" buffer-file-name)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
293 "mhn" (if extra-args mh-mhn-args) buffer-file-name)))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
294 (setq mh-mhn-compose-insert-p nil)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 (revert-buffer t t)
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
296 (message "mhn editing...done")
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
297 (run-hooks 'mh-edit-mhn-hook))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
298
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300 (defun mh-revert-mhn-edit (noconfirm)
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
301 "Undo the effect of \\[mh-edit-mhn] by reverting to the backup file.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
302 Optional non-nil argument NOCONFIRM means don't ask for confirmation."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 (interactive "*P")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304 (if (null buffer-file-name)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
305 (error "Buffer does not seem to be associated with any file"))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306 (let ((backup-strings '("," "#"))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307 backup-file)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 (while (and backup-strings
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 (not (file-exists-p
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310 (setq backup-file
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311 (concat (file-name-directory buffer-file-name)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 (car backup-strings)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313 (file-name-nondirectory buffer-file-name)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 ".orig")))))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315 (setq backup-strings (cdr backup-strings)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316 (or backup-strings
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
317 (error "Backup file for %s no longer exists!" buffer-file-name))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
318 (or noconfirm
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
319 (yes-or-no-p (format "Revert buffer from file %s? "
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320 backup-file))
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 38414
diff changeset
321 (error "Revert not confirmed"))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322 (let ((buffer-read-only nil))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323 (erase-buffer)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
324 (insert-file-contents backup-file))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
325 (after-find-file nil)))
38414
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 23305
diff changeset
326
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 23305
diff changeset
327 ;;; mh-mime.el ends here