annotate lisp/gnus/mm-decode.el @ 110934:a36fccf2a365

lisp/net/telnet.el (telnet-mode-map): Fix previous change.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 12 Oct 2010 03:48:58 +0200
parents 236342431786
children 3958dbde1223
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 ;;; mm-decode.el --- Functions for decoding MIME things
64754
fafd692d1e40 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64693
diff changeset
2
fafd692d1e40 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64693
diff changeset
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 103570
diff changeset
4 ;; 2005, 2006, 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 ;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94209
diff changeset
10 ;; 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
11 ;; 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: 94209
diff changeset
12 ;; 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: 94209
diff changeset
13 ;; (at your option) any later version.
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16 ;; 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: 94209
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20 ;; 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: 94209
diff changeset
21 ;; 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
22
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
23 ;;; Commentary:
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
25 ;;; Code:
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
26
110918
236342431786 nnimap.el (gnutls-negotiate): Silence the byte compiler.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
27 ;; For Emacs <22.2 and XEmacs.
87243
23ea76295829 Add declare-function compatibility definition.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
28 (eval-and-compile
23ea76295829 Add declare-function compatibility definition.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
29 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
23ea76295829 Add declare-function compatibility definition.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
30
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31 (require 'mail-parse)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
32 (require 'mm-bodies)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
33 (eval-when-compile (require 'cl)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
34 (require 'term))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
35
107427
ecbe0edc4f69 Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
36 (autoload 'gnus-map-function "gnus-util")
ecbe0edc4f69 Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
37 (autoload 'gnus-replace-in-string "gnus-util")
ecbe0edc4f69 Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
38 (autoload 'gnus-read-shell-command "gnus-util")
ecbe0edc4f69 Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
39
95814
eb119cbc1715 (image-size): Declare.
Glenn Morris <rgm@gnu.org>
parents: 95586
diff changeset
40 (autoload 'mm-inline-partial "mm-partial")
eb119cbc1715 (image-size): Declare.
Glenn Morris <rgm@gnu.org>
parents: 95586
diff changeset
41 (autoload 'mm-inline-external-body "mm-extern")
eb119cbc1715 (image-size): Declare.
Glenn Morris <rgm@gnu.org>
parents: 95586
diff changeset
42 (autoload 'mm-extern-cache-contents "mm-extern")
eb119cbc1715 (image-size): Declare.
Glenn Morris <rgm@gnu.org>
parents: 95586
diff changeset
43 (autoload 'mm-insert-inline "mm-view")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
44
65275
285f667dc098 (gnus-current-window-configuration): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
45 (defvar gnus-current-window-configuration)
285f667dc098 (gnus-current-window-configuration): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
46
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
47 (add-hook 'gnus-exit-gnus-hook 'mm-destroy-postponed-undisplay-list)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
48
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
49 (defgroup mime-display ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
50 "Display of MIME in mail and news articles."
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
51 :link '(custom-manual "(emacs-mime)Display Customization")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52 :version "21.1"
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53 :group 'mail
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54 :group 'news
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
55 :group 'multimedia)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
56
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
57 (defgroup mime-security ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
58 "MIME security in mail and news articles."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
59 :link '(custom-manual "(emacs-mime)Display Customization")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
60 :group 'mail
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
61 :group 'news
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
62 :group 'multimedia)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
63
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
64 ;;; Convenience macros.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
65
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
66 (defmacro mm-handle-buffer (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
67 `(nth 0 ,handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
68 (defmacro mm-handle-type (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
69 `(nth 1 ,handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
70 (defsubst mm-handle-media-type (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
71 (if (stringp (car handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72 (car handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
73 (car (mm-handle-type handle))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
74 (defsubst mm-handle-media-supertype (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
75 (car (split-string (mm-handle-media-type handle) "/")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
76 (defsubst mm-handle-media-subtype (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
77 (cadr (split-string (mm-handle-media-type handle) "/")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
78 (defmacro mm-handle-encoding (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
79 `(nth 2 ,handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
80 (defmacro mm-handle-undisplayer (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81 `(nth 3 ,handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
82 (defmacro mm-handle-set-undisplayer (handle function)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83 `(setcar (nthcdr 3 ,handle) ,function))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84 (defmacro mm-handle-disposition (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
85 `(nth 4 ,handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
86 (defmacro mm-handle-description (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
87 `(nth 5 ,handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
88 (defmacro mm-handle-cache (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
89 `(nth 6 ,handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90 (defmacro mm-handle-set-cache (handle contents)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
91 `(setcar (nthcdr 6 ,handle) ,contents))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
92 (defmacro mm-handle-id (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
93 `(nth 7 ,handle))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
94 (defmacro mm-handle-multipart-original-buffer (handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
95 `(get-text-property 0 'buffer (car ,handle)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
96 (defmacro mm-handle-multipart-from (handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
97 `(get-text-property 0 'from (car ,handle)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
98 (defmacro mm-handle-multipart-ctl-parameter (handle parameter)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
99 `(get-text-property 0 ,parameter (car ,handle)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
100
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101 (defmacro mm-make-handle (&optional buffer type encoding undisplayer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
102 disposition description cache
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
103 id)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
104 `(list ,buffer ,type ,encoding ,undisplayer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
105 ,disposition ,description ,cache ,id))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
106
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
107 (defcustom mm-text-html-renderer
110708
4c31586ca1ca Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
108 (cond ((fboundp 'libxml-parse-html-region) 'mm-shr)
4c31586ca1ca Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
109 ((executable-find "w3m") 'gnus-article-html)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
110 ((executable-find "links") 'links)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
111 ((executable-find "lynx") 'lynx)
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92336
diff changeset
112 ((locate-library "w3") 'w3)
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92336
diff changeset
113 ((locate-library "html2text") 'html2text)
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92336
diff changeset
114 (t nil))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
115 "Render of HTML contents.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
116 It is one of defined renderer types, or a rendering function.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
117 The defined renderer types are:
110859
7aa4fdb60d57 shr.el (shr-insert): Don't insert double spaces.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110810
diff changeset
118 `mm-shr': use Gnus simple HTML renderer;
110410
f2e111723c3a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110369
diff changeset
119 `gnus-article-html' : use Gnus renderer based on w3m;
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
120 `w3m' : use emacs-w3m;
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
121 `w3m-standalone': use w3m;
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
122 `links': use links;
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
123 `lynx' : use lynx;
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92336
diff changeset
124 `w3' : use Emacs/W3;
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
125 `html2text' : use html2text;
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92336
diff changeset
126 nil : use external viewer (default web browser)."
110064
07b5be82cf7a Bump custom version of some user options of which the default values changed.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110025
diff changeset
127 :version "24.1"
110859
7aa4fdb60d57 shr.el (shr-insert): Don't insert double spaces.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110810
diff changeset
128 :type '(choice (const mm-shr)
7aa4fdb60d57 shr.el (shr-insert): Don't insert double spaces.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110810
diff changeset
129 (const gnus-article-html)
110410
f2e111723c3a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110369
diff changeset
130 (const w3)
f2e111723c3a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110369
diff changeset
131 (const w3m :tag "emacs-w3m")
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92336
diff changeset
132 (const w3m-standalone :tag "standalone w3m" )
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
133 (const links)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
134 (const lynx)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
135 (const html2text)
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92336
diff changeset
136 (const nil :tag "External viewer")
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
137 (function))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
138 :group 'mime-display)
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 mm-inline-text-html-renderer nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
141 "Function used for rendering inline HTML contents.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
142 It is suggested to customize `mm-text-html-renderer' instead.")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
143
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
144 (defcustom mm-inline-text-html-with-images nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
145 "If non-nil, Gnus will allow retrieving images in HTML contents with
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
146 the <img> tags. It has no effect on Emacs/w3. See also the
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
147 documentation for the `mm-w3m-safe-url-regexp' variable."
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59690
diff changeset
148 :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
149 :type 'boolean
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
150 :group 'mime-display)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
151
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
152 (defcustom mm-w3m-safe-url-regexp "\\`cid:"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
153 "Regexp matching URLs which are considered to be safe.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
154 Some HTML mails might contain a nasty trick used by spammers, using
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
155 the <img> tag which is far more evil than the [Click Here!] button.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
156 It is most likely intended to check whether the ominous spam mail has
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
157 reached your eyes or not, in which case the spammer knows for sure
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
158 that your email address is valid. It is done by embedding an
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
159 identifier string into a URL that you might automatically retrieve
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
160 when displaying the image. The default value is \"\\\\`cid:\" which only
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
161 matches parts embedded to the Multipart/Related type MIME contents and
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
162 Gnus will never connect to the spammer's site arbitrarily. You may
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
163 set this variable to nil if you consider all urls to be safe."
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59690
diff changeset
164 :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
165 :type '(choice (regexp :tag "Regexp")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
166 (const :tag "All URLs are safe" nil))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
167 :group 'mime-display)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
168
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
169 (defcustom mm-inline-text-html-with-w3m-keymap t
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
170 "If non-nil, use emacs-w3m command keys in the article buffer."
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59690
diff changeset
171 :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
172 :type 'boolean
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
173 :group 'mime-display)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
174
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
175 (defcustom mm-enable-external t
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
176 "Indicate whether external MIME handlers should be used.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
177
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
178 If t, all defined external MIME handlers are used. If nil, files are saved by
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
179 `mailcap-save-binary-file'. If it is the symbol `ask', you are prompted
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
180 before the external MIME handler is invoked."
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59690
diff changeset
181 :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
182 :type '(choice (const :tag "Always" t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
183 (const :tag "Never" nil)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
184 (const :tag "Ask" ask))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
185 :group 'mime-display)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
186
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
187 (defcustom mm-inline-media-tests
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
188 '(("image/p?jpeg"
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
189 mm-inline-image
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
190 (lambda (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
191 (mm-valid-and-fit-image-p 'jpeg handle)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
192 ("image/png"
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
193 mm-inline-image
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
194 (lambda (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
195 (mm-valid-and-fit-image-p 'png handle)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
196 ("image/gif"
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
197 mm-inline-image
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
198 (lambda (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
199 (mm-valid-and-fit-image-p 'gif handle)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
200 ("image/tiff"
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
201 mm-inline-image
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
202 (lambda (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
203 (mm-valid-and-fit-image-p 'tiff handle)) )
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
204 ("image/xbm"
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
205 mm-inline-image
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
206 (lambda (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
207 (mm-valid-and-fit-image-p 'xbm handle)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
208 ("image/x-xbitmap"
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
209 mm-inline-image
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
210 (lambda (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
211 (mm-valid-and-fit-image-p 'xbm handle)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
212 ("image/xpm"
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
213 mm-inline-image
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
214 (lambda (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
215 (mm-valid-and-fit-image-p 'xpm handle)))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
216 ("image/x-xpixmap"
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
217 mm-inline-image
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
218 (lambda (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
219 (mm-valid-and-fit-image-p 'xpm handle)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
220 ("image/bmp"
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
221 mm-inline-image
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
222 (lambda (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
223 (mm-valid-and-fit-image-p 'bmp handle)))
35048
0b4c50eb2002 (mm-inline-media-tests): Add
Dave Love <fx@gnu.org>
parents: 34833
diff changeset
224 ("image/x-portable-bitmap"
0b4c50eb2002 (mm-inline-media-tests): Add
Dave Love <fx@gnu.org>
parents: 34833
diff changeset
225 mm-inline-image
0b4c50eb2002 (mm-inline-media-tests): Add
Dave Love <fx@gnu.org>
parents: 34833
diff changeset
226 (lambda (handle)
0b4c50eb2002 (mm-inline-media-tests): Add
Dave Love <fx@gnu.org>
parents: 34833
diff changeset
227 (mm-valid-and-fit-image-p 'pbm handle)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
228 ("text/plain" mm-inline-text identity)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
229 ("text/enriched" mm-inline-text identity)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
230 ("text/richtext" mm-inline-text identity)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
231 ("text/x-patch" mm-display-patch-inline
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
232 (lambda (handle)
65767
1b9137e0ecc1 (mm-inline-media-tests): Check presence of the diff-mode
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65719
diff changeset
233 ;; If the diff-mode.el package is installed, the function is
1b9137e0ecc1 (mm-inline-media-tests): Check presence of the diff-mode
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65719
diff changeset
234 ;; autoloaded. Checking (locate-library "diff-mode") would be trying
1b9137e0ecc1 (mm-inline-media-tests): Check presence of the diff-mode
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65719
diff changeset
235 ;; to cater to broken installations. OTOH checking the function
1b9137e0ecc1 (mm-inline-media-tests): Check presence of the diff-mode
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65719
diff changeset
236 ;; makes it possible to install another package which provides an
1b9137e0ecc1 (mm-inline-media-tests): Check presence of the diff-mode
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65719
diff changeset
237 ;; alternative implementation of diff-mode. --Stef
1b9137e0ecc1 (mm-inline-media-tests): Check presence of the diff-mode
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65719
diff changeset
238 (fboundp 'diff-mode)))
93723
2da1f95ea11c (mm-inline-media-tests): Add entry for x-diff.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93107
diff changeset
239 ;; In case mime.types uses x-diff (as does Debian's mime-support-3.40).
2da1f95ea11c (mm-inline-media-tests): Add entry for x-diff.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93107
diff changeset
240 ("text/x-diff" mm-display-patch-inline
2da1f95ea11c (mm-inline-media-tests): Add entry for x-diff.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93107
diff changeset
241 (lambda (handle) (fboundp 'diff-mode)))
31764
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
242 ("application/emacs-lisp" mm-display-elisp-inline identity)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
243 ("application/x-emacs-lisp" mm-display-elisp-inline identity)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
244 ("text/dns" mm-display-dns-inline identity)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
245 ("text/html"
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
246 mm-inline-text-html
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
247 (lambda (handle)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
248 (or mm-inline-text-html-renderer
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
249 mm-text-html-renderer)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
250 ("text/x-vcard"
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
251 mm-inline-text-vcard
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
252 (lambda (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
253 (or (featurep 'vcard)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
254 (locate-library "vcard"))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
255 ("message/delivery-status" mm-inline-text identity)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
256 ("message/rfc822" mm-inline-message identity)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
257 ("message/partial" mm-inline-partial identity)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
258 ("message/external-body" mm-inline-external-body identity)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
259 ("text/.*" mm-inline-text identity)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
260 ("audio/wav" mm-inline-audio
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
261 (lambda (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
262 (and (or (featurep 'nas-sound) (featurep 'native-sound))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
263 (device-sound-enabled-p))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
264 ("audio/au"
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
265 mm-inline-audio
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
266 (lambda (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
267 (and (or (featurep 'nas-sound) (featurep 'native-sound))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
268 (device-sound-enabled-p))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
269 ("application/pgp-signature" ignore identity)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
270 ("application/x-pkcs7-signature" ignore identity)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
271 ("application/pkcs7-signature" ignore identity)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
272 ("application/x-pkcs7-mime" ignore identity)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
273 ("application/pkcs7-mime" ignore identity)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
274 ("multipart/alternative" ignore identity)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
275 ("multipart/mixed" ignore identity)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
276 ("multipart/related" ignore identity)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
277 ;; Disable audio and image
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
278 ("audio/.*" ignore ignore)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
279 ("image/.*" ignore ignore)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
280 ;; Default to displaying as text
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
281 (".*" mm-inline-text mm-readable-p))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
282 "Alist of media types/tests saying whether types can be displayed inline."
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
283 :type '(repeat (list (regexp :tag "MIME type")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
284 (function :tag "Display function")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
285 (function :tag "Display test")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
286 :group 'mime-display)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
287
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
288 (defcustom mm-inlined-types
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
289 '("image/.*" "text/.*" "message/delivery-status" "message/rfc822"
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
290 "message/partial" "message/external-body" "application/emacs-lisp"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
291 "application/x-emacs-lisp"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
292 "application/pgp-signature" "application/x-pkcs7-signature"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
293 "application/pkcs7-signature" "application/x-pkcs7-mime"
68287
dbc43cabc13b Revision: emacs@sv.gnu.org/emacs--devo--0--patch-5
Miles Bader <miles@gnu.org>
parents: 67643
diff changeset
294 "application/pkcs7-mime"
dbc43cabc13b Revision: emacs@sv.gnu.org/emacs--devo--0--patch-5
Miles Bader <miles@gnu.org>
parents: 67643
diff changeset
295 ;; Mutt still uses this even though it has already been withdrawn.
dbc43cabc13b Revision: emacs@sv.gnu.org/emacs--devo--0--patch-5
Miles Bader <miles@gnu.org>
parents: 67643
diff changeset
296 "application/pgp")
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
297 "List of media types that are to be displayed inline.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
298 See also `mm-inline-media-tests', which says how to display a media
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
299 type inline."
67643
1c477099d3ac Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-676
Miles Bader <miles@gnu.org>
parents: 67418
diff changeset
300 :type '(repeat regexp)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
301 :group 'mime-display)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
302
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
303 (defcustom mm-keep-viewer-alive-types
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
304 '("application/postscript" "application/msword" "application/vnd.ms-excel"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
305 "application/pdf" "application/x-dvi")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
306 "List of media types for which the external viewer will not be killed
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
307 when selecting a different article."
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59690
diff changeset
308 :version "22.1"
67643
1c477099d3ac Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-676
Miles Bader <miles@gnu.org>
parents: 67418
diff changeset
309 :type '(repeat regexp)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
310 :group 'mime-display)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44075
diff changeset
311
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
312 (defcustom mm-automatic-display
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
313 '("text/plain" "text/enriched" "text/richtext" "text/html" "text/x-verbatim"
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
314 "text/x-vcard" "image/.*" "message/delivery-status" "multipart/.*"
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
315 "message/rfc822" "text/x-patch" "text/dns" "application/pgp-signature"
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
316 "application/emacs-lisp" "application/x-emacs-lisp"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
317 "application/x-pkcs7-signature"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
318 "application/pkcs7-signature" "application/x-pkcs7-mime"
68287
dbc43cabc13b Revision: emacs@sv.gnu.org/emacs--devo--0--patch-5
Miles Bader <miles@gnu.org>
parents: 67643
diff changeset
319 "application/pkcs7-mime"
dbc43cabc13b Revision: emacs@sv.gnu.org/emacs--devo--0--patch-5
Miles Bader <miles@gnu.org>
parents: 67643
diff changeset
320 ;; Mutt still uses this even though it has already been withdrawn.
70245
322c5c5027dc Revision: emacs@sv.gnu.org/emacs--devo--0--patch-249
Miles Bader <miles@gnu.org>
parents: 69949
diff changeset
321 "application/pgp\\'")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
322 "A list of MIME types to be displayed automatically."
67643
1c477099d3ac Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-676
Miles Bader <miles@gnu.org>
parents: 67418
diff changeset
323 :type '(repeat regexp)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
324 :group 'mime-display)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
325
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
326 (defcustom mm-attachment-override-types '("text/x-vcard"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
327 "application/pkcs7-mime"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
328 "application/x-pkcs7-mime"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
329 "application/pkcs7-signature"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
330 "application/x-pkcs7-signature")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
331 "Types to have \"attachment\" ignored if they can be displayed inline."
67643
1c477099d3ac Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-676
Miles Bader <miles@gnu.org>
parents: 67418
diff changeset
332 :type '(repeat regexp)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
333 :group 'mime-display)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
334
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
335 (defcustom mm-inline-override-types nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
336 "Types to be treated as attachments even if they can be displayed inline."
67643
1c477099d3ac Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-676
Miles Bader <miles@gnu.org>
parents: 67418
diff changeset
337 :type '(repeat regexp)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
338 :group 'mime-display)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
339
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
340 (defcustom mm-automatic-external-display nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
341 "List of MIME type regexps that will be displayed externally automatically."
67643
1c477099d3ac Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-676
Miles Bader <miles@gnu.org>
parents: 67418
diff changeset
342 :type '(repeat regexp)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
343 :group 'mime-display)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
344
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
345 (defcustom mm-discouraged-alternatives nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
346 "List of MIME types that are discouraged when viewing multipart/alternative.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
347 Viewing agents are supposed to view the last possible part of a message,
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
348 as that is supposed to be the richest. However, users may prefer other
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
349 types instead, and this list says what types are most unwanted. If,
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
350 for instance, text/html parts are very unwanted, and text/richtext are
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
351 somewhat unwanted, then the value of this variable should be set
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
352 to:
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
353
67418
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
354 (\"text/html\" \"text/richtext\")
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
355
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
356 Adding \"image/.*\" might also be useful. Spammers use it as the
67643
1c477099d3ac Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-676
Miles Bader <miles@gnu.org>
parents: 67418
diff changeset
357 prefered part of multipart/alternative messages. See also
1c477099d3ac Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-676
Miles Bader <miles@gnu.org>
parents: 67418
diff changeset
358 `gnus-buttonized-mime-types', to which adding \"multipart/alternative\"
1c477099d3ac Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-676
Miles Bader <miles@gnu.org>
parents: 67418
diff changeset
359 enables you to choose manually one of two types those mails include."
67418
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
360 :type '(repeat regexp) ;; See `mm-preferred-alternative-precedence'.
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
361 :group 'mime-display)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
362
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
363 (defcustom mm-tmp-directory
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
364 (if (fboundp 'temp-directory)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
365 (temp-directory)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
366 (if (boundp 'temporary-file-directory)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
367 temporary-file-directory
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
368 "/tmp/"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
369 "Where mm will store its temporary files."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
370 :type 'directory
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
371 :group 'mime-display)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
372
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
373 (defcustom mm-inline-large-images nil
110747
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110708
diff changeset
374 "If t, then all images fit in the buffer.
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110708
diff changeset
375 If 'resize, try to resize the images so they fit."
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110708
diff changeset
376 :type '(radio
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110708
diff changeset
377 (const :tag "Inline large images as they are." t)
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110708
diff changeset
378 (const :tag "Resize large images." resize)
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110708
diff changeset
379 (const :tag "Do not inline large images." nil))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
380 :group 'mime-display)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
381
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
382 (defcustom mm-file-name-rewrite-functions
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
383 '(mm-file-name-delete-control mm-file-name-delete-gotchas)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
384 "List of functions used for rewriting file names of MIME parts.
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
385 Each function takes a file name as input and returns a file name.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
386
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
387 Ready-made functions include `mm-file-name-delete-control',
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
388 `mm-file-name-delete-gotchas' (you should not remove these two
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
389 functions), `mm-file-name-delete-whitespace',
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
390 `mm-file-name-trim-whitespace', `mm-file-name-collapse-whitespace',
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
391 `mm-file-name-replace-whitespace', `capitalize', `downcase',
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
392 `upcase', and `upcase-initials'."
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
393 :type '(list (set :inline t
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
394 (const mm-file-name-delete-control)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
395 (const mm-file-name-delete-gotchas)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
396 (const mm-file-name-delete-whitespace)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
397 (const mm-file-name-trim-whitespace)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
398 (const mm-file-name-collapse-whitespace)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
399 (const mm-file-name-replace-whitespace)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
400 (const capitalize)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
401 (const downcase)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
402 (const upcase)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
403 (const upcase-initials)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
404 (repeat :inline t
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
405 :tag "Function"
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
406 function)))
92336
5f827896103e Change defcustom :version from 23.0 to 23.1.
Glenn Morris <rgm@gnu.org>
parents: 87928
diff changeset
407 :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: 78224
diff changeset
408 :group 'mime-display)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
409
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
410
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
411 (defvar mm-path-name-rewrite-functions nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
412 "*List of functions for rewriting the full file names of MIME parts.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
413 This is used when viewing parts externally, and is meant for
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
414 transforming the absolute name so that non-compliant programs can find
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
415 the file where it's saved.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
416
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
417 Each function takes a file name as input and returns a file name.")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
418
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
419 (defvar mm-file-name-replace-whitespace nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
420 "String used for replacing whitespace characters; default is `\"_\"'.")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
421
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
422 (defcustom mm-default-directory nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
423 "The default directory where mm will save files.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
424 If not set, `default-directory' will be used."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
425 :type '(choice directory (const :tag "Default" nil))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
426 :group 'mime-display)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
427
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
428 (defcustom mm-attachment-file-modes 384
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
429 "Set the mode bits of saved attachments to this integer."
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59690
diff changeset
430 :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
431 :type 'integer
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
432 :group 'mime-display)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
433
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
434 (defcustom mm-external-terminal-program "xterm"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
435 "The program to start an external terminal."
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59690
diff changeset
436 :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
437 :type 'string
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
438 :group 'mime-display)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
439
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
440 ;;; Internal variables.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
441
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
442 (defvar mm-last-shell-command "")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
443 (defvar mm-content-id-alist nil)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
444 (defvar mm-postponed-undisplay-list nil)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
445
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
446 ;; According to RFC2046, in particular, in a digest, the default
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
447 ;; Content-Type value for a body part is changed from "text/plain" to
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
448 ;; "message/rfc822".
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
449 (defvar mm-dissect-default-type "text/plain")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
450
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
451 (autoload 'mml2015-verify "mml2015")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
452 (autoload 'mml2015-verify-test "mml2015")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
453 (autoload 'mml-smime-verify "mml-smime")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
454 (autoload 'mml-smime-verify-test "mml-smime")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
455
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
456 (defvar mm-verify-function-alist
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
457 '(("application/pgp-signature" mml2015-verify "PGP" mml2015-verify-test)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
458 ("application/x-gnus-pgp-signature" mm-uu-pgp-signed-extract-1 "PGP"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
459 mm-uu-pgp-signed-test)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
460 ("application/pkcs7-signature" mml-smime-verify "S/MIME"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
461 mml-smime-verify-test)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
462 ("application/x-pkcs7-signature" mml-smime-verify "S/MIME"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
463 mml-smime-verify-test)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
464
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
465 (defcustom mm-verify-option 'never
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
466 "Option of verifying signed parts.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
467 `never', not verify; `always', always verify;
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
468 `known', only verify known protocols. Otherwise, ask user.
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
469
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
470 When set to `always' or `known', you should add
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
471 \"multipart/signed\" to `gnus-buttonized-mime-types' to see
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
472 result of the verification."
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59690
diff changeset
473 :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
474 :type '(choice (item always)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
475 (item never)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
476 (item :tag "only known protocols" known)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
477 (item :tag "ask" nil))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
478 :group 'mime-security)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
479
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
480 (autoload 'mml2015-decrypt "mml2015")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
481 (autoload 'mml2015-decrypt-test "mml2015")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
482
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
483 (defvar mm-decrypt-function-alist
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
484 '(("application/pgp-encrypted" mml2015-decrypt "PGP" mml2015-decrypt-test)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
485 ("application/x-gnus-pgp-encrypted" mm-uu-pgp-encrypted-extract-1 "PGP"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
486 mm-uu-pgp-encrypted-test)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
487
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
488 (defcustom mm-decrypt-option nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
489 "Option of decrypting encrypted parts.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
490 `never', not decrypt; `always', always decrypt;
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
491 `known', only decrypt known protocols. Otherwise, ask user."
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59690
diff changeset
492 :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
493 :type '(choice (item always)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
494 (item never)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
495 (item :tag "only known protocols" known)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
496 (item :tag "ask" nil))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
497 :group 'mime-security)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
498
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
499 (defvar mm-viewer-completion-map
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
500 (let ((map (make-sparse-keymap 'mm-viewer-completion-map)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
501 (set-keymap-parent map minibuffer-local-completion-map)
65767
1b9137e0ecc1 (mm-inline-media-tests): Check presence of the diff-mode
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65719
diff changeset
502 ;; Should we bind other key to minibuffer-complete-word?
1b9137e0ecc1 (mm-inline-media-tests): Check presence of the diff-mode
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65719
diff changeset
503 (define-key map " " 'self-insert-command)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
504 map)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
505 "Keymap for input viewer with completion.")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
506
32962
496ce24f9ddc 2000-10-27 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 31782
diff changeset
507 (defvar mm-viewer-completion-map
496ce24f9ddc 2000-10-27 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 31782
diff changeset
508 (let ((map (make-sparse-keymap 'mm-viewer-completion-map)))
496ce24f9ddc 2000-10-27 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 31782
diff changeset
509 (set-keymap-parent map minibuffer-local-completion-map)
65767
1b9137e0ecc1 (mm-inline-media-tests): Check presence of the diff-mode
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65719
diff changeset
510 ;; Should we bind other key to minibuffer-complete-word?
1b9137e0ecc1 (mm-inline-media-tests): Check presence of the diff-mode
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65719
diff changeset
511 (define-key map " " 'self-insert-command)
32962
496ce24f9ddc 2000-10-27 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 31782
diff changeset
512 map)
496ce24f9ddc 2000-10-27 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 31782
diff changeset
513 "Keymap for input viewer with completion.")
496ce24f9ddc 2000-10-27 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 31782
diff changeset
514
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
515 ;;; The functions.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
516
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
517 (defun mm-alist-to-plist (alist)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
518 "Convert association list ALIST into the equivalent property-list form.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
519 The plist is returned. This converts from
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
520
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
521 \((a . 1) (b . 2) (c . 3))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
522
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
523 into
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
524
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
525 \(a 1 b 2 c 3)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
526
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
527 The original alist is not modified. See also `destructive-alist-to-plist'."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
528 (let (plist)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
529 (while alist
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
530 (let ((el (car alist)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
531 (setq plist (cons (cdr el) (cons (car el) plist))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
532 (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
533 (nreverse plist)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
534
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
535 (defun mm-keep-viewer-alive-p (handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
536 "Say whether external viewer for HANDLE should stay alive."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
537 (let ((types mm-keep-viewer-alive-types)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
538 (type (mm-handle-media-type handle))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
539 ty)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
540 (catch 'found
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
541 (while (setq ty (pop types))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
542 (when (string-match ty type)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
543 (throw 'found t))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
544
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
545 (defun mm-handle-set-external-undisplayer (handle function)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
546 "Set the undisplayer for HANDLE to FUNCTION.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
547 Postpone undisplaying of viewers for types in
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
548 `mm-keep-viewer-alive-types'."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
549 (if (mm-keep-viewer-alive-p handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
550 (let ((new-handle (copy-sequence handle)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
551 (mm-handle-set-undisplayer new-handle function)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
552 (mm-handle-set-undisplayer handle nil)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
553 (push new-handle mm-postponed-undisplay-list))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
554 (mm-handle-set-undisplayer handle function)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
555
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
556 (defun mm-destroy-postponed-undisplay-list ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
557 (when mm-postponed-undisplay-list
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
558 (message "Destroying external MIME viewers")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
559 (mm-destroy-parts mm-postponed-undisplay-list)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
560
107427
ecbe0edc4f69 Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
561 (autoload 'message-fetch-field "message")
ecbe0edc4f69 Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
562
60302
f34a552e4a9f Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-139
Miles Bader <miles@gnu.org>
parents: 59996
diff changeset
563 (defun mm-dissect-buffer (&optional no-strict-mime loose-mime from)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
564 "Dissect the current buffer and return a list of MIME handles."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
565 (save-excursion
60302
f34a552e4a9f Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-139
Miles Bader <miles@gnu.org>
parents: 59996
diff changeset
566 (let (ct ctl type subtype cte cd description id result)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
567 (save-restriction
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
568 (mail-narrow-to-head)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
569 (when (or no-strict-mime
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
570 loose-mime
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
571 (mail-fetch-field "mime-version"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
572 (setq ct (mail-fetch-field "content-type")
68720
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68287
diff changeset
573 ctl (and ct (mail-header-parse-content-type ct))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
574 cte (mail-fetch-field "content-transfer-encoding")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
575 cd (mail-fetch-field "content-disposition")
103570
21ddc18f8c1b (mm-dissect-buffer): Use message-fetch-field instead of mail-fetch-field to
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100908
diff changeset
576 ;; Newlines in description should be stripped so as
21ddc18f8c1b (mm-dissect-buffer): Use message-fetch-field instead of mail-fetch-field to
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100908
diff changeset
577 ;; not to break the MIME tag into two or more lines.
21ddc18f8c1b (mm-dissect-buffer): Use message-fetch-field instead of mail-fetch-field to
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100908
diff changeset
578 description (message-fetch-field "content-description")
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
579 id (mail-fetch-field "content-id"))
60302
f34a552e4a9f Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-139
Miles Bader <miles@gnu.org>
parents: 59996
diff changeset
580 (unless from
68720
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68287
diff changeset
581 (setq from (mail-fetch-field "from")))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
582 ;; FIXME: In some circumstances, this code is running within
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
583 ;; an unibyte macro. mail-extract-address-components
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
584 ;; creates unibyte buffers. This `if', though not a perfect
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
585 ;; solution, avoids most of them.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
586 (if from
87928
a5b33bf9597c Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
587 (setq from (cadr (mail-extract-address-components from))))
a5b33bf9597c Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
588 (if description
a5b33bf9597c Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
589 (setq description (mail-decode-encoded-word-string
a5b33bf9597c Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
590 description)))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
591 (if (or (not ctl)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
592 (not (string-match "/" (car ctl))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
593 (mm-dissect-singlepart
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
594 (list mm-dissect-default-type)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
595 (and cte (intern (downcase (mail-header-strip cte))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
596 no-strict-mime
68720
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68287
diff changeset
597 (and cd (mail-header-parse-content-disposition cd))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
598 description)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
599 (setq type (split-string (car ctl) "/"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
600 (setq subtype (cadr type)
70377
1b78f3a87f16 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-265
Miles Bader <miles@gnu.org>
parents: 70245
diff changeset
601 type (car type))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
602 (setq
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
603 result
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
604 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
605 ((equal type "multipart")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
606 (let ((mm-dissect-default-type (if (equal subtype "digest")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
607 "message/rfc822"
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
608 "text/plain"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
609 (start (cdr (assq 'start (cdr ctl)))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
610 (add-text-properties 0 (length (car ctl))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
611 (mm-alist-to-plist (cdr ctl)) (car ctl))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
612
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
613 ;; what really needs to be done here is a way to link a
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
614 ;; MIME handle back to it's parent MIME handle (in a multilevel
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
615 ;; MIME article). That would probably require changing
65767
1b9137e0ecc1 (mm-inline-media-tests): Check presence of the diff-mode
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65719
diff changeset
616 ;; the mm-handle API so we simply store the multipart buffer
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
617 ;; name as a text property of the "multipart/whatever" string.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
618 (add-text-properties 0 (length (car ctl))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
619 (list 'buffer (mm-copy-to-buffer)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
620 'from from
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
621 'start start)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
622 (car ctl))
60302
f34a552e4a9f Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-139
Miles Bader <miles@gnu.org>
parents: 59996
diff changeset
623 (cons (car ctl) (mm-dissect-multipart ctl from))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
624 (t
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
625 (mm-possibly-verify-or-decrypt
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
626 (mm-dissect-singlepart
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
627 ctl
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
628 (and cte (intern (downcase (mail-header-strip cte))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
629 no-strict-mime
68720
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68287
diff changeset
630 (and cd (mail-header-parse-content-disposition cd))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
631 description id)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
632 ctl))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
633 (when id
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
634 (when (string-match " *<\\(.*\\)> *" id)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
635 (setq id (match-string 1 id)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
636 (push (cons id result) mm-content-id-alist))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
637 result))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
638
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
639 (defun mm-dissect-singlepart (ctl cte &optional force cdl description id)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
640 (when (or force
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
641 (if (equal "text/plain" (car ctl))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
642 (assoc 'format ctl)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
643 t))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
644 (mm-make-handle
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
645 (mm-copy-to-buffer) ctl cte nil cdl description nil id)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
646
60302
f34a552e4a9f Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-139
Miles Bader <miles@gnu.org>
parents: 59996
diff changeset
647 (defun mm-dissect-multipart (ctl from)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
648 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
649 (let* ((boundary (concat "\n--" (mail-content-type-get ctl 'boundary)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
650 (close-delimiter (concat (regexp-quote boundary) "--[ \t]*$"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
651 start parts
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
652 (end (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
653 (goto-char (point-max))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
654 (if (re-search-backward close-delimiter nil t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
655 (match-beginning 0)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
656 (point-max)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
657 (setq boundary (concat (regexp-quote boundary) "[ \t]*$"))
34833
aaf69bc74739 * gnus-art.el (gnus-article-check-hidden-text): Return t.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33342
diff changeset
658 (while (and (< (point) end) (re-search-forward boundary end t))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
659 (goto-char (match-beginning 0))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
660 (when start
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
661 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
662 (save-restriction
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
663 (narrow-to-region start (point))
60302
f34a552e4a9f Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-139
Miles Bader <miles@gnu.org>
parents: 59996
diff changeset
664 (setq parts (nconc (list (mm-dissect-buffer t nil from)) parts)))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
665 (end-of-line 2)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
666 (or (looking-at boundary)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
667 (forward-line 1))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
668 (setq start (point)))
34833
aaf69bc74739 * gnus-art.el (gnus-article-check-hidden-text): Return t.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33342
diff changeset
669 (when (and start (< start end))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
670 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
671 (save-restriction
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
672 (narrow-to-region start end)
60302
f34a552e4a9f Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-139
Miles Bader <miles@gnu.org>
parents: 59996
diff changeset
673 (setq parts (nconc (list (mm-dissect-buffer t nil from)) parts)))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
674 (mm-possibly-verify-or-decrypt (nreverse parts) ctl)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
675
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
676 (defun mm-copy-to-buffer ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
677 "Copy the contents of the current buffer to a fresh buffer."
92769
734bb318f69e (mm-with-part): Set the buffer to unibyte before inserting
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
678 (let ((obuf (current-buffer))
93107
3bf6293f3041 (mm-copy-to-buffer): Use mm-set-buffer-multibyte.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92769
diff changeset
679 (mb (mm-multibyte-p))
92769
734bb318f69e (mm-with-part): Set the buffer to unibyte before inserting
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
680 beg)
734bb318f69e (mm-with-part): Set the buffer to unibyte before inserting
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
681 (goto-char (point-min))
734bb318f69e (mm-with-part): Set the buffer to unibyte before inserting
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
682 (search-forward-regexp "^\n" nil t)
734bb318f69e (mm-with-part): Set the buffer to unibyte before inserting
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
683 (setq beg (point))
70377
1b78f3a87f16 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-265
Miles Bader <miles@gnu.org>
parents: 70245
diff changeset
684 (with-current-buffer
93107
3bf6293f3041 (mm-copy-to-buffer): Use mm-set-buffer-multibyte.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92769
diff changeset
685 (generate-new-buffer " *mm*")
3bf6293f3041 (mm-copy-to-buffer): Use mm-set-buffer-multibyte.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92769
diff changeset
686 ;; Preserve the data's unibyteness (for url-insert-file-contents).
3bf6293f3041 (mm-copy-to-buffer): Use mm-set-buffer-multibyte.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92769
diff changeset
687 (mm-set-buffer-multibyte mb)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
688 (insert-buffer-substring obuf beg)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
689 (current-buffer))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
690
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
691 (defun mm-display-parts (handle &optional no-default)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
692 (if (stringp (car handle))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
693 (mapcar 'mm-display-parts (cdr handle))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
694 (if (bufferp (car handle))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
695 (save-restriction
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
696 (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
697 (mm-display-part handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
698 (goto-char (point-max)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
699 (mapcar 'mm-display-parts handle))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
700
107427
ecbe0edc4f69 Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
701 (autoload 'mailcap-parse-mailcaps "mailcap")
ecbe0edc4f69 Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
702 (autoload 'mailcap-mime-info "mailcap")
ecbe0edc4f69 Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
703
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
704 (defun mm-display-part (handle &optional no-default)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
705 "Display the MIME part represented by HANDLE.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
706 Returns nil if the part is removed; inline if displayed inline;
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
707 external if displayed external."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
708 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
709 (mailcap-parse-mailcaps)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
710 (if (mm-handle-displayed-p handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
711 (mm-remove-part handle)
69949
d0312c3f2374 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-214
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
712 (let* ((ehandle (if (equal (mm-handle-media-type handle)
d0312c3f2374 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-214
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
713 "message/external-body")
d0312c3f2374 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-214
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
714 (progn
d0312c3f2374 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-214
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
715 (unless (mm-handle-cache handle)
d0312c3f2374 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-214
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
716 (mm-extern-cache-contents handle))
d0312c3f2374 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-214
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
717 (mm-handle-cache handle))
d0312c3f2374 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-214
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
718 handle))
d0312c3f2374 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-214
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
719 (type (mm-handle-media-type ehandle))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
720 (method (mailcap-mime-info type))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
721 (filename (or (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
722 (mm-handle-disposition handle) 'filename)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
723 (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
724 (mm-handle-type handle) 'name)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
725 "<file>"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
726 (external mm-enable-external))
69949
d0312c3f2374 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-214
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
727 (if (and (mm-inlinable-p ehandle)
d0312c3f2374 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-214
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
728 (mm-inlined-p ehandle))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
729 (progn
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
730 (forward-line 1)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
731 (mm-display-inline handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
732 'inline)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
733 (when (or method
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
734 (not no-default))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
735 (if (and (not method)
69949
d0312c3f2374 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-214
Miles Bader <miles@gnu.org>
parents: 69649
diff changeset
736 (equal "text" (car (split-string type "/"))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
737 (progn
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
738 (forward-line 1)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
739 (mm-insert-inline handle (mm-get-part handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
740 'inline)
70377
1b78f3a87f16 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-265
Miles Bader <miles@gnu.org>
parents: 70245
diff changeset
741 (setq external
1b78f3a87f16 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-265
Miles Bader <miles@gnu.org>
parents: 70245
diff changeset
742 (and method ;; If nil, we always use "save".
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
743 (stringp method) ;; 'mailcap-save-binary-file
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
744 (or (eq mm-enable-external t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
745 (and (eq mm-enable-external 'ask)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
746 (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
747 (concat
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
748 "Display part (" type
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
749 ") using external program"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
750 ;; Can non-string method ever happen?
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
751 (if (stringp method)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
752 (concat
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
753 " \"" (format method filename) "\"")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
754 "")
70377
1b78f3a87f16 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-265
Miles Bader <miles@gnu.org>
parents: 70245
diff changeset
755 "? "))))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
756 (if external
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
757 (mm-display-external
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
758 handle (or method 'mailcap-save-binary-file))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
759 (mm-display-external
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
760 handle 'mailcap-save-binary-file)))))))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
761
87243
23ea76295829 Add declare-function compatibility definition.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
762 (declare-function gnus-configure-windows "gnus-win" (setting &optional force))
107427
ecbe0edc4f69 Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
763 (defvar mailcap-mime-extensions) ; mailcap-mime-info autoloads
87243
23ea76295829 Add declare-function compatibility definition.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
764
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
765 (defun mm-display-external (handle method)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
766 "Display HANDLE using METHOD."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
767 (let ((outbuf (current-buffer)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
768 (mm-with-unibyte-buffer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
769 (if (functionp method)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
770 (let ((cur (current-buffer)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
771 (if (eq method 'mailcap-save-binary-file)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
772 (progn
33174
702845b072b7 (mm-display-external): Space prefix temp buffer
Dave Love <fx@gnu.org>
parents: 32962
diff changeset
773 (set-buffer (generate-new-buffer " *mm*"))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
774 (setq method nil))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
775 (mm-insert-part handle)
87454
0cbc451989a7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87300
diff changeset
776 (mm-add-meta-html-tag handle)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
777 (let ((win (get-buffer-window cur t)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
778 (when win
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
779 (select-window win)))
33174
702845b072b7 (mm-display-external): Space prefix temp buffer
Dave Love <fx@gnu.org>
parents: 32962
diff changeset
780 (switch-to-buffer (generate-new-buffer " *mm*")))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
781 (buffer-disable-undo)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
782 (mm-set-buffer-file-coding-system mm-binary-coding-system)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
783 (insert-buffer-substring cur)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
784 (goto-char (point-min))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
785 (when method
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
786 (message "Viewing with %s" method))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
787 (let ((mm (current-buffer))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
788 (non-viewer (assq 'non-viewer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
789 (mailcap-mime-info
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
790 (mm-handle-media-type handle) t))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
791 (unwind-protect
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
792 (if method
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
793 (funcall method)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
794 (mm-save-part handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
795 (when (and (not non-viewer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
796 method)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
797 (mm-handle-set-undisplayer handle mm)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
798 ;; The function is a string to be executed.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
799 (mm-insert-part handle)
87454
0cbc451989a7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87300
diff changeset
800 (mm-add-meta-html-tag handle)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
801 (let* ((dir (mm-make-temp-file
44075
7782e54757bb * mail-source.el (make-source-make-complex-temp-name): Use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 38413
diff changeset
802 (expand-file-name "emm." mm-tmp-directory) 'dir))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
803 (filename (or
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
804 (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
805 (mm-handle-disposition handle) 'filename)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
806 (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
807 (mm-handle-type handle) 'name)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
808 (mime-info (mailcap-mime-info
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
809 (mm-handle-media-type handle) t))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
810 (needsterm (or (assoc "needsterm" mime-info)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
811 (assoc "needsterminal" mime-info)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
812 (copiousoutput (assoc "copiousoutput" mime-info))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
813 file buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
814 ;; We create a private sub-directory where we store our files.
94209
0ffd6dd0f75d Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 93723
diff changeset
815 (set-file-modes dir #o700)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
816 (if filename
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
817 (setq file (expand-file-name
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
818 (gnus-map-function mm-file-name-rewrite-functions
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
819 (file-name-nondirectory filename))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
820 dir))
68940
808f636eb13e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents: 68720
diff changeset
821 ;; Use nametemplate (defined in RFC1524) if it is specified
808f636eb13e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents: 68720
diff changeset
822 ;; in mailcap.
808f636eb13e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents: 68720
diff changeset
823 (let ((suffix (cdr (assoc "nametemplate" mime-info))))
808f636eb13e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents: 68720
diff changeset
824 (if (and suffix
808f636eb13e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents: 68720
diff changeset
825 (string-match "\\`%s\\(\\..+\\)\\'" suffix))
808f636eb13e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents: 68720
diff changeset
826 (setq suffix (match-string 1 suffix))
808f636eb13e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents: 68720
diff changeset
827 ;; Otherwise, use a suffix according to
808f636eb13e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents: 68720
diff changeset
828 ;; `mailcap-mime-extensions'.
808f636eb13e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents: 68720
diff changeset
829 (setq suffix (car (rassoc (mm-handle-media-type handle)
808f636eb13e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents: 68720
diff changeset
830 mailcap-mime-extensions))))
808f636eb13e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents: 68720
diff changeset
831 (setq file (mm-make-temp-file (expand-file-name "mm." dir)
808f636eb13e Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents: 68720
diff changeset
832 nil suffix))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
833 (let ((coding-system-for-write mm-binary-coding-system))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
834 (write-region (point-min) (point-max) file nil 'nomesg))
94209
0ffd6dd0f75d Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 93723
diff changeset
835 ;; The file is deleted after the viewer exists. If the users edits
0ffd6dd0f75d Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 93723
diff changeset
836 ;; the file, changes will be lost. Set file to read-only to make it
0ffd6dd0f75d Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 93723
diff changeset
837 ;; clear.
0ffd6dd0f75d Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 93723
diff changeset
838 (set-file-modes file #o400)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
839 (message "Viewing with %s" method)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
840 (cond
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
841 (needsterm
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
842 (let ((command (mm-mailcap-command
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
843 method file (mm-handle-type handle))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
844 (unwind-protect
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
845 (if window-system
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
846 (start-process "*display*" nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
847 mm-external-terminal-program
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
848 "-e" shell-file-name
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
849 shell-command-switch command)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
850 (require 'term)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
851 (require 'gnus-win)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
852 (set-buffer
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
853 (setq buffer
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
854 (make-term "display"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
855 shell-file-name
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
856 nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
857 shell-command-switch command)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
858 (term-mode)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
859 (term-char-mode)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
860 (set-process-sentinel
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
861 (get-buffer-process buffer)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
862 `(lambda (process state)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
863 (if (eq 'exit (process-status process))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
864 (gnus-configure-windows
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
865 ',gnus-current-window-configuration))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
866 (gnus-configure-windows 'display-term))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
867 (mm-handle-set-external-undisplayer handle (cons file buffer)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
868 (message "Displaying %s..." command))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
869 'external)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
870 (copiousoutput
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
871 (with-current-buffer outbuf
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
872 (forward-line 1)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
873 (mm-insert-inline
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
874 handle
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
875 (unwind-protect
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
876 (progn
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
877 (call-process shell-file-name nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
878 (setq buffer
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
879 (generate-new-buffer " *mm*"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
880 nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
881 shell-command-switch
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
882 (mm-mailcap-command
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
883 method file (mm-handle-type handle)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
884 (if (buffer-live-p buffer)
65767
1b9137e0ecc1 (mm-inline-media-tests): Check presence of the diff-mode
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65719
diff changeset
885 (with-current-buffer buffer
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
886 (buffer-string))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
887 (progn
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
888 (ignore-errors (delete-file file))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
889 (ignore-errors (delete-directory
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
890 (file-name-directory file)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
891 (ignore-errors (kill-buffer buffer))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
892 'inline)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
893 (t
67418
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
894 ;; Deleting the temp file should be postponed for some wrappers,
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
895 ;; shell scripts, and so on, which might exit right after having
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
896 ;; started a viewer command as a background job.
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
897 (let ((command (mm-mailcap-command
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
898 method file (mm-handle-type handle))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
899 (unwind-protect
64693
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64085
diff changeset
900 (progn
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64085
diff changeset
901 (start-process "*display*"
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64085
diff changeset
902 (setq buffer
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64085
diff changeset
903 (generate-new-buffer " *mm*"))
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64085
diff changeset
904 shell-file-name
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64085
diff changeset
905 shell-command-switch command)
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64085
diff changeset
906 (set-process-sentinel
6bf3cc5c6ab3 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505
Miles Bader <miles@gnu.org>
parents: 64085
diff changeset
907 (get-buffer-process buffer)
67418
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
908 (lexical-let ;; Don't use `let'.
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
909 ;; Function used to remove temp file and directory.
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
910 ((fn `(lambda nil
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
911 ;; Don't use `ignore-errors'.
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
912 (condition-case nil
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
913 (delete-file ,file)
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
914 (error))
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
915 (condition-case nil
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
916 (delete-directory
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
917 ,(file-name-directory file))
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
918 (error))))
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
919 ;; Form uses to kill the process buffer and
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
920 ;; remove the undisplayer.
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
921 (fm `(progn
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
922 (kill-buffer ,buffer)
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
923 ,(macroexpand
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
924 (list 'mm-handle-set-undisplayer
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
925 (list 'quote handle)
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
926 nil))))
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
927 ;; Message to be issued when the process exits.
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
928 (done (format "Displaying %s...done" command))
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
929 ;; In particular, the timer object (which is
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
930 ;; a vector in Emacs but is a list in XEmacs)
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
931 ;; requires that it is lexically scoped.
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65767
diff changeset
932 (timer (run-at-time 2.0 nil 'ignore)))
86154
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
933 (if (featurep 'xemacs)
75149
0fd7f29f20d1 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 74021
diff changeset
934 (lambda (process state)
0fd7f29f20d1 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 74021
diff changeset
935 (when (eq 'exit (process-status process))
0fd7f29f20d1 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 74021
diff changeset
936 (if (memq timer itimer-list)
0fd7f29f20d1 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 74021
diff changeset
937 (set-itimer-function timer fn)
0fd7f29f20d1 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 74021
diff changeset
938 (funcall fn))
0fd7f29f20d1 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 74021
diff changeset
939 (ignore-errors (eval fm))
0fd7f29f20d1 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 74021
diff changeset
940 (message "%s" done)))
0fd7f29f20d1 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 74021
diff changeset
941 (lambda (process state)
0fd7f29f20d1 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 74021
diff changeset
942 (when (eq 'exit (process-status process))
0fd7f29f20d1 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 74021
diff changeset
943 (if (memq timer timer-list)
0fd7f29f20d1 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 74021
diff changeset
944 (timer-set-function timer fn)
0fd7f29f20d1 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 74021
diff changeset
945 (funcall fn))
0fd7f29f20d1 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 74021
diff changeset
946 (ignore-errors (eval fm))
0fd7f29f20d1 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 74021
diff changeset
947 (message "%s" done)))))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
948 (mm-handle-set-external-undisplayer
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
949 handle (cons file buffer)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
950 (message "Displaying %s..." command))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
951 'external)))))))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44075
diff changeset
952
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
953 (defun mm-mailcap-command (method file type-list)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
954 (let ((ctl (cdr type-list))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
955 (beg 0)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
956 (uses-stdin t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
957 out sub total)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
958 (while (string-match "%{\\([^}]+\\)}\\|'%s'\\|\"%s\"\\|%s\\|%t\\|%%"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
959 method beg)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
960 (push (substring method beg (match-beginning 0)) out)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
961 (setq beg (match-end 0)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
962 total (match-string 0 method)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
963 sub (match-string 1 method))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
964 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
965 ((string= total "%%")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
966 (push "%" out))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
967 ((or (string= total "%s")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
968 ;; We do our own quoting.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
969 (string= total "'%s'")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
970 (string= total "\"%s\""))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
971 (setq uses-stdin nil)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
972 (push (shell-quote-argument
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
973 (gnus-map-function mm-path-name-rewrite-functions file)) out))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
974 ((string= total "%t")
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
975 (push (shell-quote-argument (car type-list)) out))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
976 (t
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
977 (push (shell-quote-argument (or (cdr (assq (intern sub) ctl)) "")) out))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
978 (push (substring method beg (length method)) out)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
979 (when uses-stdin
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
980 (push "<" out)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
981 (push (shell-quote-argument
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
982 (gnus-map-function mm-path-name-rewrite-functions file))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
983 out))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
984 (mapconcat 'identity (nreverse out) "")))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44075
diff changeset
985
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
986 (defun mm-remove-parts (handles)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
987 "Remove the displayed MIME parts represented by HANDLES."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
988 (if (and (listp handles)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
989 (bufferp (car handles)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
990 (mm-remove-part handles)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
991 (let (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
992 (while (setq handle (pop handles))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
993 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
994 ((stringp handle)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
995 (when (buffer-live-p (get-text-property 0 'buffer handle))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
996 (kill-buffer (get-text-property 0 'buffer handle))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
997 ((and (listp handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
998 (stringp (car handle)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
999 (mm-remove-parts (cdr handle)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1000 (t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1001 (mm-remove-part handle)))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1002
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1003 (defun mm-destroy-parts (handles)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1004 "Remove the displayed MIME parts represented by HANDLES."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1005 (if (and (listp handles)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1006 (bufferp (car handles)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1007 (mm-destroy-part handles)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1008 (let (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1009 (while (setq handle (pop handles))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1010 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1011 ((stringp handle)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1012 (when (buffer-live-p (get-text-property 0 'buffer handle))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1013 (kill-buffer (get-text-property 0 'buffer handle))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1014 ((and (listp handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1015 (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
1016 (mm-destroy-parts handle))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1017 (t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1018 (mm-destroy-part handle)))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1019
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1020 (defun mm-remove-part (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1021 "Remove the displayed MIME part represented by HANDLE."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1022 (when (listp handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1023 (let ((object (mm-handle-undisplayer handle)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1024 (ignore-errors
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1025 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1026 ;; Internally displayed part.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1027 ((mm-annotationp object)
87243
23ea76295829 Add declare-function compatibility definition.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
1028 (if (featurep 'xemacs)
23ea76295829 Add declare-function compatibility definition.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
1029 (delete-annotation object)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1030 ((or (functionp object)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1031 (and (listp object)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1032 (eq (car object) 'lambda)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1033 (funcall object))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1034 ;; Externally displayed part.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1035 ((consp object)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1036 (condition-case ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1037 (while (get-buffer-process (cdr object))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1038 (interrupt-process (get-buffer-process (cdr object)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1039 (message "Waiting for external displayer to die...")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1040 (sit-for 1))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1041 (quit)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1042 (error))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1043 (ignore-errors (and (cdr object) (kill-buffer (cdr object))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1044 (message "Waiting for external displayer to die...done")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1045 (ignore-errors (delete-file (car object)))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1046 (ignore-errors (delete-directory (file-name-directory
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1047 (car object)))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1048 ((bufferp object)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1049 (when (buffer-live-p object)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1050 (kill-buffer object)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1051 (mm-handle-set-undisplayer handle nil))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1052
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1053 (defun mm-display-inline (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1054 (let* ((type (mm-handle-media-type handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1055 (function (cadr (mm-assoc-string-match mm-inline-media-tests type))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1056 (funcall function handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1057 (goto-char (point-min))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1058
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1059 (defun mm-assoc-string-match (alist type)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1060 (dolist (elem alist)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1061 (when (string-match (car elem) type)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1062 (return elem))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1063
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1064 (defun mm-automatic-display-p (handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1065 "Say whether the user wants HANDLE to be displayed automatically."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1066 (let ((methods mm-automatic-display)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1067 (type (mm-handle-media-type handle))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1068 method result)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1069 (while (setq method (pop methods))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1070 (when (and (not (mm-inline-override-p handle))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1071 (string-match method type))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1072 (setq result t
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1073 methods nil)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1074 result))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1075
70377
1b78f3a87f16 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-265
Miles Bader <miles@gnu.org>
parents: 70245
diff changeset
1076 (defun mm-inlinable-p (handle &optional type)
1b78f3a87f16 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-265
Miles Bader <miles@gnu.org>
parents: 70245
diff changeset
1077 "Say whether HANDLE can be displayed inline.
1b78f3a87f16 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-265
Miles Bader <miles@gnu.org>
parents: 70245
diff changeset
1078 TYPE is the mime-type of the object; it defaults to the one given
1b78f3a87f16 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-265
Miles Bader <miles@gnu.org>
parents: 70245
diff changeset
1079 in HANDLE."
1b78f3a87f16 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-265
Miles Bader <miles@gnu.org>
parents: 70245
diff changeset
1080 (unless type (setq type (mm-handle-media-type handle)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1081 (let ((alist mm-inline-media-tests)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1082 test)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1083 (while alist
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1084 (when (string-match (caar alist) type)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1085 (setq test (caddar alist)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1086 alist nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1087 (setq test (funcall test handle)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1088 (pop alist))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1089 test))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1090
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1091 (defun mm-inlined-p (handle)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1092 "Say whether the user wants HANDLE to be displayed inline."
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1093 (let ((methods mm-inlined-types)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1094 (type (mm-handle-media-type handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1095 method result)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1096 (while (setq method (pop methods))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1097 (when (and (not (mm-inline-override-p handle))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1098 (string-match method type))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1099 (setq result t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1100 methods nil)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1101 result))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1102
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1103 (defun mm-attachment-override-p (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1104 "Say whether HANDLE should have attachment behavior overridden."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1105 (let ((types mm-attachment-override-types)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1106 (type (mm-handle-media-type handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1107 ty)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1108 (catch 'found
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1109 (while (setq ty (pop types))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1110 (when (and (string-match ty type)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1111 (mm-inlinable-p handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1112 (throw 'found t))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1113
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1114 (defun mm-inline-override-p (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1115 "Say whether HANDLE should have inline behavior overridden."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1116 (let ((types mm-inline-override-types)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1117 (type (mm-handle-media-type handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1118 ty)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1119 (catch 'found
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1120 (while (setq ty (pop types))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1121 (when (string-match ty type)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1122 (throw 'found t))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1123
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1124 (defun mm-automatic-external-display-p (type)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1125 "Return the user-defined method for TYPE."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1126 (let ((methods mm-automatic-external-display)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1127 method result)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1128 (while (setq method (pop methods))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1129 (when (string-match method type)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1130 (setq result t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1131 methods nil)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1132 result))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1133
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1134 (defun mm-destroy-part (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1135 "Destroy the data structures connected to HANDLE."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1136 (when (listp handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1137 (mm-remove-part handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1138 (when (buffer-live-p (mm-handle-buffer handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1139 (kill-buffer (mm-handle-buffer handle)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1140
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1141 (defun mm-handle-displayed-p (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1142 "Say whether HANDLE is displayed or not."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1143 (mm-handle-undisplayer handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1144
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1145 ;;;
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1146 ;;; Functions for outputting parts
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1147 ;;;
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1148
69572
b4faac2800dd Revision: emacs@sv.gnu.org/emacs--devo--0--patch-163
Miles Bader <miles@gnu.org>
parents: 69247
diff changeset
1149 (defmacro mm-with-part (handle &rest forms)
b4faac2800dd Revision: emacs@sv.gnu.org/emacs--devo--0--patch-163
Miles Bader <miles@gnu.org>
parents: 69247
diff changeset
1150 "Run FORMS in the temp buffer containing the contents of HANDLE."
92769
734bb318f69e (mm-with-part): Set the buffer to unibyte before inserting
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
1151 ;; The handle-buffer's content is a sequence of bytes, not a sequence of
734bb318f69e (mm-with-part): Set the buffer to unibyte before inserting
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
1152 ;; chars, so the buffer should be unibyte. It may happen that the
734bb318f69e (mm-with-part): Set the buffer to unibyte before inserting
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
1153 ;; handle-buffer is multibyte for some reason, in which case now is a good
734bb318f69e (mm-with-part): Set the buffer to unibyte before inserting
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
1154 ;; time to adjust it, since we know at this point that it should
734bb318f69e (mm-with-part): Set the buffer to unibyte before inserting
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
1155 ;; be unibyte.
734bb318f69e (mm-with-part): Set the buffer to unibyte before inserting
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
1156 `(let* ((handle ,handle))
110583
b6d2a63ad993 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110410
diff changeset
1157 (when (and (mm-handle-buffer handle)
b6d2a63ad993 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110410
diff changeset
1158 (buffer-name (mm-handle-buffer handle)))
b6d2a63ad993 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110410
diff changeset
1159 (with-temp-buffer
b6d2a63ad993 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110410
diff changeset
1160 (mm-disable-multibyte)
b6d2a63ad993 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110410
diff changeset
1161 (insert-buffer-substring (mm-handle-buffer handle))
b6d2a63ad993 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110410
diff changeset
1162 (mm-decode-content-transfer-encoding
b6d2a63ad993 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110410
diff changeset
1163 (mm-handle-encoding handle)
b6d2a63ad993 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110410
diff changeset
1164 (mm-handle-media-type handle))
b6d2a63ad993 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110410
diff changeset
1165 ,@forms))))
69572
b4faac2800dd Revision: emacs@sv.gnu.org/emacs--devo--0--patch-163
Miles Bader <miles@gnu.org>
parents: 69247
diff changeset
1166 (put 'mm-with-part 'lisp-indent-function 1)
b4faac2800dd Revision: emacs@sv.gnu.org/emacs--devo--0--patch-163
Miles Bader <miles@gnu.org>
parents: 69247
diff changeset
1167 (put 'mm-with-part 'edebug-form-spec '(body))
b4faac2800dd Revision: emacs@sv.gnu.org/emacs--devo--0--patch-163
Miles Bader <miles@gnu.org>
parents: 69247
diff changeset
1168
69649
ab0b847baba4 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-176
Miles Bader <miles@gnu.org>
parents: 69572
diff changeset
1169 (defun mm-get-part (handle &optional no-cache)
ab0b847baba4 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-176
Miles Bader <miles@gnu.org>
parents: 69572
diff changeset
1170 "Return the contents of HANDLE as a string.
ab0b847baba4 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-176
Miles Bader <miles@gnu.org>
parents: 69572
diff changeset
1171 If NO-CACHE is non-nil, cached contents of a message/external-body part
ab0b847baba4 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-176
Miles Bader <miles@gnu.org>
parents: 69572
diff changeset
1172 are ignored."
ab0b847baba4 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-176
Miles Bader <miles@gnu.org>
parents: 69572
diff changeset
1173 (if (and (not no-cache)
ab0b847baba4 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-176
Miles Bader <miles@gnu.org>
parents: 69572
diff changeset
1174 (equal (mm-handle-media-type handle) "message/external-body"))
69572
b4faac2800dd Revision: emacs@sv.gnu.org/emacs--devo--0--patch-163
Miles Bader <miles@gnu.org>
parents: 69247
diff changeset
1175 (progn
b4faac2800dd Revision: emacs@sv.gnu.org/emacs--devo--0--patch-163
Miles Bader <miles@gnu.org>
parents: 69247
diff changeset
1176 (unless (mm-handle-cache handle)
b4faac2800dd Revision: emacs@sv.gnu.org/emacs--devo--0--patch-163
Miles Bader <miles@gnu.org>
parents: 69247
diff changeset
1177 (mm-extern-cache-contents handle))
b4faac2800dd Revision: emacs@sv.gnu.org/emacs--devo--0--patch-163
Miles Bader <miles@gnu.org>
parents: 69247
diff changeset
1178 (with-current-buffer (mm-handle-buffer (mm-handle-cache handle))
b4faac2800dd Revision: emacs@sv.gnu.org/emacs--devo--0--patch-163
Miles Bader <miles@gnu.org>
parents: 69247
diff changeset
1179 (buffer-string)))
b4faac2800dd Revision: emacs@sv.gnu.org/emacs--devo--0--patch-163
Miles Bader <miles@gnu.org>
parents: 69247
diff changeset
1180 (mm-with-part handle
69247
6580c61aced7 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-134
Miles Bader <miles@gnu.org>
parents: 68940
diff changeset
1181 (buffer-string))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1182
69649
ab0b847baba4 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-176
Miles Bader <miles@gnu.org>
parents: 69572
diff changeset
1183 (defun mm-insert-part (handle &optional no-cache)
ab0b847baba4 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-176
Miles Bader <miles@gnu.org>
parents: 69572
diff changeset
1184 "Insert the contents of HANDLE in the current buffer.
ab0b847baba4 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-176
Miles Bader <miles@gnu.org>
parents: 69572
diff changeset
1185 If NO-CACHE is non-nil, cached contents of a message/external-body part
ab0b847baba4 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-176
Miles Bader <miles@gnu.org>
parents: 69572
diff changeset
1186 are ignored."
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1187 (let ((text (cond ((eq (mail-content-type-get (mm-handle-type handle)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1188 'charset)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1189 'gnus-decoded)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1190 (with-current-buffer (mm-handle-buffer handle)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1191 (buffer-string)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1192 ((mm-multibyte-p)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1193 (mm-string-to-multibyte (mm-get-part handle no-cache)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1194 (t
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1195 (mm-get-part handle no-cache)))))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1196 (save-restriction
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1197 (widen)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1198 (goto-char
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1199 (prog1
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1200 (point)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1201 (if (and (eq (get-char-property (max (point-min) (1- (point))) 'face)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1202 'mm-uu-extract)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1203 (eq (get-char-property 0 'face text) 'mm-uu-extract))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1204 ;; Separate the extracted parts that have the same faces.
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1205 (insert "\n" text)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1206 (insert text)))))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1207
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1208 (defun mm-file-name-delete-whitespace (file-name)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1209 "Remove all whitespace characters from FILE-NAME."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1210 (while (string-match "\\s-+" file-name)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1211 (setq file-name (replace-match "" t t file-name)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1212 file-name)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1213
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1214 (defun mm-file-name-trim-whitespace (file-name)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1215 "Remove leading and trailing whitespace characters from FILE-NAME."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1216 (when (string-match "\\`\\s-+" file-name)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1217 (setq file-name (substring file-name (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
1218 (when (string-match "\\s-+\\'" file-name)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1219 (setq file-name (substring file-name 0 (match-beginning 0))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1220 file-name)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1221
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1222 (defun mm-file-name-collapse-whitespace (file-name)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1223 "Collapse multiple whitespace characters in FILE-NAME."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1224 (while (string-match "\\s-\\s-+" file-name)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1225 (setq file-name (replace-match " " t t file-name)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1226 file-name)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1227
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1228 (defun mm-file-name-replace-whitespace (file-name)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1229 "Replace whitespace characters in FILE-NAME with underscores.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1230 Set the option `mm-file-name-replace-whitespace' to any other
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1231 string if you do not like underscores."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1232 (let ((s (or mm-file-name-replace-whitespace "_")))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1233 (while (string-match "\\s-" file-name)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1234 (setq file-name (replace-match s t t file-name))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1235 file-name)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1236
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1237 (defun mm-file-name-delete-control (filename)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1238 "Delete control characters from FILENAME."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1239 (gnus-replace-in-string filename "[\x00-\x1f\x7f]" ""))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1240
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1241 (defun mm-file-name-delete-gotchas (filename)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1242 "Delete shell gotchas from FILENAME."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1243 (setq filename (gnus-replace-in-string filename "[<>|]" ""))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1244 (gnus-replace-in-string filename "^[.-]+" ""))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1245
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1246 (defun mm-save-part (handle &optional prompt)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1247 "Write HANDLE to a file.
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1248 PROMPT overrides the default one used to ask user for a file name."
69572
b4faac2800dd Revision: emacs@sv.gnu.org/emacs--devo--0--patch-163
Miles Bader <miles@gnu.org>
parents: 69247
diff changeset
1249 (let ((filename (or (mail-content-type-get
b4faac2800dd Revision: emacs@sv.gnu.org/emacs--devo--0--patch-163
Miles Bader <miles@gnu.org>
parents: 69247
diff changeset
1250 (mm-handle-disposition handle) 'filename)
b4faac2800dd Revision: emacs@sv.gnu.org/emacs--devo--0--patch-163
Miles Bader <miles@gnu.org>
parents: 69247
diff changeset
1251 (mail-content-type-get
b4faac2800dd Revision: emacs@sv.gnu.org/emacs--devo--0--patch-163
Miles Bader <miles@gnu.org>
parents: 69247
diff changeset
1252 (mm-handle-type handle) 'name)))
b4faac2800dd Revision: emacs@sv.gnu.org/emacs--devo--0--patch-163
Miles Bader <miles@gnu.org>
parents: 69247
diff changeset
1253 file)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1254 (when filename
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1255 (setq filename (gnus-map-function mm-file-name-rewrite-functions
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1256 (file-name-nondirectory filename))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1257 (setq file
110583
b6d2a63ad993 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110410
diff changeset
1258 (read-file-name (or prompt
b6d2a63ad993 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110410
diff changeset
1259 (format "Save MIME part to (default %s): "
b6d2a63ad993 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110410
diff changeset
1260 (or filename "")))
93723
2da1f95ea11c (mm-inline-media-tests): Add entry for x-diff.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93107
diff changeset
1261 (or mm-default-directory default-directory)
110583
b6d2a63ad993 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110410
diff changeset
1262 (or filename "")))
110810
07053df95af6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110777
diff changeset
1263 (if (file-directory-p file)
07053df95af6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110777
diff changeset
1264 (setq file (expand-file-name filename file))
07053df95af6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110777
diff changeset
1265 (setq file (expand-file-name
07053df95af6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110777
diff changeset
1266 file (or mm-default-directory default-directory))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1267 (setq mm-default-directory (file-name-directory file))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1268 (and (or (not (file-exists-p file))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1269 (yes-or-no-p (format "File %s already exists; overwrite? "
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1270 file)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1271 (progn
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1272 (mm-save-part-to-file handle file)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1273 file))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1274
107581
1e23ce3cbd8b 2010-03-30 Martin Stjernholm <mast@lysator.liu.se>
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 107571
diff changeset
1275 (defun mm-add-meta-html-tag (handle &optional charset force-charset)
87300
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1276 "Add meta html tag to specify CHARSET of HANDLE in the current buffer.
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1277 CHARSET defaults to the one HANDLE specifies. Existing meta tag that
107581
1e23ce3cbd8b 2010-03-30 Martin Stjernholm <mast@lysator.liu.se>
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 107571
diff changeset
1278 specifies charset will not be modified unless FORCE-CHARSET is non-nil.
1e23ce3cbd8b 2010-03-30 Martin Stjernholm <mast@lysator.liu.se>
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 107571
diff changeset
1279 Return t if meta tag is added or replaced."
87300
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1280 (when (equal (mm-handle-media-type handle) "text/html")
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1281 (when (or charset
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1282 (setq charset (mail-content-type-get (mm-handle-type handle)
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1283 'charset)))
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1284 (setq charset (format "\
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1285 <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">" charset))
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1286 (let ((case-fold-search t))
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1287 (goto-char (point-min))
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1288 (if (re-search-forward "\
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1289 <meta\\s-+http-equiv=[\"']?content-type[\"']?\\s-+content=[\"']\
107571
2bfe0d4c1bc7 (mm-add-meta-html-tag): Fix regexp matching meta tag.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 107427
diff changeset
1290 text/\\(\\sw+\\)\\(?:\;\\s-*charset=\\(.+\\)\\)?[\"'][^>]*>" nil t)
107581
1e23ce3cbd8b 2010-03-30 Martin Stjernholm <mast@lysator.liu.se>
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 107571
diff changeset
1291 (if (and (not force-charset)
1e23ce3cbd8b 2010-03-30 Martin Stjernholm <mast@lysator.liu.se>
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 107571
diff changeset
1292 (match-beginning 2)
87300
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1293 (string-match "\\`html\\'" (match-string 1)))
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1294 ;; Don't modify existing meta tag.
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1295 nil
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1296 ;; Replace it with the one specifying charset.
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1297 (replace-match charset)
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1298 t)
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1299 (if (re-search-forward "<head>\\s-*" nil t)
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1300 (insert charset "\n")
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1301 (re-search-forward "<html\\(?:\\s-+[^>]+\\|\\s-*\\)>\\s-*" nil t)
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1302 (insert "<head>\n" charset "\n</head>\n"))
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1303 t)))))
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1304
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1305 (defun mm-save-part-to-file (handle file)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1306 (mm-with-unibyte-buffer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1307 (mm-insert-part handle)
87300
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1308 (mm-add-meta-html-tag handle)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1309 (let ((current-file-modes (default-file-modes)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1310 (set-default-file-modes mm-attachment-file-modes)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1311 (unwind-protect
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1312 ;; Don't re-compress .gz & al. Arguably we should make
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1313 ;; `file-name-handler-alist' nil, but that would chop
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1314 ;; ange-ftp, which is reasonable to use here.
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1315 (mm-write-region (point-min) (point-max) file nil nil nil 'binary t)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1316 (set-default-file-modes current-file-modes)))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1317
108290
afc774335f7e Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 107581
diff changeset
1318 (defun mm-pipe-part (handle &optional cmd)
afc774335f7e Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 107581
diff changeset
1319 "Pipe HANDLE to a process.
afc774335f7e Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 107581
diff changeset
1320 Use CMD as the process."
afc774335f7e Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 107581
diff changeset
1321 (let ((name (mail-content-type-get (mm-handle-type handle) 'name))
afc774335f7e Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 107581
diff changeset
1322 (command (or cmd
afc774335f7e Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 107581
diff changeset
1323 (gnus-read-shell-command
afc774335f7e Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 107581
diff changeset
1324 "Shell command on MIME part: " mm-last-shell-command))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1325 (mm-with-unibyte-buffer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1326 (mm-insert-part handle)
87300
b968c7f9a8b4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87243
diff changeset
1327 (mm-add-meta-html-tag handle)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1328 (let ((coding-system-for-write 'binary))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1329 (shell-command-on-region (point-min) (point-max) command nil)))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1330
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1331 (defun mm-interactively-view-part (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1332 "Display HANDLE using METHOD."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1333 (let* ((type (mm-handle-media-type handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1334 (methods
110661
2b8ece636433 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110635
diff changeset
1335 (mapcar (lambda (i) (cdr (assoc 'viewer i)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1336 (mailcap-mime-info type 'all)))
32962
496ce24f9ddc 2000-10-27 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 31782
diff changeset
1337 (method (let ((minibuffer-local-completion-map
496ce24f9ddc 2000-10-27 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 31782
diff changeset
1338 mm-viewer-completion-map))
110661
2b8ece636433 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110635
diff changeset
1339 (gnus-completing-read "Viewer" methods))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1340 (when (string= method "")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1341 (error "No method given"))
35048
0b4c50eb2002 (mm-inline-media-tests): Add
Dave Love <fx@gnu.org>
parents: 34833
diff changeset
1342 (if (string-match "^[^% \t]+$" method)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1343 (setq method (concat method " %s")))
35453
26726eff41ca 2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35048
diff changeset
1344 (mm-display-external handle method)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1345
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1346 (defun mm-preferred-alternative (handles &optional preferred)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1347 "Say which of HANDLES are preferred."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1348 (let ((prec (if preferred (list preferred)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1349 (mm-preferred-alternative-precedence handles)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1350 p h result type handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1351 (while (setq p (pop prec))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1352 (setq h handles)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1353 (while h
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1354 (setq handle (car h))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1355 (setq type (mm-handle-media-type handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1356 (when (and (equal p type)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1357 (mm-automatic-display-p handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1358 (or (stringp (car handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1359 (not (mm-handle-disposition handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1360 (equal (car (mm-handle-disposition handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1361 "inline")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1362 (setq result handle
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1363 h nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1364 prec nil))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1365 (pop h)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1366 result))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1367
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1368 (defun mm-preferred-alternative-precedence (handles)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1369 "Return the precedence based on HANDLES and `mm-discouraged-alternatives'."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1370 (let ((seq (nreverse (mapcar #'mm-handle-media-type
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1371 handles))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1372 (dolist (disc (reverse mm-discouraged-alternatives))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1373 (dolist (elem (copy-sequence seq))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1374 (when (string-match disc elem)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1375 (setq seq (nconc (delete elem seq) (list elem))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1376 seq))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1377
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1378 (defun mm-get-content-id (id)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1379 "Return the handle(s) referred to by ID."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1380 (cdr (assoc id mm-content-id-alist)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1381
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1382 (defconst mm-image-type-regexps
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1383 '(("/\\*.*XPM.\\*/" . xpm)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1384 ("P[1-6]" . pbm)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1385 ("GIF8" . gif)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1386 ("\377\330" . jpeg)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1387 ("\211PNG\r\n" . png)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1388 ("#define" . xbm)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1389 ("\\(MM\0\\*\\)\\|\\(II\\*\0\\)" . tiff)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1390 ("%!PS" . postscript))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1391 "Alist of (REGEXP . IMAGE-TYPE) pairs used to auto-detect image types.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1392 When the first bytes of an image file match REGEXP, it is assumed to
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1393 be of image type IMAGE-TYPE.")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1394
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1395 ;; Steal from image.el. image-type-from-data suffers multi-line matching bug.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1396 (defun mm-image-type-from-buffer ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1397 "Determine the image type from data in the current buffer.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1398 Value is a symbol specifying the image type or nil if type cannot
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1399 be determined."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1400 (let ((types mm-image-type-regexps)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1401 type)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1402 (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
1403 (while (and types (null type))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1404 (let ((regexp (car (car types)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1405 (image-type (cdr (car types))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1406 (when (looking-at regexp)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1407 (setq type image-type))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1408 (setq types (cdr types))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1409 type))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1410
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1411 (defun mm-get-image (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1412 "Return an image instance based on HANDLE."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1413 (let ((type (mm-handle-media-subtype handle))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1414 spec)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1415 ;; Allow some common translations.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1416 (setq type
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1417 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1418 ((equal type "x-pixmap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1419 "xpm")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1420 ((equal type "x-xbitmap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1421 "xbm")
35048
0b4c50eb2002 (mm-inline-media-tests): Add
Dave Love <fx@gnu.org>
parents: 34833
diff changeset
1422 ((equal type "x-portable-bitmap")
0b4c50eb2002 (mm-inline-media-tests): Add
Dave Love <fx@gnu.org>
parents: 34833
diff changeset
1423 "pbm")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1424 (t type)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1425 (or (mm-handle-cache handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1426 (mm-with-unibyte-buffer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1427 (mm-insert-part handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1428 (prog1
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1429 (setq spec
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1430 (ignore-errors
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1431 ;; Avoid testing `make-glyph' since W3 may define
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1432 ;; a bogus version of it.
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1433 (if (fboundp 'create-image)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1434 (create-image (buffer-string)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1435 (or (mm-image-type-from-buffer)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1436 (intern type))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1437 'data-p)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1438 (mm-create-image-xemacs type))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1439 (mm-handle-set-cache handle spec))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1440
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1441 (defun mm-create-image-xemacs (type)
86154
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1442 (when (featurep 'xemacs)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1443 (cond
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1444 ((equal type "xbm")
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1445 ;; xbm images require special handling, since
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1446 ;; the only way to create glyphs from these
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1447 ;; (without a ton of work) is to write them
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1448 ;; out to a file, and then create a file
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1449 ;; specifier.
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1450 (let ((file (mm-make-temp-file
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1451 (expand-file-name "emm" mm-tmp-directory)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1452 nil ".xbm")))
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1453 (unwind-protect
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1454 (progn
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1455 (write-region (point-min) (point-max) file)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1456 (make-glyph (list (cons 'x file))))
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1457 (ignore-errors
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1458 (delete-file file)))))
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1459 (t
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1460 (make-glyph
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1461 (vector
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1462 (or (mm-image-type-from-buffer)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1463 (intern type))
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1464 :data (buffer-string)))))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1465
95814
eb119cbc1715 (image-size): Declare.
Glenn Morris <rgm@gnu.org>
parents: 95586
diff changeset
1466 (declare-function image-size "image.c" (spec &optional pixels frame))
eb119cbc1715 (image-size): Declare.
Glenn Morris <rgm@gnu.org>
parents: 95586
diff changeset
1467
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1468 (defun mm-image-fit-p (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1469 "Say whether the image in HANDLE will fit the current window."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1470 (let ((image (mm-get-image handle)))
78006
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
1471 (or (not image)
86154
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
1472 (if (featurep 'xemacs)
78006
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
1473 ;; XEmacs' glyphs can actually tell us about their width, so
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
1474 ;; lets be nice and smart about them.
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
1475 (or mm-inline-large-images
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
1476 (and (<= (glyph-width image) (window-pixel-width))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
1477 (<= (glyph-height image) (window-pixel-height))))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
1478 (let* ((size (image-size image))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
1479 (w (car size))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
1480 (h (cdr size)))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
1481 (or mm-inline-large-images
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
1482 (and (<= h (1- (window-height))) ; Don't include mode line.
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
1483 (<= w (window-width)))))))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1484
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1485 (defun mm-valid-image-format-p (format)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1486 "Say whether FORMAT can be displayed natively by Emacs."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1487 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1488 ;; Handle XEmacs
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1489 ((fboundp 'valid-image-instantiator-format-p)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1490 (valid-image-instantiator-format-p format))
110635
6c6f3972c99c Fix comments; remove Emacs 21 stuff.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110583
diff changeset
1491 ;; Handle Emacs
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1492 ((fboundp 'image-type-available-p)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1493 (and (display-graphic-p)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1494 (image-type-available-p format)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1495 ;; Nobody else can do images yet.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1496 (t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1497 nil)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1498
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1499 (defun mm-valid-and-fit-image-p (format handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1500 "Say whether FORMAT can be displayed natively and HANDLE fits the window."
32962
496ce24f9ddc 2000-10-27 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 31782
diff changeset
1501 (and (mm-valid-image-format-p format)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1502 (mm-image-fit-p handle)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1503
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1504 (defun mm-find-part-by-type (handles type &optional notp recursive)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1505 "Search in HANDLES for part with TYPE.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1506 If NOTP, returns first non-matching part.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1507 If RECURSIVE, search recursively."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1508 (let (handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1509 (while handles
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1510 (if (and recursive (stringp (caar handles)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1511 (if (setq handle (mm-find-part-by-type (cdar handles) type
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1512 notp recursive))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1513 (setq handles nil))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1514 (if (if notp
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1515 (not (equal (mm-handle-media-type (car handles)) type))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1516 (equal (mm-handle-media-type (car handles)) type))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1517 (setq handle (car handles)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1518 handles nil)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1519 (setq handles (cdr handles)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1520 handle))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1521
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1522 (defun mm-find-raw-part-by-type (ctl type &optional notp)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1523 (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
1524 (let* ((boundary (concat "--" (mm-handle-multipart-ctl-parameter ctl
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1525 'boundary)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1526 (close-delimiter (concat "^" (regexp-quote boundary) "--[ \t]*$"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1527 start
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1528 (end (save-excursion
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1529 (goto-char (point-max))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1530 (if (re-search-backward close-delimiter nil t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1531 (match-beginning 0)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1532 (point-max))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1533 result)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1534 (setq boundary (concat "^" (regexp-quote boundary) "[ \t]*$"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1535 (while (and (not result)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1536 (re-search-forward boundary end t))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1537 (goto-char (match-beginning 0))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1538 (when start
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1539 (save-excursion
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1540 (save-restriction
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1541 (narrow-to-region start (1- (point)))
68720
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68287
diff changeset
1542 (when (let* ((ct (mail-fetch-field "content-type"))
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68287
diff changeset
1543 (ctl (and ct (mail-header-parse-content-type ct))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1544 (if notp
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1545 (not (equal (car ctl) type))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1546 (equal (car ctl) type)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1547 (setq result (buffer-string))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1548 (forward-line 1)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1549 (setq start (point)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1550 (when (and (not result) start)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1551 (save-excursion
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1552 (save-restriction
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1553 (narrow-to-region start end)
68720
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68287
diff changeset
1554 (when (let* ((ct (mail-fetch-field "content-type"))
d9dde5b81e71 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents: 68287
diff changeset
1555 (ctl (and ct (mail-header-parse-content-type ct))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1556 (if notp
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1557 (not (equal (car ctl) type))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1558 (equal (car ctl) type)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1559 (setq result (buffer-string))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1560 result))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1561
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1562 (defvar mm-security-handle nil)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1563
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1564 (defsubst mm-set-handle-multipart-parameter (handle parameter value)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1565 ;; HANDLE could be a CTL.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1566 (when handle
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1567 (put-text-property 0 (length (car handle)) parameter value
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1568 (car handle))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1569
87243
23ea76295829 Add declare-function compatibility definition.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
1570 (autoload 'mm-view-pkcs7 "mm-view")
23ea76295829 Add declare-function compatibility definition.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
1571
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1572 (defun mm-possibly-verify-or-decrypt (parts ctl)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1573 (let ((type (car ctl))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1574 (subtype (cadr (split-string (car ctl) "/")))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1575 (mm-security-handle ctl) ;; (car CTL) is the type.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1576 protocol func functest)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1577 (cond
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1578 ((or (equal type "application/x-pkcs7-mime")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1579 (equal type "application/pkcs7-mime"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1580 (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
1581 (when (and (cond
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1582 ((eq mm-decrypt-option 'never) nil)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1583 ((eq mm-decrypt-option 'always) t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1584 ((eq mm-decrypt-option 'known) t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1585 (t (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
1586 (format "Decrypt (S/MIME) part? "))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1587 (mm-view-pkcs7 parts))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1588 (setq parts (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
1589 ((equal subtype "signed")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1590 (unless (and (setq protocol
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1591 (mm-handle-multipart-ctl-parameter ctl 'protocol))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1592 (not (equal protocol "multipart/mixed")))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1593 ;; The message is broken or draft-ietf-openpgp-multsig-01.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1594 (let ((protocols mm-verify-function-alist))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1595 (while protocols
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1596 (if (and (or (not (setq functest (nth 3 (car protocols))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1597 (funcall functest parts ctl))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1598 (mm-find-part-by-type parts (caar protocols) nil t))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1599 (setq protocol (caar protocols)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1600 protocols nil)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1601 (setq protocols (cdr protocols))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1602 (setq func (nth 1 (assoc protocol mm-verify-function-alist)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1603 (when (cond
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1604 ((eq mm-verify-option 'never) nil)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1605 ((eq mm-verify-option 'always) t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1606 ((eq mm-verify-option 'known)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1607 (and func
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1608 (or (not (setq functest
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1609 (nth 3 (assoc protocol
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1610 mm-verify-function-alist))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1611 (funcall functest parts ctl))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1612 (t
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1613 (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
1614 (format "Verify signed (%s) part? "
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1615 (or (nth 2 (assoc protocol mm-verify-function-alist))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1616 (format "protocol=%s" protocol))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1617 (save-excursion
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1618 (if func
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1619 (setq parts (funcall func parts ctl))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1620 (mm-set-handle-multipart-parameter
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1621 mm-security-handle 'gnus-details
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1622 (format "Unknown sign protocol (%s)" protocol))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1623 ((equal subtype "encrypted")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1624 (unless (setq protocol
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1625 (mm-handle-multipart-ctl-parameter ctl 'protocol))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1626 ;; The message is broken.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1627 (let ((parts parts))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1628 (while parts
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1629 (if (assoc (mm-handle-media-type (car parts))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1630 mm-decrypt-function-alist)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1631 (setq protocol (mm-handle-media-type (car parts))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1632 parts nil)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1633 (setq parts (cdr parts))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1634 (setq func (nth 1 (assoc protocol mm-decrypt-function-alist)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1635 (when (cond
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1636 ((eq mm-decrypt-option 'never) nil)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1637 ((eq mm-decrypt-option 'always) t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1638 ((eq mm-decrypt-option 'known)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1639 (and func
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1640 (or (not (setq functest
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1641 (nth 3 (assoc protocol
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1642 mm-decrypt-function-alist))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1643 (funcall functest parts ctl))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1644 (t
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1645 (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
1646 (format "Decrypt (%s) part? "
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1647 (or (nth 2 (assoc protocol mm-decrypt-function-alist))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1648 (format "protocol=%s" protocol))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1649 (save-excursion
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1650 (if func
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1651 (setq parts (funcall func parts ctl))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1652 (mm-set-handle-multipart-parameter
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1653 mm-security-handle 'gnus-details
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1654 (format "Unknown encrypt protocol (%s)" protocol))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1655 (t nil))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1656 parts))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1657
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1658 (defun mm-multiple-handles (handles)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1659 (and (listp handles)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1660 (> (length handles) 1)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1661 (or (listp (car handles))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1662 (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
1663
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1664 (defun mm-complicated-handles (handles)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1665 (and (listp (car handles))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1666 (> (length handles) 1)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1667
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1668 (defun mm-merge-handles (handles1 handles2)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1669 (append
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1670 (if (listp (car handles1))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1671 handles1
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1672 (list handles1))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1673 (if (listp (car handles2))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1674 handles2
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1675 (list handles2))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1676
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1677 (defun mm-readable-p (handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1678 "Say whether the content of HANDLE is readable."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1679 (and (< (with-current-buffer (mm-handle-buffer handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1680 (buffer-size)) 10000)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1681 (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
1682 (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
1683 (and (eq (mm-body-7-or-8) '7bit)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1684 (not (mm-long-lines-p 76))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
1685
110766
5613a6649f72 mm-decode.el (mm-shr): Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110747
diff changeset
1686 (declare-function libxml-parse-html-region "xml.c"
5613a6649f72 mm-decode.el (mm-shr): Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110747
diff changeset
1687 (start end &optional base-url))
5613a6649f72 mm-decode.el (mm-shr): Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110747
diff changeset
1688 (declare-function shr-insert-document "shr" (dom))
5613a6649f72 mm-decode.el (mm-shr): Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110747
diff changeset
1689
110708
4c31586ca1ca Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
1690 (defun mm-shr (handle)
110777
895607aec71e Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110766
diff changeset
1691 ;; Require since we bind its variables.
895607aec71e Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110766
diff changeset
1692 (require 'shr)
110766
5613a6649f72 mm-decode.el (mm-shr): Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110747
diff changeset
1693 (let ((article-buffer (current-buffer))
110777
895607aec71e Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110766
diff changeset
1694 (shr-blocked-images (with-current-buffer gnus-summary-buffer
895607aec71e Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110766
diff changeset
1695 gnus-blocked-images))
895607aec71e Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110766
diff changeset
1696 (shr-content-function (lambda (id)
895607aec71e Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110766
diff changeset
1697 (let ((handle (mm-get-content-id id)))
895607aec71e Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110766
diff changeset
1698 (when handle
895607aec71e Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110766
diff changeset
1699 (mm-with-part handle
895607aec71e Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110766
diff changeset
1700 (buffer-string))))))
110766
5613a6649f72 mm-decode.el (mm-shr): Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110747
diff changeset
1701 charset)
110708
4c31586ca1ca Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
1702 (unless handle
4c31586ca1ca Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
1703 (setq handle (mm-dissect-buffer t)))
110766
5613a6649f72 mm-decode.el (mm-shr): Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110747
diff changeset
1704 (setq charset (mail-content-type-get (mm-handle-type handle) 'charset))
110747
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110708
diff changeset
1705 (save-restriction
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110708
diff changeset
1706 (narrow-to-region (point) (point))
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110708
diff changeset
1707 (shr-insert-document
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110708
diff changeset
1708 (mm-with-part handle
110766
5613a6649f72 mm-decode.el (mm-shr): Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110747
diff changeset
1709 (when (and charset
5613a6649f72 mm-decode.el (mm-shr): Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110747
diff changeset
1710 (setq charset (mm-charset-to-coding-system charset))
5613a6649f72 mm-decode.el (mm-shr): Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110747
diff changeset
1711 (not (eq charset 'ascii)))
5613a6649f72 mm-decode.el (mm-shr): Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110747
diff changeset
1712 (insert (prog1
5613a6649f72 mm-decode.el (mm-shr): Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110747
diff changeset
1713 (mm-decode-coding-string (buffer-string) charset)
5613a6649f72 mm-decode.el (mm-shr): Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110747
diff changeset
1714 (erase-buffer)
5613a6649f72 mm-decode.el (mm-shr): Decode contents by charset.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110747
diff changeset
1715 (mm-enable-multibyte))))
110747
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110708
diff changeset
1716 (libxml-parse-html-region (point-min) (point-max)))))))
110708
4c31586ca1ca Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
1717
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1718 (provide 'mm-decode)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1719
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1720 ;;; mm-decode.el ends here