annotate lisp/gnus/mml.el @ 110120:3d32b7120396

play/cookie1.el (read-cookie): Fix off-by-one error (bug#6921).
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 26 Aug 2010 17:33:52 +0200
parents 1d1d5d9bd884
children e003508e60b1 376148b31b5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1 ;;; mml.el --- A package for parsing and validating MML documents
64754
fafd692d1e40 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64712
diff changeset
2
95820
645fb33380d6 Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents: 95086
diff changeset
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 104895
diff changeset
4 ;; 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
11 ;; the Free Software Foundation, either version 3 of the License, or
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
12 ;; (at your option) any later version.
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 ;; GNU General Public License for more details.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22 ;;; Commentary:
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
23
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24 ;;; Code:
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
25
87238
ada1cfe623ac Add declare-function compatibility definition.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
26 ;; For Emacs < 22.2.
ada1cfe623ac Add declare-function compatibility definition.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
27 (eval-and-compile
ada1cfe623ac Add declare-function compatibility definition.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
28 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
ada1cfe623ac Add declare-function compatibility definition.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
29
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
30 (require 'mm-util)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31 (require 'mm-bodies)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
32 (require 'mm-encode)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
33 (require 'mm-decode)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
34 (require 'mml-sec)
33123
18591e92c712 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31764
diff changeset
35 (eval-when-compile (require 'cl))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
36
95820
645fb33380d6 Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents: 95086
diff changeset
37 (autoload 'message-make-message-id "message")
645fb33380d6 Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents: 95086
diff changeset
38 (autoload 'gnus-setup-posting-charset "gnus-msg")
645fb33380d6 Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents: 95086
diff changeset
39 (autoload 'gnus-make-local-hook "gnus-util")
645fb33380d6 Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents: 95086
diff changeset
40 (autoload 'message-fetch-field "message")
645fb33380d6 Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents: 95086
diff changeset
41 (autoload 'message-mark-active-p "message")
645fb33380d6 Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents: 95086
diff changeset
42 (autoload 'message-info "message")
645fb33380d6 Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents: 95086
diff changeset
43 (autoload 'fill-flowed-encode "flow-fill")
645fb33380d6 Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents: 95086
diff changeset
44 (autoload 'message-posting-charset "message")
645fb33380d6 Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents: 95086
diff changeset
45 (autoload 'dnd-get-local-file-name "dnd")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
46
87330
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
47 (autoload 'message-options-set "message")
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
48 (autoload 'message-narrow-to-head "message")
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
49 (autoload 'message-in-body-p "message")
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
50 (autoload 'message-mail-p "message")
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
51
65280
4ec96459e1b5 (gnus-article-mime-handles, gnus-mouse-2, gnus-newsrc-hashtb,
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
52 (defvar gnus-article-mime-handles)
4ec96459e1b5 (gnus-article-mime-handles, gnus-mouse-2, gnus-newsrc-hashtb,
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
53 (defvar gnus-mouse-2)
4ec96459e1b5 (gnus-article-mime-handles, gnus-mouse-2, gnus-newsrc-hashtb,
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
54 (defvar gnus-newsrc-hashtb)
4ec96459e1b5 (gnus-article-mime-handles, gnus-mouse-2, gnus-newsrc-hashtb,
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
55 (defvar message-default-charset)
4ec96459e1b5 (gnus-article-mime-handles, gnus-mouse-2, gnus-newsrc-hashtb,
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
56 (defvar message-deletable-headers)
4ec96459e1b5 (gnus-article-mime-handles, gnus-mouse-2, gnus-newsrc-hashtb,
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
57 (defvar message-options)
4ec96459e1b5 (gnus-article-mime-handles, gnus-mouse-2, gnus-newsrc-hashtb,
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
58 (defvar message-posting-charset)
4ec96459e1b5 (gnus-article-mime-handles, gnus-mouse-2, gnus-newsrc-hashtb,
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
59 (defvar message-required-mail-headers)
4ec96459e1b5 (gnus-article-mime-handles, gnus-mouse-2, gnus-newsrc-hashtb,
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
60 (defvar message-required-news-headers)
70245
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
61 (defvar dnd-protocol-alist)
86154
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
62 (defvar mml-dnd-protocol-alist)
65280
4ec96459e1b5 (gnus-article-mime-handles, gnus-mouse-2, gnus-newsrc-hashtb,
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
63
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
64 (defcustom mml-content-type-parameters
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
65 '(name access-type expiration size permission format)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
66 "*A list of acceptable parameters in MML tag.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
67 These parameters are generated in Content-Type header if exists."
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59764
diff changeset
68 :version "22.1"
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
69 :type '(repeat (symbol :tag "Parameter"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
70 :group 'message)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
71
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
72 (defcustom mml-content-disposition-parameters
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
73 '(filename creation-date modification-date read-date)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
74 "*A list of acceptable parameters in MML tag.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
75 These parameters are generated in Content-Disposition header if exists."
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59764
diff changeset
76 :version "22.1"
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
77 :type '(repeat (symbol :tag "Parameter"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
78 :group 'message)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
79
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
80 (defcustom mml-content-disposition-alist
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
81 '((text (rtf . "attachment") (t . "inline"))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
82 (t . "attachment"))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
83 "Alist of MIME types or regexps matching file names and default dispositions.
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
84 Each element should be one of the following three forms:
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
85
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
86 (REGEXP . DISPOSITION)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
87 (SUPERTYPE (SUBTYPE . DISPOSITION) (SUBTYPE . DISPOSITION)...)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
88 (TYPE . DISPOSITION)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
89
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
90 Where REGEXP is a string which matches the file name (if any) of an
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
91 attachment, SUPERTYPE, SUBTYPE and TYPE should be symbols which are a
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
92 MIME supertype (e.g., text), a MIME subtype (e.g., plain) and a MIME
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
93 type (e.g., text/plain) respectively, and DISPOSITION should be either
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
94 the string \"attachment\" or the string \"inline\". The value t for
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
95 SUPERTYPE, SUBTYPE or TYPE matches any of those types. The first
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
96 match found will be used."
92336
5f827896103e Change defcustom :version from 23.0 to 23.1.
Glenn Morris <rgm@gnu.org>
parents: 92153
diff changeset
97 :version "23.1" ;; No Gnus
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
98 :type (let ((dispositions '(radio :format "DISPOSITION: %v"
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
99 :value "attachment"
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
100 (const :format "%v " "attachment")
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
101 (const :format "%v\n" "inline"))))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
102 `(repeat
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
103 :offset 0
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
104 (choice :format "%[Value Menu%]%v"
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
105 (cons :tag "(REGEXP . DISPOSITION)" :extra-offset 4
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
106 (regexp :tag "REGEXP" :value ".*")
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
107 ,dispositions)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
108 (cons :tag "(SUPERTYPE (SUBTYPE . DISPOSITION)...)"
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
109 :indent 0
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
110 (symbol :tag " SUPERTYPE" :value text)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
111 (repeat :format "%v%i\n" :offset 0 :extra-offset 4
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
112 (cons :format "%v" :extra-offset 5
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
113 (symbol :tag "SUBTYPE" :value t)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
114 ,dispositions)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
115 (cons :tag "(TYPE . DISPOSITION)" :extra-offset 4
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
116 (symbol :tag "TYPE" :value t)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
117 ,dispositions))))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
118 :group 'message)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
119
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
120 (defcustom mml-insert-mime-headers-always nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
121 "If non-nil, always put Content-Type: text/plain at top of empty parts.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
122 It is necessary to work against a bug in certain clients."
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59764
diff changeset
123 :version "22.1"
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
124 :type 'boolean
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
125 :group 'message)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
126
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
127 (defvar mml-tweak-type-alist nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
128 "A list of (TYPE . FUNCTION) for tweaking MML parts.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
129 TYPE is a string containing a regexp to match the MIME type. FUNCTION
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
130 is a Lisp function which is called with the MML handle to tweak the
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
131 part. This variable is used only when no TWEAK parameter exists in
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
132 the MML handle.")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
133
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
134 (defvar mml-tweak-function-alist nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
135 "A list of (NAME . FUNCTION) for tweaking MML parts.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
136 NAME is a string containing the name of the TWEAK parameter in the MML
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
137 handle. FUNCTION is a Lisp function which is called with the MML
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
138 handle to tweak the part.")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
139
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
140 (defvar mml-tweak-sexp-alist
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
141 '((mml-externalize-attachments . mml-tweak-externalize-attachments))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
142 "A list of (SEXP . FUNCTION) for tweaking MML parts.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
143 SEXP is an s-expression. If the evaluation of SEXP is non-nil, FUNCTION
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
144 is called. FUNCTION is a Lisp function which is called with the MML
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
145 handle to tweak the part.")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
146
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
147 (defvar mml-externalize-attachments nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
148 "*If non-nil, local-file attachments are generated as external parts.")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
149
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
150 (defvar mml-generate-multipart-alist nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
151 "*Alist of multipart generation functions.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
152 Each entry has the form (NAME . FUNCTION), where
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43166
diff changeset
153 NAME is a string containing the name of the part (without the
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
154 leading \"/multipart/\"),
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
155 FUNCTION is a Lisp function which is called to generate the part.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
156
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
157 The Lisp function has to supply the appropriate MIME headers and the
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
158 contents of this part.")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
159
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
160 (defvar mml-syntax-table
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
161 (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
162 (modify-syntax-entry ?\\ "/" table)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
163 (modify-syntax-entry ?< "(" table)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
164 (modify-syntax-entry ?> ")" table)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
165 (modify-syntax-entry ?@ "w" table)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
166 (modify-syntax-entry ?/ "w" table)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
167 (modify-syntax-entry ?= " " table)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
168 (modify-syntax-entry ?* " " table)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
169 (modify-syntax-entry ?\; " " table)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
170 (modify-syntax-entry ?\' " " table)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
171 table))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
172
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
173 (defvar mml-boundary-function 'mml-make-boundary
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
174 "A function called to suggest a boundary.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
175 The function may be called several times, and should try to make a new
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
176 suggestion each time. The function is called with one parameter,
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
177 which is a number that says how many times the function has been
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
178 called for this message.")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
179
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
180 (defvar mml-confirmation-set nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
181 "A list of symbols, each of which disables some warning.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
182 `unknown-encoding': always send messages contain characters with
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
183 unknown encoding; `use-ascii': always use ASCII for those characters
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
184 with unknown encoding; `multipart': always send messages with more than
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
185 one charsets.")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
186
64693
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
187 (defvar mml-generate-default-type "text/plain"
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
188 "Content type by which the Content-Type header can be omitted.
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
189 The Content-Type header will not be put in the MIME part if the type
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
190 equals the value and there's no parameter (e.g. charset, format, etc.)
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
191 and `mml-insert-mime-headers-always' is nil. The value will be bound
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
192 to \"message/rfc822\" when encoding an article to be forwarded as a MIME
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
193 part. This is for the internal use, you should never modify the value.")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
194
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
195 (defvar mml-buffer-list nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
196
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43166
diff changeset
197 (defun mml-generate-new-buffer (name)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
198 (let ((buf (generate-new-buffer name)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
199 (push buf mml-buffer-list)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
200 buf))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
201
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
202 (defun mml-destroy-buffers ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
203 (let (kill-buffer-hook)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
204 (mapc 'kill-buffer mml-buffer-list)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
205 (setq mml-buffer-list nil)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
206
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
207 (defun mml-parse ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
208 "Parse the current buffer as an MML document."
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
209 (save-excursion
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
210 (goto-char (point-min))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
211 (with-syntax-table mml-syntax-table
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
212 (mml-parse-1))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
213
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
214 (defun mml-parse-1 ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
215 "Parse the current buffer as an MML document."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
216 (let (struct tag point contents charsets warn use-ascii no-markup-p raw)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
217 (while (and (not (eobp))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
218 (not (looking-at "<#/multipart")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
219 (cond
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
220 ((looking-at "<#secure")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
221 ;; The secure part is essentially a meta-meta tag, which
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
222 ;; expands to either a part tag if there are no other parts in
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
223 ;; the document or a multipart tag if there are other parts
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
224 ;; included in the message
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
225 (let* (secure-mode
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
226 (taginfo (mml-read-tag))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
227 (keyfile (cdr (assq 'keyfile taginfo)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
228 (certfile (cdr (assq 'certfile taginfo)))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
229 (recipients (cdr (assq 'recipients taginfo)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
230 (sender (cdr (assq 'sender taginfo)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
231 (location (cdr (assq 'tag-location taginfo)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
232 (mode (cdr (assq 'mode taginfo)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
233 (method (cdr (assq 'method taginfo)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
234 tags)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
235 (save-excursion
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
236 (if (re-search-forward
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
237 "<#/?\\(multipart\\|part\\|external\\|mml\\)." nil t)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
238 (setq secure-mode "multipart")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
239 (setq secure-mode "part")))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
240 (save-excursion
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
241 (goto-char location)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
242 (re-search-forward "<#secure[^\n]*>\n"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
243 (delete-region (match-beginning 0) (match-end 0))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
244 (cond ((string= mode "sign")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
245 (setq tags (list "sign" method)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
246 ((string= mode "encrypt")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
247 (setq tags (list "encrypt" method)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
248 ((string= mode "signencrypt")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
249 (setq tags (list "sign" method "encrypt" method))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
250 (eval `(mml-insert-tag ,secure-mode
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
251 ,@tags
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
252 ,(if keyfile "keyfile")
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
253 ,keyfile
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
254 ,(if certfile "certfile")
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
255 ,certfile
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
256 ,(if recipients "recipients")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
257 ,recipients
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
258 ,(if sender "sender")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
259 ,sender))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
260 ;; restart the parse
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
261 (goto-char location)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
262 ((looking-at "<#multipart")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
263 (push (nconc (mml-read-tag) (mml-parse-1)) struct))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
264 ((looking-at "<#external")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
265 (push (nconc (mml-read-tag) (list (cons 'contents (mml-read-part))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
266 struct))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
267 (t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
268 (if (or (looking-at "<#part") (looking-at "<#mml"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
269 (setq tag (mml-read-tag)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
270 no-markup-p nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
271 warn nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
272 (setq tag (list 'part '(type . "text/plain"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
273 no-markup-p t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
274 warn t))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
275 (setq raw (cdr (assq 'raw tag))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
276 point (point)
31764
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
277 contents (mml-read-part (eq 'mml (car tag)))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
278 charsets (cond
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
279 (raw nil)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
280 ((assq 'charset tag)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
281 (list
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
282 (intern (downcase (cdr (assq 'charset tag))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
283 (t
92153
37d6263f580b Revert removal of `mm-hack-charsets' in Gnus
Miles Bader <miles@gnu.org>
parents: 91367
diff changeset
284 (mm-find-mime-charset-region point (point)
37d6263f580b Revert removal of `mm-hack-charsets' in Gnus
Miles Bader <miles@gnu.org>
parents: 91367
diff changeset
285 mm-hack-charsets))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
286 (when (and (not raw) (memq nil charsets))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
287 (if (or (memq 'unknown-encoding mml-confirmation-set)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
288 (message-options-get 'unknown-encoding)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
289 (and (y-or-n-p "\
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
290 Message contains characters with unknown encoding. Really send? ")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
291 (message-options-set 'unknown-encoding t)))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43166
diff changeset
292 (if (setq use-ascii
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
293 (or (memq 'use-ascii mml-confirmation-set)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
294 (message-options-get 'use-ascii)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
295 (and (y-or-n-p "Use ASCII as charset? ")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
296 (message-options-set 'use-ascii t))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
297 (setq charsets (delq nil charsets))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
298 (setq warn nil))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
299 (error "Edit your message to remove those characters")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
300 (if (or raw
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
301 (eq 'mml (car tag))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
302 (< (length charsets) 2))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
303 (if (or (not no-markup-p)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
304 (string-match "[^ \t\r\n]" contents))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
305 ;; Don't create blank parts.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
306 (push (nconc tag (list (cons 'contents contents)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
307 struct))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
308 (let ((nstruct (mml-parse-singlepart-with-multiple-charsets
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
309 tag point (point) use-ascii)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
310 (when (and warn
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
311 (not (memq 'multipart mml-confirmation-set))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
312 (not (message-options-get 'multipart))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
313 (not (and (y-or-n-p (format "\
35142
40698b92a36a (mml-parse-1): Frob mml-confirmation-set when proceeding
Dave Love <fx@gnu.org>
parents: 34797
diff changeset
314 A message part needs to be split into %d charset parts. Really send? "
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
315 (length nstruct)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
316 (message-options-set 'multipart t))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
317 (error "Edit your message to use only one charset"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
318 (setq struct (nconc nstruct struct)))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
319 (unless (eobp)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
320 (forward-line 1))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
321 (nreverse struct)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
322
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43166
diff changeset
323 (defun mml-parse-singlepart-with-multiple-charsets
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
324 (orig-tag beg end &optional use-ascii)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
325 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
326 (save-restriction
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
327 (narrow-to-region beg end)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
328 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
329 (let ((current (or (mm-mime-charset (mm-charset-after))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
330 (and use-ascii 'us-ascii)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
331 charset struct space newline paragraph)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
332 (while (not (eobp))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
333 (setq charset (mm-mime-charset (mm-charset-after)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
334 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
335 ;; The charset remains the same.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
336 ((eq charset 'us-ascii))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
337 ((or (and use-ascii (not charset))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
338 (eq charset current))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
339 (setq space nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
340 newline nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
341 paragraph nil))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
342 ;; The initial charset was ascii.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
343 ((eq current 'us-ascii)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
344 (setq current charset
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
345 space nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
346 newline nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
347 paragraph nil))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
348 ;; We have a change in charsets.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
349 (t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
350 (push (append
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
351 orig-tag
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
352 (list (cons 'contents
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
353 (buffer-substring-no-properties
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
354 beg (or paragraph newline space (point))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
355 struct)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
356 (setq beg (or paragraph newline space (point))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
357 current charset
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
358 space nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
359 newline nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
360 paragraph nil)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
361 ;; Compute places where it might be nice to break the part.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
362 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
363 ((memq (following-char) '(? ?\t))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
364 (setq space (1+ (point))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
365 ((and (eq (following-char) ?\n)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
366 (not (bobp))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
367 (eq (char-after (1- (point))) ?\n))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
368 (setq paragraph (point)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
369 ((eq (following-char) ?\n)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
370 (setq newline (1+ (point)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
371 (forward-char 1))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
372 ;; Do the final part.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
373 (unless (= beg (point))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
374 (push (append orig-tag
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
375 (list (cons 'contents
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
376 (buffer-substring-no-properties
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
377 beg (point)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
378 struct))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
379 struct))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
380
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
381 (defun mml-read-tag ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
382 "Read a tag and return the contents."
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
383 (let ((orig-point (point))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
384 contents name elem val)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
385 (forward-char 2)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
386 (setq name (buffer-substring-no-properties
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
387 (point) (progn (forward-sexp 1) (point))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
388 (skip-chars-forward " \t\n")
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
389 (while (not (looking-at ">[ \t]*\n?"))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
390 (setq elem (buffer-substring-no-properties
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
391 (point) (progn (forward-sexp 1) (point))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
392 (skip-chars-forward "= \t\n")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
393 (setq val (buffer-substring-no-properties
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
394 (point) (progn (forward-sexp 1) (point))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
395 (when (string-match "^\"\\(.*\\)\"$" val)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
396 (setq val (match-string 1 val)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
397 (push (cons (intern elem) val) contents)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
398 (skip-chars-forward " \t\n"))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
399 (goto-char (match-end 0))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
400 ;; Don't skip the leading space.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
401 ;;(skip-chars-forward " \t\n")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
402 ;; Put the tag location into the returned contents
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
403 (setq contents (append (list (cons 'tag-location orig-point)) contents))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
404 (cons (intern name) (nreverse contents))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
405
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
406 (defun mml-buffer-substring-no-properties-except-hard-newlines (start end)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
407 (let ((str (buffer-substring-no-properties start end))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
408 (bufstart start) tmp)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
409 (while (setq tmp (text-property-any start end 'hard 't))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
410 (set-text-properties (- tmp bufstart) (- tmp bufstart -1)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
411 '(hard t) str)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
412 (setq start (1+ tmp)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
413 str))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
414
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
415 (defun mml-read-part (&optional mml)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
416 "Return the buffer up till the next part, multipart or closing part or multipart.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
417 If MML is non-nil, return the buffer up till the correspondent mml tag."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
418 (let ((beg (point)) (count 1))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
419 ;; If the tag ended at the end of the line, we go to the next line.
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
420 (when (looking-at "[ \t]*\n")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
421 (forward-line 1))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
422 (if mml
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
423 (progn
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
424 (while (and (> count 0) (not (eobp)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
425 (if (re-search-forward "<#\\(/\\)?mml." nil t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
426 (setq count (+ count (if (match-beginning 1) -1 1)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
427 (goto-char (point-max))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
428 (mml-buffer-substring-no-properties-except-hard-newlines
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
429 beg (if (> count 0)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
430 (point)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
431 (match-beginning 0))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
432 (if (re-search-forward
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
433 "<#\\(/\\)?\\(multipart\\|part\\|external\\|mml\\)." nil t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
434 (prog1
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
435 (mml-buffer-substring-no-properties-except-hard-newlines
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
436 beg (match-beginning 0))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
437 (if (or (not (match-beginning 1))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
438 (equal (match-string 2) "multipart"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
439 (goto-char (match-beginning 0))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
440 (when (looking-at "[ \t]*\n")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
441 (forward-line 1))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
442 (mml-buffer-substring-no-properties-except-hard-newlines
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
443 beg (goto-char (point-max)))))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
444
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
445 (defvar mml-boundary nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
446 (defvar mml-base-boundary "-=-=")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
447 (defvar mml-multipart-number 0)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
448
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
449 (defun mml-generate-mime ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
450 "Generate a MIME message based on the current MML document."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
451 (let ((cont (mml-parse))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
452 (mml-multipart-number mml-multipart-number))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
453 (if (not cont)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
454 nil
78673
a296c3e20ccc Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
455 (mm-with-multibyte-buffer
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
456 (if (and (consp (car cont))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
457 (= (length cont) 1))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
458 (mml-generate-mime-1 (car cont))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
459 (mml-generate-mime-1 (nconc (list 'multipart '(type . "mixed"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
460 cont)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
461 (buffer-string)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
462
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
463 (defun mml-generate-mime-1 (cont)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
464 (let ((mm-use-ultra-safe-encoding
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
465 (or mm-use-ultra-safe-encoding (assq 'sign cont))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
466 (save-restriction
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
467 (narrow-to-region (point) (point))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
468 (mml-tweak-part cont)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
469 (cond
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
470 ((or (eq (car cont) 'part) (eq (car cont) 'mml))
64693
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
471 (let* ((raw (cdr (assq 'raw cont)))
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
472 (filename (cdr (assq 'filename cont)))
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
473 (type (or (cdr (assq 'type cont))
64712
4db92b217e85 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-507
Miles Bader <miles@gnu.org>
parents: 64693
diff changeset
474 (if filename
4db92b217e85 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-507
Miles Bader <miles@gnu.org>
parents: 64693
diff changeset
475 (or (mm-default-file-encoding filename)
4db92b217e85 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-507
Miles Bader <miles@gnu.org>
parents: 64693
diff changeset
476 "application/octet-stream")
4db92b217e85 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-507
Miles Bader <miles@gnu.org>
parents: 64693
diff changeset
477 "text/plain")))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
478 (charset (cdr (assq 'charset cont)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
479 (coding (mm-charset-to-coding-system charset))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
480 encoding flowed coded)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
481 (cond ((eq coding 'ascii)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
482 (setq charset nil
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
483 coding nil))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
484 (charset
100454
b8d5bfa98123 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 98440
diff changeset
485 ;; The value of `charset' might be a bogus alias that
b8d5bfa98123 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 98440
diff changeset
486 ;; `mm-charset-synonym-alist' provides, like `utf8',
b8d5bfa98123 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 98440
diff changeset
487 ;; so we prefer the MIME charset that Emacs knows for
b8d5bfa98123 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 98440
diff changeset
488 ;; the coding system `coding'.
b8d5bfa98123 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 98440
diff changeset
489 (setq charset (or (mm-coding-system-to-mime-charset coding)
b8d5bfa98123 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 98440
diff changeset
490 (intern (downcase charset))))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
491 (if (and (not raw)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
492 (member (car (split-string type "/")) '("text" "message")))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
493 (progn
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
494 (with-temp-buffer
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
495 (cond
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
496 ((cdr (assq 'buffer cont))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
497 (insert-buffer-substring (cdr (assq 'buffer cont))))
64693
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
498 ((and filename
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
499 (not (equal (cdr (assq 'nofile cont)) "yes")))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
500 (let ((coding-system-for-read coding))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
501 (mm-insert-file-contents filename)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
502 ((eq 'mml (car cont))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
503 (insert (cdr (assq 'contents cont))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
504 (t
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
505 (save-restriction
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
506 (narrow-to-region (point) (point))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
507 (insert (cdr (assq 'contents cont)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
508 ;; Remove quotes from quoted tags.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
509 (goto-char (point-min))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
510 (while (re-search-forward
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
511 "<#!+/?\\(part\\|multipart\\|external\\|mml\\)"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
512 nil t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
513 (delete-region (+ (match-beginning 0) 2)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
514 (+ (match-beginning 0) 3))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
515 (cond
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
516 ((eq (car cont) 'mml)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
517 (let ((mml-boundary (mml-compute-boundary cont))
64693
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
518 ;; It is necessary for the case where this
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
519 ;; function is called recursively since
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
520 ;; `m-g-d-t' will be bound to "message/rfc822"
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
521 ;; when encoding an article to be forwarded.
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
522 (mml-generate-default-type "text/plain"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
523 (mml-to-mime))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
524 (let ((mm-7bit-chars (concat mm-7bit-chars "\x1b")))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
525 ;; ignore 0x1b, it is part of iso-2022-jp
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
526 (setq encoding (mm-body-7-or-8))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
527 ((string= (car (split-string type "/")) "message")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
528 (let ((mm-7bit-chars (concat mm-7bit-chars "\x1b")))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
529 ;; ignore 0x1b, it is part of iso-2022-jp
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
530 (setq encoding (mm-body-7-or-8))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
531 (t
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
532 ;; Only perform format=flowed filling on text/plain
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
533 ;; parts where there either isn't a format parameter
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
534 ;; in the mml tag or it says "flowed" and there
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
535 ;; actually are hard newlines in the text.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
536 (let (use-hard-newlines)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
537 (when (and (string= type "text/plain")
57243
c5e16264557d Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-575
Miles Bader <miles@gnu.org>
parents: 57153
diff changeset
538 (not (string= (cdr (assq 'sign cont)) "pgp"))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
539 (or (null (assq 'format cont))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
540 (string= (cdr (assq 'format cont))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
541 "flowed"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
542 (setq use-hard-newlines
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
543 (text-property-any
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
544 (point-min) (point-max) 'hard 't)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
545 (fill-flowed-encode)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
546 ;; Indicate that `mml-insert-mime-headers' should
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
547 ;; insert a "; format=flowed" string unless the
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
548 ;; user has already specified it.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
549 (setq flowed (null (assq 'format cont)))))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
550 ;; Prefer `utf-8' for text/calendar parts.
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
551 (if (or charset
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
552 (not (string= type "text/calendar")))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
553 (setq charset (mm-encode-body charset))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
554 (let ((mm-coding-system-priorities
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
555 (cons 'utf-8 mm-coding-system-priorities)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
556 (setq charset (mm-encode-body))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
557 (setq encoding (mm-body-encoding
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
558 charset (cdr (assq 'encoding cont))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
559 (setq coded (buffer-string)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
560 (mml-insert-mime-headers cont type charset encoding flowed)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
561 (insert "\n")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
562 (insert coded))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
563 (mm-with-unibyte-buffer
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
564 (cond
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
565 ((cdr (assq 'buffer cont))
74021
234305495123 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 70245
diff changeset
566 (insert (mm-string-as-unibyte
234305495123 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 70245
diff changeset
567 (with-current-buffer (cdr (assq 'buffer cont))
234305495123 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 70245
diff changeset
568 (buffer-string)))))
64693
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
569 ((and filename
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
570 (not (equal (cdr (assq 'nofile cont)) "yes")))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
571 (let ((coding-system-for-read mm-binary-coding-system))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
572 (mm-insert-file-contents filename nil nil nil nil t))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
573 (unless charset
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
574 (setq charset (mm-coding-system-to-mime-charset
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
575 (mm-find-buffer-file-coding-system
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
576 filename)))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
577 (t
69247
6580c61aced7 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-134
Miles Bader <miles@gnu.org>
parents: 68720
diff changeset
578 (let ((contents (cdr (assq 'contents cont))))
6580c61aced7 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-134
Miles Bader <miles@gnu.org>
parents: 68720
diff changeset
579 (if (if (featurep 'xemacs)
6580c61aced7 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-134
Miles Bader <miles@gnu.org>
parents: 68720
diff changeset
580 (string-match "[^\000-\377]" contents)
6580c61aced7 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-134
Miles Bader <miles@gnu.org>
parents: 68720
diff changeset
581 (mm-multibyte-string-p contents))
6580c61aced7 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-134
Miles Bader <miles@gnu.org>
parents: 68720
diff changeset
582 (progn
6580c61aced7 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-134
Miles Bader <miles@gnu.org>
parents: 68720
diff changeset
583 (mm-enable-multibyte)
6580c61aced7 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-134
Miles Bader <miles@gnu.org>
parents: 68720
diff changeset
584 (insert contents)
78673
a296c3e20ccc Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
585 (unless raw
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
586 (setq charset (mm-encode-body charset))))
69247
6580c61aced7 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-134
Miles Bader <miles@gnu.org>
parents: 68720
diff changeset
587 (insert contents)))))
104889
18c2aea5083c 2009-09-09 Katsumi Yamaoka <yamaoka@jpl.org>
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 104780
diff changeset
588 (if (setq encoding (cdr (assq 'encoding cont)))
18c2aea5083c 2009-09-09 Katsumi Yamaoka <yamaoka@jpl.org>
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 104780
diff changeset
589 (setq encoding (intern (downcase encoding))))
18c2aea5083c 2009-09-09 Katsumi Yamaoka <yamaoka@jpl.org>
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 104780
diff changeset
590 (setq encoding (mm-encode-buffer type encoding)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
591 coded (mm-string-as-multibyte (buffer-string))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
592 (mml-insert-mime-headers cont type charset encoding nil)
78673
a296c3e20ccc Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
593 (insert "\n" coded))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
594 ((eq (car cont) 'external)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
595 (insert "Content-Type: message/external-body")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
596 (let ((parameters (mml-parameter-string
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
597 cont '(expiration size permission)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
598 (name (cdr (assq 'name cont)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
599 (url (cdr (assq 'url cont))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
600 (when name
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
601 (setq name (mml-parse-file-name name))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
602 (if (stringp name)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
603 (mml-insert-parameter
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
604 (mail-header-encode-parameter "name" name)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
605 "access-type=local-file")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
606 (mml-insert-parameter
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
607 (mail-header-encode-parameter
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
608 "name" (file-name-nondirectory (nth 2 name)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
609 (mail-header-encode-parameter "site" (nth 1 name))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
610 (mail-header-encode-parameter
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
611 "directory" (file-name-directory (nth 2 name))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
612 (mml-insert-parameter
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
613 (concat "access-type="
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
614 (if (member (nth 0 name) '("ftp@" "anonymous@"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
615 "anon-ftp"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
616 "ftp")))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
617 (when url
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
618 (mml-insert-parameter
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
619 (mail-header-encode-parameter "url" url)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
620 "access-type=url"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
621 (when parameters
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
622 (mml-insert-parameter-string
64693
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
623 cont '(expiration size permission)))
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
624 (insert "\n\n")
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
625 (insert "Content-Type: "
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
626 (or (cdr (assq 'type cont))
64712
4db92b217e85 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-507
Miles Bader <miles@gnu.org>
parents: 64693
diff changeset
627 (if name
4db92b217e85 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-507
Miles Bader <miles@gnu.org>
parents: 64693
diff changeset
628 (or (mm-default-file-encoding name)
4db92b217e85 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-507
Miles Bader <miles@gnu.org>
parents: 64693
diff changeset
629 "application/octet-stream")
4db92b217e85 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-507
Miles Bader <miles@gnu.org>
parents: 64693
diff changeset
630 "text/plain"))
64693
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
631 "\n")
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
632 (insert "Content-ID: " (message-make-message-id) "\n")
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
633 (insert "Content-Transfer-Encoding: "
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
634 (or (cdr (assq 'encoding cont)) "binary"))
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
635 (insert "\n\n")
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
636 (insert (or (cdr (assq 'contents cont))))
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
637 (insert "\n")))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
638 ((eq (car cont) 'multipart)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
639 (let* ((type (or (cdr (assq 'type cont)) "mixed"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
640 (mml-generate-default-type (if (equal type "digest")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
641 "message/rfc822"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
642 "text/plain"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
643 (handler (assoc type mml-generate-multipart-alist)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
644 (if handler
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
645 (funcall (cdr handler) cont)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
646 ;; No specific handler. Use default one.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
647 (let ((mml-boundary (mml-compute-boundary cont)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
648 (insert (format "Content-Type: multipart/%s; boundary=\"%s\""
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
649 type mml-boundary)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
650 (if (cdr (assq 'start cont))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
651 (format "; start=\"%s\"\n" (cdr (assq 'start cont)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
652 "\n"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
653 (let ((cont cont) part)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
654 (while (setq part (pop cont))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
655 ;; Skip `multipart' and attributes.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
656 (when (and (consp part) (consp (cdr part)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
657 (insert "\n--" mml-boundary "\n")
68606
5ea0e0a7dd38 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-42
Miles Bader <miles@gnu.org>
parents: 68380
diff changeset
658 (mml-generate-mime-1 part)
5ea0e0a7dd38 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-42
Miles Bader <miles@gnu.org>
parents: 68380
diff changeset
659 (goto-char (point-max)))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
660 (insert "\n--" mml-boundary "--\n")))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
661 (t
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
662 (error "Invalid element: %S" cont)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
663 ;; handle sign & encrypt tags in a semi-smart way.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
664 (let ((sign-item (assoc (cdr (assq 'sign cont)) mml-sign-alist))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
665 (encrypt-item (assoc (cdr (assq 'encrypt cont))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
666 mml-encrypt-alist))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
667 sender recipients)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
668 (when (or sign-item encrypt-item)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
669 (when (setq sender (cdr (assq 'sender cont)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
670 (message-options-set 'mml-sender sender)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
671 (message-options-set 'message-sender sender))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
672 (if (setq recipients (cdr (assq 'recipients cont)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
673 (message-options-set 'message-recipients recipients))
64693
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
674 (let ((style (mml-signencrypt-style
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64582
diff changeset
675 (first (or sign-item encrypt-item)))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
676 ;; check if: we're both signing & encrypting, both methods
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
677 ;; are the same (why would they be different?!), and that
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
678 ;; the signencrypt style allows for combined operation.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
679 (if (and sign-item encrypt-item (equal (first sign-item)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
680 (first encrypt-item))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
681 (equal style 'combined))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
682 (funcall (nth 1 encrypt-item) cont t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
683 ;; otherwise, revert to the old behavior.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
684 (when sign-item
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
685 (funcall (nth 1 sign-item) cont))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
686 (when encrypt-item
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
687 (funcall (nth 1 encrypt-item) cont)))))))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
688
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
689 (defun mml-compute-boundary (cont)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
690 "Return a unique boundary that does not exist in CONT."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
691 (let ((mml-boundary (funcall mml-boundary-function
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
692 (incf mml-multipart-number))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
693 ;; This function tries again and again until it has found
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
694 ;; a unique boundary.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
695 (while (not (catch 'not-unique
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
696 (mml-compute-boundary-1 cont))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
697 mml-boundary))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
698
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
699 (defun mml-compute-boundary-1 (cont)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
700 (let (filename)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
701 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
702 ((eq (car cont) 'part)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
703 (with-temp-buffer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
704 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
705 ((cdr (assq 'buffer cont))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
706 (insert-buffer-substring (cdr (assq 'buffer cont))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
707 ((and (setq filename (cdr (assq 'filename cont)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
708 (not (equal (cdr (assq 'nofile cont)) "yes")))
57243
c5e16264557d Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-575
Miles Bader <miles@gnu.org>
parents: 57153
diff changeset
709 (mm-insert-file-contents filename nil nil nil nil t))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
710 (t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
711 (insert (cdr (assq 'contents cont)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
712 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
713 (when (re-search-forward (concat "^--" (regexp-quote mml-boundary))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
714 nil t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
715 (setq mml-boundary (funcall mml-boundary-function
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
716 (incf mml-multipart-number)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
717 (throw 'not-unique nil))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
718 ((eq (car cont) 'multipart)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
719 (mapc 'mml-compute-boundary-1 (cddr cont))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
720 t))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
721
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
722 (defun mml-make-boundary (number)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
723 (concat (make-string (% number 60) ?=)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
724 (if (> number 17)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
725 (format "%x" number)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
726 "")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
727 mml-base-boundary))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
728
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
729 (defun mml-content-disposition (type &optional filename)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
730 "Return a default disposition name suitable to TYPE or FILENAME."
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
731 (let ((defs mml-content-disposition-alist)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
732 disposition def types)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
733 (while (and (not disposition) defs)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
734 (setq def (pop defs))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
735 (cond ((stringp (car def))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
736 (when (and filename
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
737 (string-match (car def) filename))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
738 (setq disposition (cdr def))))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
739 ((consp (cdr def))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
740 (when (string= (car (setq types (split-string type "/")))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
741 (car def))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
742 (setq type (cadr types)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
743 types (cdr def))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
744 (while (and (not disposition) types)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
745 (setq def (pop types))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
746 (when (or (eq (car def) t) (string= type (car def)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
747 (setq disposition (cdr def))))))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
748 (t
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
749 (when (or (eq (car def) t) (string= type (car def)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
750 (setq disposition (cdr def))))))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
751 (or disposition "attachment")))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
752
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
753 (defun mml-insert-mime-headers (cont type charset encoding flowed)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
754 (let (parameters id disposition description)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
755 (setq parameters
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
756 (mml-parameter-string
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
757 cont mml-content-type-parameters))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
758 (when (or charset
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
759 parameters
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
760 flowed
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
761 (not (equal type mml-generate-default-type))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
762 mml-insert-mime-headers-always)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
763 (when (consp charset)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
764 (error
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
765 "Can't encode a part with several charsets"))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
766 (insert "Content-Type: " type)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
767 (when charset
68720
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
768 (mml-insert-parameter
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
769 (mail-header-encode-parameter "charset" (symbol-name charset))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
770 (when flowed
68720
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
771 (mml-insert-parameter "format=flowed"))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
772 (when parameters
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
773 (mml-insert-parameter-string
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
774 cont mml-content-type-parameters))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
775 (insert "\n"))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
776 (when (setq id (cdr (assq 'id cont)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
777 (insert "Content-ID: " id "\n"))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
778 (setq parameters
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
779 (mml-parameter-string
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
780 cont mml-content-disposition-parameters))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
781 (when (or (setq disposition (cdr (assq 'disposition cont)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
782 parameters)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
783 (insert "Content-Disposition: "
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
784 (or disposition
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
785 (mml-content-disposition type (cdr (assq 'filename cont)))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
786 (when parameters
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
787 (mml-insert-parameter-string
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
788 cont mml-content-disposition-parameters))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
789 (insert "\n"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
790 (unless (eq encoding '7bit)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
791 (insert (format "Content-Transfer-Encoding: %s\n" encoding)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
792 (when (setq description (cdr (assq 'description cont)))
68720
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
793 (insert "Content-Description: ")
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
794 (setq description (prog1
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
795 (point)
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
796 (insert description "\n")))
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
797 (mail-encode-encoded-word-region description (point)))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
798
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
799 (defun mml-parameter-string (cont types)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
800 (let ((string "")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
801 value type)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
802 (while (setq type (pop types))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
803 (when (setq value (cdr (assq type cont)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
804 ;; Strip directory component from the filename parameter.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
805 (when (eq type 'filename)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
806 (setq value (file-name-nondirectory value)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
807 (setq string (concat string "; "
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
808 (mail-header-encode-parameter
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
809 (symbol-name type) value)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
810 (when (not (zerop (length string)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
811 string)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
812
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
813 (defun mml-insert-parameter-string (cont types)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
814 (let (value type)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
815 (while (setq type (pop types))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
816 (when (setq value (cdr (assq type cont)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
817 ;; Strip directory component from the filename parameter.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
818 (when (eq type 'filename)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
819 (setq value (file-name-nondirectory value)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
820 (mml-insert-parameter
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
821 (mail-header-encode-parameter
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
822 (symbol-name type) value))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
823
86154
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
824 (defvar ange-ftp-name-format)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
825 (defvar efs-path-regexp)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
826
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
827 (defun mml-parse-file-name (path)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
828 (if (if (boundp 'efs-path-regexp)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
829 (string-match efs-path-regexp path)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
830 (if (boundp 'ange-ftp-name-format)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
831 (string-match (car ange-ftp-name-format) path)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
832 (list (match-string 1 path) (match-string 2 path)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
833 (substring path (1+ (match-end 2))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
834 path))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
835
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
836 (defun mml-insert-buffer (buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
837 "Insert BUFFER at point and quote any MML markup."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
838 (save-restriction
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
839 (narrow-to-region (point) (point))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
840 (insert-buffer-substring buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
841 (mml-quote-region (point-min) (point-max))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
842 (goto-char (point-max))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
843
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
844 ;;;
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
845 ;;; Transforming MIME to MML
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
846 ;;;
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
847
87330
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
848 ;; message-narrow-to-head autoloads message.
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
849 (declare-function message-remove-header "message"
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
850 (header &optional is-regexp first reverse))
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
851
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
852 (defun mime-to-mml (&optional handles)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
853 "Translate the current buffer (which should be a message) into MML.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
854 If HANDLES is non-nil, use it instead reparsing the buffer."
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
855 ;; First decode the head.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
856 (save-restriction
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
857 (message-narrow-to-head)
60161
b070535d2416 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-111
Miles Bader <miles@gnu.org>
parents: 59996
diff changeset
858 (let ((rfc2047-quote-decoded-words-containing-tspecials t))
b070535d2416 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-111
Miles Bader <miles@gnu.org>
parents: 59996
diff changeset
859 (mail-decode-encoded-word-region (point-min) (point-max))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
860 (unless handles
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
861 (setq handles (mm-dissect-buffer t)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
862 (goto-char (point-min))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
863 (search-forward "\n\n" nil t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
864 (delete-region (point) (point-max))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
865 (if (stringp (car handles))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
866 (mml-insert-mime handles)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
867 (mml-insert-mime handles t))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
868 (mm-destroy-parts handles)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
869 (save-restriction
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
870 (message-narrow-to-head)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
871 ;; Remove them, they are confusing.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
872 (message-remove-header "Content-Type")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
873 (message-remove-header "MIME-Version")
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
874 (message-remove-header "Content-Disposition")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
875 (message-remove-header "Content-Transfer-Encoding")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
876
87330
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
877 (autoload 'message-encode-message-body "message")
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
878 (declare-function message-narrow-to-headers-or-head "message" ())
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
879
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
880 (defun mml-to-mime ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
881 "Translate the current buffer from MML to MIME."
87928
a5b33bf9597c Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
882 ;; `message-encode-message-body' will insert an encoded Content-Description
a5b33bf9597c Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
883 ;; header in the message header if the body contains a single part
a5b33bf9597c Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
884 ;; that is specified by a user with a MML tag containing a description
a5b33bf9597c Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
885 ;; token. So, we encode the message header first to prevent the encoded
a5b33bf9597c Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
886 ;; Content-Description header from being encoded again.
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
887 (save-restriction
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
888 (message-narrow-to-headers-or-head)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
889 ;; Skip past any From_ headers.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
890 (while (looking-at "From ")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
891 (forward-line 1))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
892 (let ((mail-parse-charset message-default-charset))
87928
a5b33bf9597c Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
893 (mail-encode-encoded-word-buffer)))
a5b33bf9597c Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
894 (message-encode-message-body))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
895
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
896 (defun mml-insert-mime (handle &optional no-markup)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
897 (let (textp buffer mmlp)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
898 ;; Determine type and stuff.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
899 (unless (stringp (car handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
900 (unless (setq textp (equal (mm-handle-media-supertype handle) "text"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
901 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
902 (set-buffer (setq buffer (mml-generate-new-buffer " *mml*")))
102366
93b10d2621d3 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
903 (if (eq (mail-content-type-get (mm-handle-type handle) 'charset)
93b10d2621d3 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
904 'gnus-decoded)
93b10d2621d3 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
905 ;; A part that mm-uu dissected from a non-MIME message
93b10d2621d3 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
906 ;; because of `gnus-article-emulate-mime'.
93b10d2621d3 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
907 (progn
93b10d2621d3 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
908 (mm-enable-multibyte)
93b10d2621d3 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
909 (insert-buffer-substring (mm-handle-buffer handle)))
93b10d2621d3 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
910 (mm-insert-part handle 'no-cache)
93b10d2621d3 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
911 (if (setq mmlp (equal (mm-handle-media-type handle)
93b10d2621d3 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
912 "message/rfc822"))
93b10d2621d3 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
913 (mime-to-mml))))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
914 (if mmlp
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
915 (mml-insert-mml-markup handle nil t t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
916 (unless (and no-markup
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
917 (equal (mm-handle-media-type handle) "text/plain"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
918 (mml-insert-mml-markup handle buffer textp)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
919 (cond
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43166
diff changeset
920 (mmlp
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
921 (insert-buffer-substring buffer)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
922 (goto-char (point-max))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
923 (insert "<#/mml>\n"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
924 ((stringp (car handle))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
925 (mapc 'mml-insert-mime (cdr handle))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
926 (insert "<#/multipart>\n"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
927 (textp
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
928 (let ((charset (mail-content-type-get
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
929 (mm-handle-type handle) 'charset))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
930 (start (point)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
931 (if (eq charset 'gnus-decoded)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
932 (mm-insert-part handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
933 (insert (mm-decode-string (mm-get-part handle) charset)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
934 (mml-quote-region start (point)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
935 (goto-char (point-max)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
936 (t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
937 (insert "<#/part>\n")))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
938
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
939 (defun mml-insert-mml-markup (handle &optional buffer nofile mmlp)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
940 "Take a MIME handle and insert an MML tag."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
941 (if (stringp (car handle))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
942 (progn
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
943 (insert "<#multipart type=" (mm-handle-media-subtype handle))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
944 (let ((start (mm-handle-multipart-ctl-parameter handle 'start)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
945 (when start
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
946 (insert " start=\"" start "\"")))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
947 (insert ">\n"))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
948 (if mmlp
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
949 (insert "<#mml type=" (mm-handle-media-type handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
950 (insert "<#part type=" (mm-handle-media-type handle)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
951 (dolist (elem (append (cdr (mm-handle-type handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
952 (cdr (mm-handle-disposition handle))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
953 (unless (symbolp (cdr elem))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
954 (insert " " (symbol-name (car elem)) "=\"" (cdr elem) "\"")))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
955 (when (mm-handle-id handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
956 (insert " id=\"" (mm-handle-id handle) "\""))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
957 (when (mm-handle-disposition handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
958 (insert " disposition=" (car (mm-handle-disposition handle))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
959 (when buffer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
960 (insert " buffer=\"" (buffer-name buffer) "\""))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
961 (when nofile
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
962 (insert " nofile=yes"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
963 (when (mm-handle-description handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
964 (insert " description=\"" (mm-handle-description handle) "\""))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
965 (insert ">\n")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
966
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
967 (defun mml-insert-parameter (&rest parameters)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
968 "Insert PARAMETERS in a nice way."
68720
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
969 (let (start end)
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
970 (dolist (param parameters)
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
971 (insert ";")
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
972 (setq start (point))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
973 (insert " " param)
68720
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
974 (setq end (point))
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
975 (goto-char start)
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
976 (end-of-line)
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
977 (if (> (current-column) 76)
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
978 (progn
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
979 (goto-char start)
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
980 (insert "\n")
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
981 (goto-char (1+ end)))
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68606
diff changeset
982 (goto-char end)))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
983
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
984 ;;;
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
985 ;;; Mode for inserting and editing MML forms
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
986 ;;;
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
987
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
988 (defvar mml-mode-map
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
989 (let ((sign (make-sparse-keymap))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
990 (encrypt (make-sparse-keymap))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
991 (signpart (make-sparse-keymap))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
992 (encryptpart (make-sparse-keymap))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
993 (map (make-sparse-keymap))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
994 (main (make-sparse-keymap)))
70245
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
995 (define-key map "\C-s" 'mml-secure-message-sign)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
996 (define-key map "\C-c" 'mml-secure-message-encrypt)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
997 (define-key map "\C-e" 'mml-secure-message-sign-encrypt)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
998 (define-key map "\C-p\C-s" 'mml-secure-sign)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
999 (define-key map "\C-p\C-c" 'mml-secure-encrypt)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1000 (define-key sign "p" 'mml-secure-message-sign-pgpmime)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1001 (define-key sign "o" 'mml-secure-message-sign-pgp)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1002 (define-key sign "s" 'mml-secure-message-sign-smime)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1003 (define-key signpart "p" 'mml-secure-sign-pgpmime)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1004 (define-key signpart "o" 'mml-secure-sign-pgp)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1005 (define-key signpart "s" 'mml-secure-sign-smime)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1006 (define-key encrypt "p" 'mml-secure-message-encrypt-pgpmime)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1007 (define-key encrypt "o" 'mml-secure-message-encrypt-pgp)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1008 (define-key encrypt "s" 'mml-secure-message-encrypt-smime)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1009 (define-key encryptpart "p" 'mml-secure-encrypt-pgpmime)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1010 (define-key encryptpart "o" 'mml-secure-encrypt-pgp)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1011 (define-key encryptpart "s" 'mml-secure-encrypt-smime)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1012 (define-key map "\C-n" 'mml-unsecure-message)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1013 (define-key map "f" 'mml-attach-file)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1014 (define-key map "b" 'mml-attach-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1015 (define-key map "e" 'mml-attach-external)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1016 (define-key map "q" 'mml-quote-region)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1017 (define-key map "m" 'mml-insert-multipart)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1018 (define-key map "p" 'mml-insert-part)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1019 (define-key map "v" 'mml-validate)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1020 (define-key map "P" 'mml-preview)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1021 (define-key map "s" sign)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1022 (define-key map "S" signpart)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1023 (define-key map "c" encrypt)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1024 (define-key map "C" encryptpart)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1025 ;;(define-key map "n" 'mml-narrow-to-part)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1026 ;; `M-m' conflicts with `back-to-indentation'.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1027 ;; (define-key main "\M-m" map)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1028 (define-key main "\C-c\C-m" map)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1029 main))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1030
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1031 (easy-menu-define
40758
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 40757
diff changeset
1032 mml-menu mml-mode-map ""
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1033 `("Attachments"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1034 ["Attach File..." mml-attach-file
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1035 ,@(if (featurep 'xemacs) '(t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1036 '(:help "Attach a file at point"))]
70245
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1037 ["Attach Buffer..." mml-attach-buffer
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1038 ,@(if (featurep 'xemacs) '(t)
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92336
diff changeset
1039 '(:help "Attach a buffer to the outgoing message"))]
70245
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1040 ["Attach External..." mml-attach-external
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1041 ,@(if (featurep 'xemacs) '(t)
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92336
diff changeset
1042 '(:help "Attach reference to an external file"))]
93386
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1043 ;; FIXME: Is it possible to do this without using
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1044 ;; `gnus-gcc-externalize-attachments'?
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1045 ["Externalize Attachments"
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1046 (lambda ()
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1047 (interactive)
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1048 (if (not (and (boundp 'gnus-gcc-externalize-attachments)
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1049 (memq gnus-gcc-externalize-attachments
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1050 '(all t nil))))
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1051 ;; Stupid workaround for XEmacs not honoring :visible.
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1052 (message "Can't handle this value of `gnus-gcc-externalize-attachments'")
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1053 (setq gnus-gcc-externalize-attachments
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1054 (not gnus-gcc-externalize-attachments))
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1055 (message "gnus-gcc-externalize-attachments is `%s'."
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1056 gnus-gcc-externalize-attachments)))
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1057 ;; XEmacs barfs on :visible.
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1058 ,@(if (featurep 'xemacs) nil
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1059 '(:visible (and (boundp 'gnus-gcc-externalize-attachments)
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1060 (memq gnus-gcc-externalize-attachments
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1061 '(all t nil)))))
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1062 :style toggle
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1063 :selected gnus-gcc-externalize-attachments
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1064 ,@(if (featurep 'xemacs) nil
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1065 '(:help "Save attachments as external parts in Gcc copies"))]
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92336
diff changeset
1066 "----"
70245
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1067 ;;
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1068 ("Change Security Method"
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1069 ["PGP/MIME"
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1070 (lambda () (interactive) (setq mml-secure-method "pgpmime"))
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1071 ,@(if (featurep 'xemacs) nil
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1072 '(:help "Set Security Method to PGP/MIME"))
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1073 :style radio
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1074 :selected (equal mml-secure-method "pgpmime") ]
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1075 ["S/MIME"
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1076 (lambda () (interactive) (setq mml-secure-method "smime"))
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1077 ,@(if (featurep 'xemacs) nil
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1078 '(:help "Set Security Method to S/MIME"))
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1079 :style radio
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1080 :selected (equal mml-secure-method "smime") ]
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1081 ["Inline PGP"
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1082 (lambda () (interactive) (setq mml-secure-method "pgp"))
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1083 ,@(if (featurep 'xemacs) nil
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1084 '(:help "Set Security Method to inline PGP"))
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1085 :style radio
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1086 :selected (equal mml-secure-method "pgp") ] )
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1087 ;;
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1088 ["Sign Message" mml-secure-message-sign t]
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1089 ["Encrypt Message" mml-secure-message-encrypt t]
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1090 ["Sign and Encrypt Message" mml-secure-message-sign-encrypt t]
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1091 ["Encrypt/Sign off" mml-unsecure-message
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1092 ,@(if (featurep 'xemacs) '(t)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1093 '(:help "Don't Encrypt/Sign Message"))]
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92336
diff changeset
1094 ;; Do we have separate encrypt and encrypt/sign commands for parts?
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92336
diff changeset
1095 ["Sign Part" mml-secure-sign t]
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92336
diff changeset
1096 ["Encrypt Part" mml-secure-encrypt t]
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92336
diff changeset
1097 "----"
70245
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1098 ;; Maybe we could remove these, because people who write MML most probably
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1099 ;; don't use the menu:
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1100 ["Insert Part..." mml-insert-part
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1101 :active (message-in-body-p)]
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1102 ["Insert Multipart..." mml-insert-multipart
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1103 :active (message-in-body-p)]
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1104 ;;
40758
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 40757
diff changeset
1105 ;;["Narrow" mml-narrow-to-part t]
70245
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1106 ["Quote MML in region" mml-quote-region
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1107 :active (message-mark-active-p)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1108 ,@(if (featurep 'xemacs) nil
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1109 '(:help "Quote MML tags in region"))]
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1110 ["Validate MML" mml-validate t]
68380
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 66808
diff changeset
1111 ["Preview" mml-preview t]
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 66808
diff changeset
1112 "----"
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 66808
diff changeset
1113 ["Emacs MIME manual" (lambda () (interactive) (message-info 4))
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 66808
diff changeset
1114 ,@(if (featurep 'xemacs) '(t)
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 66808
diff changeset
1115 '(:help "Display the Emacs MIME manual"))]
93386
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1116 ["PGG manual" (lambda () (interactive) (message-info mml2015-use))
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1117 ;; XEmacs barfs on :visible.
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1118 ,@(if (featurep 'xemacs) nil
98440
9f489d6f8e69 (mml-menu): Don't assume mml2015 is bound.
Chong Yidong <cyd@stupidchicken.com>
parents: 95820
diff changeset
1119 '(:visible (and (boundp 'mml2015-use) (equal mml2015-use 'pgg))))
68380
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 66808
diff changeset
1120 ,@(if (featurep 'xemacs) '(t)
93386
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1121 '(:help "Display the PGG manual"))]
98440
9f489d6f8e69 (mml-menu): Don't assume mml2015 is bound.
Chong Yidong <cyd@stupidchicken.com>
parents: 95820
diff changeset
1122 ["EasyPG manual" (lambda () (interactive) (require 'mml2015) (message-info mml2015-use))
93386
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1123 ;; XEmacs barfs on :visible.
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1124 ,@(if (featurep 'xemacs) nil
98440
9f489d6f8e69 (mml-menu): Don't assume mml2015 is bound.
Chong Yidong <cyd@stupidchicken.com>
parents: 95820
diff changeset
1125 '(:visible (and (boundp 'mml2015-use) (equal mml2015-use 'epg))))
93386
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1126 ,@(if (featurep 'xemacs) '(t)
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
1127 '(:help "Display the EasyPG manual"))]))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1128
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1129 (defvar mml-mode nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1130 "Minor mode for editing MML.")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1131
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1132 (defun mml-mode (&optional arg)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1133 "Minor mode for editing MML.
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1134 MML is the MIME Meta Language, a minor mode for composing MIME articles.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1135 See Info node `(emacs-mime)Composing'.
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1136
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1137 \\{mml-mode-map}"
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1138 (interactive "P")
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1139 (when (set (make-local-variable 'mml-mode)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1140 (if (null arg) (not mml-mode)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1141 (> (prefix-numeric-value arg) 0)))
70245
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1142 (add-minor-mode 'mml-mode " MML" mml-mode-map)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1143 (easy-menu-add mml-menu mml-mode-map)
70245
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1144 (when (boundp 'dnd-protocol-alist)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1145 (set (make-local-variable 'dnd-protocol-alist)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1146 (append mml-dnd-protocol-alist dnd-protocol-alist)))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1147 (run-hooks 'mml-mode-hook)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1148
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1149 ;;;
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1150 ;;; Helper functions for reading MIME stuff from the minibuffer and
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1151 ;;; inserting stuff to the buffer.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1152 ;;;
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1153
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1154 (defcustom mml-default-directory mm-default-directory
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1155 "The default directory where mml will find files.
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1156 If not set, `default-directory' will be used."
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1157 :type '(choice directory (const :tag "Default" nil))
92336
5f827896103e Change defcustom :version from 23.0 to 23.1.
Glenn Morris <rgm@gnu.org>
parents: 92153
diff changeset
1158 :version "23.1" ;; No Gnus
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1159 :group 'message)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1160
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1161 (defun mml-minibuffer-read-file (prompt)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1162 (let* ((completion-ignored-extensions nil)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1163 (file (read-file-name prompt
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1164 (or mml-default-directory default-directory)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1165 nil t)))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1166 ;; Prevent some common errors. This is inspired by similar code in
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1167 ;; VM.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1168 (when (file-directory-p file)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1169 (error "%s is a directory, cannot attach" file))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1170 (unless (file-exists-p file)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1171 (error "No such file: %s" file))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1172 (unless (file-readable-p file)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1173 (error "Permission denied: %s" file))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1174 file))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1175
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1176 (defun mml-minibuffer-read-type (name &optional default)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1177 (mailcap-parse-mimetypes)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1178 (let* ((default (or default
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1179 (mm-default-file-encoding name)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1180 ;; Perhaps here we should check what the file
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1181 ;; looks like, and offer text/plain if it looks
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1182 ;; like text/plain.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1183 "application/octet-stream"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1184 (string (completing-read
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1185 (format "Content type (default %s): " default)
33124
4e779ba474ee (mml-parse-1): Clarify message.
Dave Love <fx@gnu.org>
parents: 33123
diff changeset
1186 (mapcar 'list (mailcap-mime-types)))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1187 (if (not (equal string ""))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1188 string
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1189 default)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1190
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1191 (defun mml-minibuffer-read-description ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1192 (let ((description (read-string "One line description: ")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1193 (when (string-match "\\`[ \t]*\\'" description)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1194 (setq description nil))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1195 description))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1196
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1197 (defun mml-minibuffer-read-disposition (type &optional default filename)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1198 (unless default
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1199 (setq default (mml-content-disposition type filename)))
64582
3196fbe99547 (mml-minibuffer-read-disposition): Don't use inline by default
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 64085
diff changeset
1200 (let ((disposition (completing-read
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1201 (format "Disposition (default %s): " default)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1202 '(("attachment") ("inline") (""))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1203 nil t nil nil default)))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1204 (if (not (equal disposition ""))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1205 disposition
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1206 default)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1207
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1208 (defun mml-quote-region (beg end)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1209 "Quote the MML tags in the region."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1210 (interactive "r")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1211 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1212 (save-restriction
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1213 ;; Temporarily narrow the region to defend from changes
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1214 ;; invalidating END.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1215 (narrow-to-region beg end)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1216 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1217 ;; Quote parts.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1218 (while (re-search-forward
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1219 "<#!*/?\\(multipart\\|part\\|external\\|mml\\)" nil t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1220 ;; Insert ! after the #.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1221 (goto-char (+ (match-beginning 0) 2))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1222 (insert "!")))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1223
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1224 (defun mml-insert-tag (name &rest plist)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1225 "Insert an MML tag described by NAME and PLIST."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1226 (when (symbolp name)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1227 (setq name (symbol-name name)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1228 (insert "<#" name)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1229 (while plist
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1230 (let ((key (pop plist))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1231 (value (pop plist)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1232 (when value
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1233 ;; Quote VALUE if it contains suspicious characters.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1234 (when (string-match "[\"'\\~/*;() \t\n]" value)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1235 (setq value (with-output-to-string
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1236 (let (print-escape-nonascii)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1237 (prin1 value)))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1238 (insert (format " %s=%s" key value)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1239 (insert ">\n"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1240
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1241 (defun mml-insert-empty-tag (name &rest plist)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1242 "Insert an empty MML tag described by NAME and PLIST."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1243 (when (symbolp name)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1244 (setq name (symbol-name name)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1245 (apply #'mml-insert-tag name plist)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1246 (insert "<#/" name ">\n"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1247
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1248 ;;; Attachment functions.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1249
70245
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1250 (defcustom mml-dnd-protocol-alist
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1251 '(("^file:///" . mml-dnd-attach-file)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1252 ("^file://" . dnd-open-file)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1253 ("^file:" . mml-dnd-attach-file))
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1254 "The functions to call when a drop in `mml-mode' is made.
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1255 See `dnd-protocol-alist' for more information. When nil, behave
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1256 as in other buffers."
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1257 :type '(choice (repeat (cons (regexp) (function)))
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1258 (const :tag "Behave as in other buffers" nil))
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1259 :version "22.1" ;; Gnus 5.10.9
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1260 :group 'message)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1261
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1262 (defcustom mml-dnd-attach-options nil
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1263 "Which options should be queried when attaching a file via drag and drop.
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1264
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1265 If it is a list, valid members are `type', `description' and
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1266 `disposition'. `disposition' implies `type'. If it is nil,
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1267 don't ask for options. If it is t, ask the user whether or not
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1268 to specify options."
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1269 :type '(choice
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92336
diff changeset
1270 (const :tag "None" nil)
70245
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1271 (const :tag "Query" t)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1272 (list :value (type description disposition)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1273 (set :inline t
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1274 (const type)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1275 (const description)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1276 (const disposition))))
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1277 :version "22.1" ;; Gnus 5.10.9
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1278 :group 'message)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1279
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1280 (defun mml-attach-file (file &optional type description disposition)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1281 "Attach a file to the outgoing MIME message.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1282 The file is not inserted or encoded until you send the message with
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1283 `\\[message-send-and-exit]' or `\\[message-send]'.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1284
68380
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 66808
diff changeset
1285 FILE is the name of the file to attach. TYPE is its
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 66808
diff changeset
1286 content-type, a string of the form \"type/subtype\". DESCRIPTION
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 66808
diff changeset
1287 is a one-line description of the attachment. The DISPOSITION
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 66808
diff changeset
1288 specifies how the attachment is intended to be displayed. It can
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 66808
diff changeset
1289 be either \"inline\" (displayed automatically within the message
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 66808
diff changeset
1290 body) or \"attachment\" (separate from the body)."
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1291 (interactive
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1292 (let* ((file (mml-minibuffer-read-file "Attach file: "))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1293 (type (mml-minibuffer-read-type file))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1294 (description (mml-minibuffer-read-description))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1295 (disposition (mml-minibuffer-read-disposition type nil file)))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1296 (list file type description disposition)))
104780
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1297 ;; Don't move point if this command is invoked inside the message header.
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1298 (let ((head (unless (message-in-body-p)
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1299 (prog1
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1300 (point)
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1301 (goto-char (point-max))))))
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1302 (mml-insert-empty-tag 'part
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1303 'type type
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1304 ;; icicles redefines read-file-name and returns a
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1305 ;; string w/ text properties :-/
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1306 'filename (mm-substring-no-properties file)
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1307 'disposition (or disposition "attachment")
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1308 'description description)
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1309 (when head
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1310 (unless (prog1
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1311 (pos-visible-in-window-p)
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1312 (goto-char head))
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1313 (message "The file \"%s\" has been attached at the end of the message"
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1314 (file-name-nondirectory file))))))
70245
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1315
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1316 (defun mml-dnd-attach-file (uri action)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1317 "Attach a drag and drop file.
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1318
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1319 Ask for type, description or disposition according to
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1320 `mml-dnd-attach-options'."
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1321 (let ((file (dnd-get-local-file-name uri t)))
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1322 (when (and file (file-regular-p file))
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1323 (let ((mml-dnd-attach-options mml-dnd-attach-options)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1324 type description disposition)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1325 (setq mml-dnd-attach-options
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1326 (when (and (eq mml-dnd-attach-options t)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1327 (not
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1328 (y-or-n-p
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1329 "Use default type, disposition and description? ")))
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1330 '(type description disposition)))
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1331 (when (or (memq 'type mml-dnd-attach-options)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1332 (memq 'disposition mml-dnd-attach-options))
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1333 (setq type (mml-minibuffer-read-type file)))
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1334 (when (memq 'description mml-dnd-attach-options)
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1335 (setq description (mml-minibuffer-read-description)))
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1336 (when (memq 'disposition mml-dnd-attach-options)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1337 (setq disposition (mml-minibuffer-read-disposition type nil file)))
70245
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
1338 (mml-attach-file file type description disposition)))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1339
95086
241ad02f83c7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94662
diff changeset
1340 (defun mml-attach-buffer (buffer &optional type description disposition)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1341 "Attach a buffer to the outgoing MIME message.
95086
241ad02f83c7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94662
diff changeset
1342 BUFFER is the name of the buffer to attach. See
241ad02f83c7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94662
diff changeset
1343 `mml-attach-file' for details of operation."
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1344 (interactive
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1345 (let* ((buffer (read-buffer "Attach buffer: "))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1346 (type (mml-minibuffer-read-type buffer "text/plain"))
95086
241ad02f83c7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94662
diff changeset
1347 (description (mml-minibuffer-read-description))
241ad02f83c7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94662
diff changeset
1348 (disposition (mml-minibuffer-read-disposition type nil)))
241ad02f83c7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94662
diff changeset
1349 (list buffer type description disposition)))
104780
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1350 ;; Don't move point if this command is invoked inside the message header.
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1351 (let ((head (unless (message-in-body-p)
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1352 (prog1
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1353 (point)
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1354 (goto-char (point-max))))))
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1355 (mml-insert-empty-tag 'part 'type type 'buffer buffer
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1356 'disposition disposition
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1357 'description description)
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1358 (when head
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1359 (unless (prog1
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1360 (pos-visible-in-window-p)
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1361 (goto-char head))
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1362 (message
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1363 "The buffer \"%s\" has been attached at the end of the message"
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1364 buffer)))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1365
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1366 (defun mml-attach-external (file &optional type description)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1367 "Attach an external file into the buffer.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1368 FILE is an ange-ftp/efs specification of the part location.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1369 TYPE is the MIME type to use."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1370 (interactive
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1371 (let* ((file (mml-minibuffer-read-file "Attach external file: "))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1372 (type (mml-minibuffer-read-type file))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1373 (description (mml-minibuffer-read-description)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1374 (list file type description)))
104780
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1375 ;; Don't move point if this command is invoked inside the message header.
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1376 (let ((head (unless (message-in-body-p)
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1377 (prog1
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1378 (point)
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1379 (goto-char (point-max))))))
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1380 (mml-insert-empty-tag 'external 'type type 'name file
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1381 'disposition "attachment" 'description description)
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1382 (when head
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1383 (unless (prog1
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1384 (pos-visible-in-window-p)
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1385 (goto-char head))
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1386 (message "The file \"%s\" has been attached at the end of the message"
d44c1d7690e7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 104692
diff changeset
1387 (file-name-nondirectory file))))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1388
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1389 (defun mml-insert-multipart (&optional type)
104895
6fd9d35186e0 * nnrss.el (nnrss-request-article): Remove binding of
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 104889
diff changeset
1390 (interactive (if (message-in-body-p)
6fd9d35186e0 * nnrss.el (nnrss-request-article): Remove binding of
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 104889
diff changeset
1391 (list (completing-read "Multipart type (default mixed): "
6fd9d35186e0 * nnrss.el (nnrss-request-article): Remove binding of
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 104889
diff changeset
1392 '(("mixed") ("alternative")
6fd9d35186e0 * nnrss.el (nnrss-request-article): Remove binding of
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 104889
diff changeset
1393 ("digest") ("parallel")
6fd9d35186e0 * nnrss.el (nnrss-request-article): Remove binding of
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 104889
diff changeset
1394 ("signed") ("encrypted"))
6fd9d35186e0 * nnrss.el (nnrss-request-article): Remove binding of
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 104889
diff changeset
1395 nil nil "mixed"))
6fd9d35186e0 * nnrss.el (nnrss-request-article): Remove binding of
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 104889
diff changeset
1396 (error "Use this command in the message body")))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1397 (or type
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1398 (setq type "mixed"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1399 (mml-insert-empty-tag "multipart" 'type type)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1400 (forward-line -1))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1401
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1402 (defun mml-insert-part (&optional type)
104895
6fd9d35186e0 * nnrss.el (nnrss-request-article): Remove binding of
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 104889
diff changeset
1403 (interactive (if (message-in-body-p)
6fd9d35186e0 * nnrss.el (nnrss-request-article): Remove binding of
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 104889
diff changeset
1404 (list (mml-minibuffer-read-type ""))
6fd9d35186e0 * nnrss.el (nnrss-request-article): Remove binding of
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 104889
diff changeset
1405 (error "Use this command in the message body")))
6fd9d35186e0 * nnrss.el (nnrss-request-article): Remove binding of
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 104889
diff changeset
1406 (mml-insert-tag 'part 'type type 'disposition "inline"))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1407
87330
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
1408 (declare-function message-subscribed-p "message" ())
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
1409 (declare-function message-make-mail-followup-to "message"
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
1410 (&optional only-show-subscribed))
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
1411 (declare-function message-position-on-field "message" (header &rest afters))
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
1412
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1413 (defun mml-preview-insert-mail-followup-to ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1414 "Insert a Mail-Followup-To header before previewing an article.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1415 Should be adopted if code in `message-send-mail' is changed."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1416 (when (and (message-mail-p)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1417 (message-subscribed-p)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1418 (not (mail-fetch-field "mail-followup-to"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1419 (message-make-mail-followup-to))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1420 (message-position-on-field "Mail-Followup-To" "X-Draft-From")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1421 (insert (message-make-mail-followup-to))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1422
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1423 (defvar mml-preview-buffer nil)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1424
87238
ada1cfe623ac Add declare-function compatibility definition.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
1425 (autoload 'gnus-make-hashtable "gnus-util")
ada1cfe623ac Add declare-function compatibility definition.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
1426 (autoload 'widget-button-press "wid-edit" nil t)
ada1cfe623ac Add declare-function compatibility definition.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
1427 (declare-function widget-event-point "wid-edit" (event))
ada1cfe623ac Add declare-function compatibility definition.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
1428 ;; If gnus-buffer-configuration is bound this is loaded.
ada1cfe623ac Add declare-function compatibility definition.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
1429 (declare-function gnus-configure-windows "gnus-win" (setting &optional force))
87330
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
1430 ;; Called after message-mail-p, which autoloads message.
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
1431 (declare-function message-news-p "message" ())
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
1432 (declare-function message-options-set-recipient "message" ())
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
1433 (declare-function message-generate-headers "message" (headers))
13b76cb6c8fa (message-options-set, message-narrow-to-head)
Glenn Morris <rgm@gnu.org>
parents: 87238
diff changeset
1434 (declare-function message-sort-headers "message" ())
87238
ada1cfe623ac Add declare-function compatibility definition.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
1435
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1436 (defun mml-preview (&optional raw)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1437 "Display current buffer with Gnus, in a new buffer.
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1438 If RAW, display a raw encoded MIME message.
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1439
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1440 The window layout for the preview buffer is controled by the variables
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1441 `special-display-buffer-names', `special-display-regexps', or
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1442 `gnus-buffer-configuration' (the first match made will be used),
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1443 or the `pop-to-buffer' function."
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1444 (interactive "P")
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1445 (setq mml-preview-buffer (generate-new-buffer
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1446 (concat (if raw "*Raw MIME preview of "
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1447 "*MIME preview of ") (buffer-name))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1448 (save-excursion
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1449 (let* ((buf (current-buffer))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1450 (message-options message-options)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1451 (message-this-is-mail (message-mail-p))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1452 (message-this-is-news (message-news-p))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1453 (message-posting-charset (or (gnus-setup-posting-charset
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1454 (save-restriction
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1455 (message-narrow-to-headers-or-head)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1456 (message-fetch-field "Newsgroups")))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1457 message-posting-charset)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1458 (message-options-set-recipient)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1459 (when (boundp 'gnus-buffers)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1460 (push mml-preview-buffer gnus-buffers))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1461 (save-restriction
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1462 (widen)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1463 (set-buffer mml-preview-buffer)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1464 (erase-buffer)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1465 (insert-buffer-substring buf))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1466 (mml-preview-insert-mail-followup-to)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1467 (let ((message-deletable-headers (if (message-news-p)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1468 nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1469 message-deletable-headers)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1470 (message-generate-headers
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1471 (copy-sequence (if (message-news-p)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1472 message-required-news-headers
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1473 message-required-mail-headers))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1474 (if (re-search-forward
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1475 (concat "^" (regexp-quote mail-header-separator) "\n") nil t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1476 (replace-match "\n"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1477 (let ((mail-header-separator ""));; mail-header-separator is removed.
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1478 (message-sort-headers)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1479 (mml-to-mime))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1480 (if raw
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1481 (when (fboundp 'set-buffer-multibyte)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1482 (let ((s (buffer-string)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1483 ;; Insert the content into unibyte buffer.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1484 (erase-buffer)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1485 (mm-disable-multibyte)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1486 (insert s)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1487 (let ((gnus-newsgroup-charset (car message-posting-charset))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1488 gnus-article-prepare-hook gnus-original-article-buffer)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1489 (run-hooks 'gnus-article-decode-hook)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1490 (let ((gnus-newsgroup-name "dummy")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1491 (gnus-newsrc-hashtb (or gnus-newsrc-hashtb
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1492 (gnus-make-hashtable 5))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1493 (gnus-article-prepare-display))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1494 ;; Disable article-mode-map.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1495 (use-local-map nil)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1496 (gnus-make-local-hook 'kill-buffer-hook)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1497 (add-hook 'kill-buffer-hook
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1498 (lambda ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1499 (mm-destroy-parts gnus-article-mime-handles)) nil t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1500 (setq buffer-read-only t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1501 (local-set-key "q" (lambda () (interactive) (kill-buffer nil)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1502 (local-set-key "=" (lambda () (interactive) (delete-other-windows)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1503 (local-set-key "\r"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1504 (lambda ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1505 (interactive)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1506 (widget-button-press (point))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1507 (local-set-key gnus-mouse-2
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1508 (lambda (event)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1509 (interactive "@e")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1510 (widget-button-press (widget-event-point event) event)))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1511 ;; FIXME: Buffer is in article mode, but most tool bar commands won't
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1512 ;; work. Maybe only keep the following icons: search, print, quit
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1513 (goto-char (point-min))))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1514 (if (and (not (mm-special-display-p (buffer-name mml-preview-buffer)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1515 (boundp 'gnus-buffer-configuration)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1516 (assq 'mml-preview gnus-buffer-configuration))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1517 (let ((gnus-message-buffer (current-buffer)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1518 (gnus-configure-windows 'mml-preview))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78673
diff changeset
1519 (pop-to-buffer mml-preview-buffer)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1520
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1521 (defun mml-validate ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1522 "Validate the current MML document."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1523 (interactive)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1524 (mml-parse))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1525
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1526 (defun mml-tweak-part (cont)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1527 "Tweak a MML part."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1528 (let ((tweak (cdr (assq 'tweak cont)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1529 func)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1530 (cond
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1531 (tweak
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1532 (setq func
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1533 (or (cdr (assoc tweak mml-tweak-function-alist))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1534 (intern tweak))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1535 (mml-tweak-type-alist
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1536 (let ((alist mml-tweak-type-alist)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1537 (type (or (cdr (assq 'type cont)) "text/plain")))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1538 (while alist
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1539 (if (string-match (caar alist) type)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1540 (setq func (cdar alist)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1541 alist nil)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1542 (setq alist (cdr alist)))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1543 (if func
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1544 (funcall func cont)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1545 cont)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1546 (let ((alist mml-tweak-sexp-alist))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1547 (while alist
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1548 (if (eval (caar alist))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1549 (funcall (cdar alist) cont))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1550 (setq alist (cdr alist)))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1551 cont)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1552
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1553 (defun mml-tweak-externalize-attachments (cont)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1554 "Tweak attached files as external parts."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1555 (let (filename-cons)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1556 (when (and (eq (car cont) 'part)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1557 (not (cdr (assq 'buffer cont)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1558 (and (setq filename-cons (assq 'filename cont))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1559 (not (equal (cdr (assq 'nofile cont)) "yes"))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1560 (setcar cont 'external)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1561 (setcar filename-cons 'name))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1562
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1563 (provide 'mml)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1564
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93386
diff changeset
1565 ;; arch-tag: 583c96cf-1ffe-451b-a5e5-4733ae9ddd12
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1566 ;;; mml.el ends here