annotate lisp/gnus/mm-view.el @ 110788:043e3c078a67

nt/INSTALL: Add note about problematic characters passed to configure.
author Juanma Barranquero <lekktu@gmail.com>
date Wed, 06 Oct 2010 12:55:03 +0200
parents 0defef1647a5
children 236342431786
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38413
a26d9b55abb6 Some fixes to follow coding conventions in files from Gnus.
Pavel Janík <Pavel@Janik.cz>
parents: 33329
diff changeset
1 ;;; mm-view.el --- functions for viewing MIME objects
64754
fafd692d1e40 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64085
diff changeset
2
95820
645fb33380d6 Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents: 94662
diff changeset
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
4 ;; 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 92774
diff changeset
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 92774
diff changeset
11 ;; the Free Software Foundation, either version 3 of the License, or
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 92774
diff changeset
12 ;; (at your option) any later version.
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 92774
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 ;; GNU General Public License for more details.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 92774
diff changeset
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22 ;;; Commentary:
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
23
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24 ;;; Code:
87192
4b72ecd263bd (declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
25 (eval-and-compile
4b72ecd263bd (declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
26 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
27 (eval-when-compile (require 'cl))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28 (require 'mail-parse)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29 (require 'mailcap)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
30 (require 'mm-bodies)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31 (require 'mm-decode)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
32 (require 'smime)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
33
110661
2b8ece636433 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
34 (autoload 'gnus-completing-read "gnus-util")
110747
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
35 (autoload 'gnus-window-inside-pixel-edges "gnus-ems")
95820
645fb33380d6 Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents: 94662
diff changeset
36 (autoload 'gnus-article-prepare-display "gnus-art")
645fb33380d6 Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents: 94662
diff changeset
37 (autoload 'vcard-parse-string "vcard")
645fb33380d6 Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents: 94662
diff changeset
38 (autoload 'vcard-format-string "vcard")
645fb33380d6 Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents: 94662
diff changeset
39 (autoload 'fill-flowed "flow-fill")
645fb33380d6 Remove unnecessary eval-and-compile of autoloads.
Glenn Morris <rgm@gnu.org>
parents: 94662
diff changeset
40 (autoload 'html2text "html2text" nil t)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
41
65278
1c443c9ad5cf (gnus-article-mime-handles, gnus-newsgroup-charset, smime-keys,
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
42 (defvar gnus-article-mime-handles)
1c443c9ad5cf (gnus-article-mime-handles, gnus-newsgroup-charset, smime-keys,
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
43 (defvar gnus-newsgroup-charset)
1c443c9ad5cf (gnus-article-mime-handles, gnus-newsgroup-charset, smime-keys,
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
44 (defvar smime-keys)
1c443c9ad5cf (gnus-article-mime-handles, gnus-newsgroup-charset, smime-keys,
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
45 (defvar w3m-cid-retrieve-function-alist)
1c443c9ad5cf (gnus-article-mime-handles, gnus-newsgroup-charset, smime-keys,
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
46 (defvar w3m-current-buffer)
1c443c9ad5cf (gnus-article-mime-handles, gnus-newsgroup-charset, smime-keys,
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
47 (defvar w3m-display-inline-images)
1c443c9ad5cf (gnus-article-mime-handles, gnus-newsgroup-charset, smime-keys,
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
48 (defvar w3m-minor-mode-map)
1c443c9ad5cf (gnus-article-mime-handles, gnus-newsgroup-charset, smime-keys,
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
49
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
50 (defvar mm-text-html-renderer-alist
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
51 '((w3 . mm-inline-text-html-render-with-w3)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
52 (w3m . mm-inline-text-html-render-with-w3m)
68207
fbd379b34f0a Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-698
Miles Bader <miles@gnu.org>
parents: 67418
diff changeset
53 (w3m-standalone . mm-inline-text-html-render-with-w3m-standalone)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
54 (links mm-inline-render-with-file
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
55 mm-links-remove-leading-blank
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
56 "links" "-dump" file)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
57 (lynx mm-inline-render-with-stdin nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
58 "lynx" "-dump" "-force_html" "-stdin" "-nolist")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
59 (html2text mm-inline-render-with-function html2text))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
60 "The attributes of renderer types for text/html.")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
61
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
62 (defvar mm-text-html-washer-alist
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
63 '((w3 . gnus-article-wash-html-with-w3)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
64 (w3m . gnus-article-wash-html-with-w3m)
68207
fbd379b34f0a Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-698
Miles Bader <miles@gnu.org>
parents: 67418
diff changeset
65 (w3m-standalone . gnus-article-wash-html-with-w3m-standalone)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
66 (links mm-inline-wash-with-file
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
67 mm-links-remove-leading-blank
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
68 "links" "-dump" file)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
69 (lynx mm-inline-wash-with-stdin nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
70 "lynx" "-dump" "-force_html" "-stdin" "-nolist")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
71 (html2text html2text))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
72 "The attributes of washer types for text/html.")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
73
69135
12d289b6e5de Revision: emacs@sv.gnu.org/emacs--devo--0--patch-118
Miles Bader <miles@gnu.org>
parents: 68762
diff changeset
74 (defcustom mm-fill-flowed t
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
75 "If non-nil a format=flowed article will be displayed flowed."
69135
12d289b6e5de Revision: emacs@sv.gnu.org/emacs--devo--0--patch-118
Miles Bader <miles@gnu.org>
parents: 68762
diff changeset
76 :type 'boolean
12d289b6e5de Revision: emacs@sv.gnu.org/emacs--devo--0--patch-118
Miles Bader <miles@gnu.org>
parents: 68762
diff changeset
77 :version "22.1"
12d289b6e5de Revision: emacs@sv.gnu.org/emacs--devo--0--patch-118
Miles Bader <miles@gnu.org>
parents: 68762
diff changeset
78 :group 'mime-display)
12d289b6e5de Revision: emacs@sv.gnu.org/emacs--devo--0--patch-118
Miles Bader <miles@gnu.org>
parents: 68762
diff changeset
79
110747
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
80 (defcustom mm-inline-large-images-proportion 0.9
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
81 "Maximum proportion of large image resized when
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
82 `mm-inline-large-images' is set to resize."
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
83 :type 'float
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
84 :version "24.1"
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
85 :group 'mime-display)
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
86
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
87 ;;; Internal variables.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
88
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
89 ;;;
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90 ;;; Functions for displaying various formats inline
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
91 ;;;
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
92
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
93 (defun mm-inline-image-emacs (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
94 (let ((b (point-marker))
92774
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
95 (inhibit-read-only t))
110747
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
96 (put-image
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
97 (let ((image (mm-get-image handle)))
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
98 (if (eq mm-inline-large-images 'resize)
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
99 (gnus-rescale-image image
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
100 (let ((edges (gnus-window-inside-pixel-edges
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
101 (get-buffer-window (current-buffer)))))
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
102 (cons (truncate (* mm-inline-large-images-proportion
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
103 (- (nth 2 edges) (nth 0 edges))))
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
104 (truncate (* mm-inline-large-images-proportion
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
105 (- (nth 3 edges) (nth 1 edges)))))))
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
106 image))
0defef1647a5 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
107 b)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
108 (insert "\n\n")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
109 (mm-handle-set-undisplayer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
110 handle
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
111 `(lambda ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
112 (let ((b ,b)
92774
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
113 (inhibit-read-only t))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
114 (remove-images b b)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
115 (delete-region b (+ b 2)))))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
116
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
117 (defun mm-inline-image-xemacs (handle)
86154
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
118 (when (featurep 'xemacs)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
119 (insert "\n\n")
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
120 (forward-char -2)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
121 (let ((annot (make-annotation (mm-get-image handle) nil 'text))
92774
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
122 (inhibit-read-only t))
86154
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
123 (mm-handle-set-undisplayer
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
124 handle
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
125 `(lambda ()
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
126 (let ((b ,(point-marker))
92774
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
127 (inhibit-read-only t))
86154
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
128 (delete-annotation ,annot)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
129 (delete-region (- b 2) b))))
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
130 (set-extent-property annot 'mm t)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
131 (set-extent-property annot 'duplicable t))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
132
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
133 (eval-and-compile
33329
71ce9ad48432 Use featurep for XEmacs test.
Dave Love <fx@gnu.org>
parents: 31764
diff changeset
134 (if (featurep 'xemacs)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
135 (defalias 'mm-inline-image 'mm-inline-image-xemacs)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
136 (defalias 'mm-inline-image 'mm-inline-image-emacs)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
137
87192
4b72ecd263bd (declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
138 ;; External.
4b72ecd263bd (declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
139 (declare-function w3-do-setup "ext:w3" ())
4b72ecd263bd (declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
140 (declare-function w3-region "ext:w3-display" (st nd))
4b72ecd263bd (declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
141 (declare-function w3-prepare-buffer "ext:w3-display" (&rest args))
4b72ecd263bd (declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
142
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
143 (defvar mm-w3-setup nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
144 (defun mm-setup-w3 ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
145 (unless mm-w3-setup
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
146 (require 'w3)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
147 (w3-do-setup)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
148 (require 'url)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
149 (require 'w3-vars)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
150 (require 'url-vars)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
151 (setq mm-w3-setup t)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
152
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
153 (defun mm-inline-text-html-render-with-w3 (handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
154 (mm-setup-w3)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
155 (let ((text (mm-get-part handle))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
156 (b (point))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
157 (url-standalone-mode t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
158 (url-gateway-unplugged t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
159 (w3-honor-stylesheets nil)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
160 (url-current-object
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
161 (url-generic-parse-url (format "cid:%s" (mm-handle-id handle))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
162 (width (window-width))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
163 (charset (mail-content-type-get
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
164 (mm-handle-type handle) 'charset)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
165 (save-excursion
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
166 (insert (if charset (mm-decode-string text charset) text))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
167 (save-restriction
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
168 (narrow-to-region b (point))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
169 (unless charset
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
170 (goto-char (point-min))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
171 (when (or (and (boundp 'w3-meta-content-type-charset-regexp)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
172 (re-search-forward
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
173 w3-meta-content-type-charset-regexp nil t))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
174 (and (boundp 'w3-meta-charset-content-type-regexp)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
175 (re-search-forward
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
176 w3-meta-charset-content-type-regexp nil t)))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
177 (setq charset
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
178 (let ((bsubstr (buffer-substring-no-properties
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
179 (match-beginning 2)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
180 (match-end 2))))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
181 (if (fboundp 'w3-coding-system-for-mime-charset)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
182 (w3-coding-system-for-mime-charset bsubstr)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
183 (mm-charset-to-coding-system bsubstr))))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
184 (delete-region (point-min) (point-max))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
185 (insert (mm-decode-string text charset))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
186 (save-window-excursion
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
187 (save-restriction
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
188 (let ((w3-strict-width width)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
189 ;; Don't let w3 set the global version of
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
190 ;; this variable.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
191 (fill-column fill-column))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
192 (if (or debug-on-error debug-on-quit)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
193 (w3-region (point-min) (point-max))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
194 (condition-case ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
195 (w3-region (point-min) (point-max))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
196 (error
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
197 (delete-region (point-min) (point-max))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
198 (let ((b (point))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
199 (charset (mail-content-type-get
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
200 (mm-handle-type handle) 'charset)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
201 (if (or (eq charset 'gnus-decoded)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
202 (eq mail-parse-charset 'gnus-decoded))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
203 (save-restriction
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
204 (narrow-to-region (point) (point))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
205 (mm-insert-part handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
206 (goto-char (point-max)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
207 (insert (mm-decode-string (mm-get-part handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
208 charset))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
209 (message
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
210 "Error while rendering html; showing as text/plain")))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
211 (mm-handle-set-undisplayer
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
212 handle
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
213 `(lambda ()
92774
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
214 (let ((inhibit-read-only t))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
215 ,@(if (functionp 'remove-specifier)
92774
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
216 '((dolist (prop '(background background-pixmap foreground))
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
217 (remove-specifier
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
218 (face-property 'default prop)
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
219 (current-buffer)))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
220 (delete-region ,(point-min-marker)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
221 ,(point-max-marker)))))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
222
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
223 (defvar mm-w3m-setup nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
224 "Whether gnus-article-mode has been setup to use emacs-w3m.")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
225
87192
4b72ecd263bd (declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
226 ;; External.
4b72ecd263bd (declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
227 (declare-function w3m-detect-meta-charset "ext:w3m" ())
4b72ecd263bd (declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
228 (declare-function w3m-region "ext:w3m" (start end &optional url charset))
4b72ecd263bd (declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
229
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
230 (defun mm-setup-w3m ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
231 "Setup gnus-article-mode to use emacs-w3m."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
232 (unless mm-w3m-setup
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
233 (require 'w3m)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
234 (unless (assq 'gnus-article-mode w3m-cid-retrieve-function-alist)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
235 (push (cons 'gnus-article-mode 'mm-w3m-cid-retrieve)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
236 w3m-cid-retrieve-function-alist))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
237 (setq mm-w3m-setup t))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
238 (setq w3m-display-inline-images mm-inline-text-html-with-images))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
239
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
240 (defun mm-w3m-cid-retrieve-1 (url handle)
57617
7fdc1df35f39 Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents: 56927
diff changeset
241 (dolist (elem handle)
69304
55d8c694b9cf Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents: 69135
diff changeset
242 (when (consp elem)
55d8c694b9cf Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents: 69135
diff changeset
243 (when (equal url (mm-handle-id elem))
55d8c694b9cf Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents: 69135
diff changeset
244 (mm-insert-part elem)
55d8c694b9cf Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents: 69135
diff changeset
245 (throw 'found-handle (mm-handle-media-type elem)))
55d8c694b9cf Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents: 69135
diff changeset
246 (when (and (stringp (car elem))
55d8c694b9cf Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents: 69135
diff changeset
247 (equal "multipart" (mm-handle-media-supertype elem)))
55d8c694b9cf Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents: 69135
diff changeset
248 (mm-w3m-cid-retrieve-1 url elem)))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
249
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
250 (defun mm-w3m-cid-retrieve (url &rest args)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
251 "Insert a content pointed by URL if it has the cid: scheme."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
252 (when (string-match "\\`cid:" url)
69304
55d8c694b9cf Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents: 69135
diff changeset
253 (or (catch 'found-handle
55d8c694b9cf Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents: 69135
diff changeset
254 (mm-w3m-cid-retrieve-1
55d8c694b9cf Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents: 69135
diff changeset
255 (setq url (concat "<" (substring url (match-end 0)) ">"))
55d8c694b9cf Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents: 69135
diff changeset
256 (with-current-buffer w3m-current-buffer
55d8c694b9cf Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents: 69135
diff changeset
257 gnus-article-mime-handles)))
55d8c694b9cf Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents: 69135
diff changeset
258 (prog1
55d8c694b9cf Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents: 69135
diff changeset
259 nil
55d8c694b9cf Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents: 69135
diff changeset
260 (message "Failed to find \"Content-ID: %s\"" url)))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
261
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
262 (defun mm-inline-text-html-render-with-w3m (handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
263 "Render a text/html part using emacs-w3m."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
264 (mm-setup-w3m)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
265 (let ((text (mm-get-part handle))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
266 (b (point))
77309
56cc03f5f68c Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
267 (charset (or (mail-content-type-get (mm-handle-type handle) 'charset)
56cc03f5f68c Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
268 mail-parse-charset)))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
269 (save-excursion
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
270 (insert (if charset (mm-decode-string text charset) text))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
271 (save-restriction
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
272 (narrow-to-region b (point))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
273 (unless charset
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
274 (goto-char (point-min))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
275 (when (setq charset (w3m-detect-meta-charset))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
276 (delete-region (point-min) (point-max))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
277 (insert (mm-decode-string text charset))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
278 (let ((w3m-safe-url-regexp mm-w3m-safe-url-regexp)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
279 w3m-force-redisplay)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
280 (w3m-region (point-min) (point-max) nil charset))
100208
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
281 ;; Put the mark meaning this part was rendered by emacs-w3m.
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
282 (put-text-property (point-min) (point-max)
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
283 'mm-inline-text-html-with-w3m t)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
284 (when (and mm-inline-text-html-with-w3m-keymap
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
285 (boundp 'w3m-minor-mode-map)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
286 w3m-minor-mode-map)
100198
c20a057aefda * mm-view.el (mm-inline-text-html-render-with-w3m): Put special keymap on links.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 98344
diff changeset
287 (if (and (boundp 'w3m-link-map)
c20a057aefda * mm-view.el (mm-inline-text-html-render-with-w3m): Put special keymap on links.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 98344
diff changeset
288 w3m-link-map)
100208
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
289 (let* ((start (point-min))
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
290 (end (point-max))
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
291 (on (get-text-property start 'w3m-href-anchor))
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
292 (map (copy-keymap w3m-link-map))
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
293 next)
100198
c20a057aefda * mm-view.el (mm-inline-text-html-render-with-w3m): Put special keymap on links.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 98344
diff changeset
294 (set-keymap-parent map w3m-minor-mode-map)
100208
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
295 (while (< start end)
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
296 (if on
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
297 (progn
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
298 (setq next (or (text-property-any start end
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
299 'w3m-href-anchor nil)
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
300 end))
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
301 (put-text-property start next 'keymap map))
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
302 (setq next (or (text-property-not-all start end
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
303 'w3m-href-anchor nil)
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
304 end))
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
305 (put-text-property start next 'keymap w3m-minor-mode-map))
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
306 (setq start next
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
307 on (not on))))
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
308 (put-text-property (point-min) (point-max)
c5f2603d7595 * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and fast.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 100198
diff changeset
309 'keymap w3m-minor-mode-map)))
67418
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65719
diff changeset
310 (mm-handle-set-undisplayer
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65719
diff changeset
311 handle
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65719
diff changeset
312 `(lambda ()
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
313 (let ((inhibit-read-only t))
67418
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65719
diff changeset
314 (delete-region ,(point-min-marker)
28264c86d408 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents: 65719
diff changeset
315 ,(point-max-marker)))))))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
316
68380
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
317 (defvar mm-w3m-standalone-supports-m17n-p (if (featurep 'mule) 'undecided)
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
318 "*T means the w3m command supports the m17n feature.")
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
319
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
320 (defun mm-w3m-standalone-supports-m17n-p ()
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
321 "Say whether the w3m command supports the m17n feature."
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
322 (cond ((eq mm-w3m-standalone-supports-m17n-p t) t)
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
323 ((eq mm-w3m-standalone-supports-m17n-p nil) nil)
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
324 ((not (featurep 'mule)) (setq mm-w3m-standalone-supports-m17n-p nil))
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
325 ((condition-case nil
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
326 (let ((coding-system-for-write 'iso-2022-jp)
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
327 (coding-system-for-read 'iso-2022-jp)
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
328 (str (mm-decode-coding-string "\
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
329 \e$B#D#o#e#s!!#w#3#m!!#s#u#p#p#o#r#t!!#m#1#7#n!)\e(B" 'iso-2022-jp)))
68380
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
330 (mm-with-multibyte-buffer
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
331 (insert str)
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
332 (call-process-region
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
333 (point-min) (point-max) "w3m" t t nil "-dump"
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
334 "-T" "text/html" "-I" "iso-2022-jp" "-O" "iso-2022-jp")
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
335 (goto-char (point-min))
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
336 (search-forward str nil t)))
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
337 (error nil))
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
338 (setq mm-w3m-standalone-supports-m17n-p t))
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
339 (t
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
340 ;;(message "You had better upgrade your w3m command")
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
341 (setq mm-w3m-standalone-supports-m17n-p nil))))
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
342
68207
fbd379b34f0a Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-698
Miles Bader <miles@gnu.org>
parents: 67418
diff changeset
343 (defun mm-inline-text-html-render-with-w3m-standalone (handle)
fbd379b34f0a Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-698
Miles Bader <miles@gnu.org>
parents: 67418
diff changeset
344 "Render a text/html part using w3m."
68380
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
345 (if (mm-w3m-standalone-supports-m17n-p)
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
346 (let ((source (mm-get-part handle))
77309
56cc03f5f68c Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
347 (charset (or (mail-content-type-get (mm-handle-type handle)
56cc03f5f68c Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
348 'charset)
56cc03f5f68c Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
349 (symbol-name mail-parse-charset)))
68380
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
350 cs)
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
351 (unless (and charset
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
352 (setq cs (mm-charset-to-coding-system charset))
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
353 (not (eq cs 'ascii)))
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
354 ;; The default.
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
355 (setq charset "iso-8859-1"
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
356 cs 'iso-8859-1))
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
357 (mm-insert-inline
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
358 handle
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
359 (mm-with-unibyte-buffer
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
360 (insert source)
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
361 (mm-enable-multibyte)
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
362 (let ((coding-system-for-write 'binary)
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
363 (coding-system-for-read cs))
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
364 (call-process-region
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
365 (point-min) (point-max)
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
366 "w3m" t t nil "-dump" "-T" "text/html"
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
367 "-I" charset "-O" charset))
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
368 (buffer-string))))
e1843613ecb8 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents: 68230
diff changeset
369 (mm-inline-render-with-stdin handle nil "w3m" "-dump" "-T" "text/html")))
68207
fbd379b34f0a Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-698
Miles Bader <miles@gnu.org>
parents: 67418
diff changeset
370
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
371 (defun mm-links-remove-leading-blank ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
372 ;; Delete the annoying three spaces preceding each line of links
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
373 ;; output.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
374 (goto-char (point-min))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
375 (while (re-search-forward "^ " nil t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
376 (delete-region (match-beginning 0) (match-end 0))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
377
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
378 (defun mm-inline-wash-with-file (post-func cmd &rest args)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
379 (let ((file (mm-make-temp-file
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
380 (expand-file-name "mm" mm-tmp-directory))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
381 (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: 55680
diff changeset
382 (write-region (point-min) (point-max) file nil 'silent))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
383 (delete-region (point-min) (point-max))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
384 (unwind-protect
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
385 (apply 'call-process cmd nil t nil (mapcar 'eval args))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
386 (delete-file file))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
387 (and post-func (funcall post-func))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
388
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
389 (defun mm-inline-wash-with-stdin (post-func cmd &rest args)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
390 (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: 55680
diff changeset
391 (apply 'call-process-region (point-min) (point-max)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
392 cmd t t nil args))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
393 (and post-func (funcall post-func)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
394
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
395 (defun mm-inline-render-with-file (handle post-func cmd &rest args)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
396 (let ((source (mm-get-part handle)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
397 (mm-insert-inline
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
398 handle
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
399 (mm-with-unibyte-buffer
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
400 (insert source)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
401 (apply 'mm-inline-wash-with-file post-func cmd args)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
402 (buffer-string)))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
403
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
404 (defun mm-inline-render-with-stdin (handle post-func cmd &rest args)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
405 (let ((source (mm-get-part handle)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
406 (mm-insert-inline
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
407 handle
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
408 (mm-with-unibyte-buffer
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
409 (insert source)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
410 (apply 'mm-inline-wash-with-stdin post-func cmd args)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
411 (buffer-string)))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
412
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
413 (defun mm-inline-render-with-function (handle func &rest args)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
414 (let ((source (mm-get-part handle))
77309
56cc03f5f68c Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
415 (charset (or (mail-content-type-get (mm-handle-type handle) 'charset)
56cc03f5f68c Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
416 mail-parse-charset)))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
417 (mm-insert-inline
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
418 handle
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
419 (mm-with-multibyte-buffer
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
420 (insert (if charset
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
421 (mm-decode-string source charset)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
422 source))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
423 (apply func args)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
424 (buffer-string)))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
425
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
426 (defun mm-inline-text-html (handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
427 (let* ((func (or mm-inline-text-html-renderer mm-text-html-renderer))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
428 (entry (assq func mm-text-html-renderer-alist))
92774
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
429 (inhibit-read-only t))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
430 (if entry
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
431 (setq func (cdr entry)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
432 (cond
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
433 ((functionp func)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
434 (funcall func handle))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
435 (t
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
436 (apply (car func) handle (cdr func))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
437
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
438 (defun mm-inline-text-vcard (handle)
92774
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
439 (let ((inhibit-read-only t))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
440 (mm-insert-inline
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
441 handle
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
442 (concat "\n-- \n"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
443 (ignore-errors
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
444 (if (fboundp 'vcard-pretty-print)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
445 (vcard-pretty-print (mm-get-part handle))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
446 (vcard-format-string
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
447 (vcard-parse-string (mm-get-part handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
448 'vcard-standard-filter))))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
449
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
450 (defun mm-inline-text (handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
451 (let ((b (point))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
452 (type (mm-handle-media-subtype handle))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
453 (charset (mail-content-type-get
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
454 (mm-handle-type handle) 'charset))
92774
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
455 (inhibit-read-only t))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
456 (if (or (eq charset 'gnus-decoded)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
457 ;; This is probably not entirely correct, but
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
458 ;; makes rfc822 parts with embedded multiparts work.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
459 (eq mail-parse-charset 'gnus-decoded))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
460 (save-restriction
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
461 (narrow-to-region (point) (point))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
462 (mm-insert-part handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
463 (goto-char (point-max)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
464 (insert (mm-decode-string (mm-get-part handle) charset)))
69135
12d289b6e5de Revision: emacs@sv.gnu.org/emacs--devo--0--patch-118
Miles Bader <miles@gnu.org>
parents: 68762
diff changeset
465 (when (and mm-fill-flowed
12d289b6e5de Revision: emacs@sv.gnu.org/emacs--devo--0--patch-118
Miles Bader <miles@gnu.org>
parents: 68762
diff changeset
466 (equal type "plain")
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
467 (equal (cdr (assoc 'format (mm-handle-type handle)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
468 "flowed"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
469 (save-restriction
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
470 (narrow-to-region b (point))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
471 (goto-char b)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
472 (fill-flowed nil (equal (cdr (assoc 'delsp (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
473 "yes"))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
474 (goto-char (point-max))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
475 (save-restriction
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
476 (narrow-to-region b (point))
92774
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
477 (when (member type '("enriched" "richtext"))
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
478 (set-text-properties (point-min) (point-max) nil)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
479 (ignore-errors
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
480 (enriched-decode (point-min) (point-max))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
481 (mm-handle-set-undisplayer
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
482 handle
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
483 `(lambda ()
92774
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
484 (let ((inhibit-read-only t))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
485 (delete-region ,(point-min-marker)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
486 ,(point-max-marker))))))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
487
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
488 (defun mm-insert-inline (handle text)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
489 "Insert TEXT inline from HANDLE."
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
490 (let ((b (point)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
491 (insert text)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
492 (unless (bolp)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
493 (insert "\n"))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
494 (mm-handle-set-undisplayer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
495 handle
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
496 `(lambda ()
92774
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
497 (let ((inhibit-read-only t))
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
498 (delete-region ,(copy-marker b)
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
499 ,(copy-marker (point))))))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
500
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
501 (defun mm-inline-audio (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
502 (message "Not implemented"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
503
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
504 (defun mm-view-sound-file ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
505 (message "Not implemented"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
506
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
507 (defun mm-w3-prepare-buffer ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
508 (require 'w3)
43166
aa31e3865857 * gnus-art.el (article-wash-html): Bind url-gateway-unplugged.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 41829
diff changeset
509 (let ((url-standalone-mode t)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
510 (url-gateway-unplugged t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
511 (w3-honor-stylesheets nil))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
512 (w3-prepare-buffer)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
513
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
514 (defun mm-view-message ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
515 (mm-enable-multibyte)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
516 (let (handles)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
517 (let (gnus-article-mime-handles)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
518 ;; Double decode problem may happen. See mm-inline-message.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
519 (run-hooks 'gnus-article-decode-hook)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
520 (gnus-article-prepare-display)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
521 (setq handles gnus-article-mime-handles))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
522 (when handles
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
523 (setq gnus-article-mime-handles
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
524 (mm-merge-handles gnus-article-mime-handles handles))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
525 (fundamental-mode)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
526 (goto-char (point-min)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
527
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
528 (defun mm-inline-message (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
529 (let ((b (point))
41829
b4833df45a4c 2001-12-05 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 38635
diff changeset
530 (bolp (bolp))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
531 (charset (mail-content-type-get
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
532 (mm-handle-type handle) 'charset))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
533 gnus-displaying-mime handles)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
534 (when (and charset
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
535 (stringp charset))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
536 (setq charset (intern (downcase charset)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
537 (when (eq charset 'us-ascii)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
538 (setq charset nil)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
539 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
540 (save-restriction
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
541 (narrow-to-region b b)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
542 (mm-insert-part handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
543 (let (gnus-article-mime-handles
41829
b4833df45a4c 2001-12-05 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 38635
diff changeset
544 ;; disable prepare hook
b4833df45a4c 2001-12-05 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 38635
diff changeset
545 gnus-article-prepare-hook
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
546 (gnus-newsgroup-charset
68762
970bf6e6463b Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents: 68380
diff changeset
547 (unless (eq charset 'gnus-decoded) ;; mm-uu might set it.
970bf6e6463b Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents: 68380
diff changeset
548 (or charset gnus-newsgroup-charset))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
549 (let ((gnus-original-article-buffer (mm-handle-buffer handle)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
550 (run-hooks 'gnus-article-decode-hook))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
551 (gnus-article-prepare-display)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
552 (setq handles gnus-article-mime-handles))
41829
b4833df45a4c 2001-12-05 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 38635
diff changeset
553 (goto-char (point-min))
b4833df45a4c 2001-12-05 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 38635
diff changeset
554 (unless bolp
b4833df45a4c 2001-12-05 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 38635
diff changeset
555 (insert "\n"))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
556 (goto-char (point-max))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
557 (unless (bolp)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
558 (insert "\n"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
559 (insert "----------\n\n")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
560 (when handles
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
561 (setq gnus-article-mime-handles
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
562 (mm-merge-handles gnus-article-mime-handles handles)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
563 (mm-handle-set-undisplayer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
564 handle
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
565 `(lambda ()
92774
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
566 (let ((inhibit-read-only t))
33329
71ce9ad48432 Use featurep for XEmacs test.
Dave Love <fx@gnu.org>
parents: 31764
diff changeset
567 (if (fboundp 'remove-specifier)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
568 ;; This is only valid on XEmacs.
92774
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
569 (dolist (prop '(background background-pixmap foreground))
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
570 (remove-specifier
3035f32851cf Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92694
diff changeset
571 (face-property 'default prop) (current-buffer))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
572 (delete-region ,(point-min-marker) ,(point-max-marker)))))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
573
31764
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
574 (defun mm-display-inline-fontify (handle mode)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
575 (let ((charset (mail-content-type-get (mm-handle-type handle) 'charset))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
576 text coding-system)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
577 (unless (eq charset 'gnus-decoded)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
578 (mm-with-unibyte-buffer
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
579 (mm-insert-part handle)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
580 (mm-decompress-buffer
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
581 (or (mail-content-type-get (mm-handle-disposition handle) 'name)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
582 (mail-content-type-get (mm-handle-disposition handle) 'filename))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
583 t t)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
584 (unless charset
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
585 (setq coding-system (mm-find-buffer-file-coding-system)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
586 (setq text (buffer-string))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
587 ;; XEmacs @#$@ version of font-lock refuses to fully turn itself
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
588 ;; on for buffers whose name begins with " ". That's why we use
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
589 ;; `with-current-buffer'/`generate-new-buffer' rather than
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
590 ;; `with-temp-buffer'.
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
591 (with-current-buffer (generate-new-buffer "*fontification*")
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
592 (buffer-disable-undo)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
593 (mm-enable-multibyte)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
594 (insert (cond ((eq charset 'gnus-decoded)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
595 (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
596 (buffer-string)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
597 (coding-system
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
598 (mm-decode-coding-string text coding-system))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
599 (charset
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
600 (mm-decode-string text charset))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
601 (t
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
602 text)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
603 (require 'font-lock)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
604 (let ((font-lock-maximum-size nil)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
605 ;; Disable support modes, e.g., jit-lock, lazy-lock, etc.
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
606 (font-lock-mode-hook nil)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
607 (font-lock-support-mode nil)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
608 ;; I find font-lock a bit too verbose.
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
609 (font-lock-verbose nil))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
610 (funcall mode)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
611 ;; The mode function might have already turned on font-lock.
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
612 (unless (symbol-value 'font-lock-mode)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
613 (font-lock-fontify-buffer)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
614 ;; By default, XEmacs font-lock uses non-duplicable text
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
615 ;; properties. This code forces all the text properties
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
616 ;; to be copied along with the text.
86154
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
617 (when (featurep 'xemacs)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
618 (map-extents (lambda (ext ignored)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
619 (set-extent-property ext 'duplicable t)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
620 nil)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
621 nil nil nil nil nil 'text-prop))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
622 (setq text (buffer-string))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
623 (kill-buffer (current-buffer)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
624 (mm-insert-inline handle text)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
625
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
626 ;; Shouldn't these functions check whether the user even wants to use
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
627 ;; font-lock? At least under XEmacs, this fontification is pretty
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
628 ;; much unconditional. Also, it would be nice to change for the size
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
629 ;; of the fontified region.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
630
31764
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
631 (defun mm-display-patch-inline (handle)
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
632 (mm-display-inline-fontify handle 'diff-mode))
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
633
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
634 (defun mm-display-elisp-inline (handle)
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
635 (mm-display-inline-fontify handle 'emacs-lisp-mode))
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
636
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
637 (defun mm-display-dns-inline (handle)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
638 (mm-display-inline-fontify handle 'dns-mode))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
639
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
640 ;; id-signedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
641 ;; us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 }
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
642 (defvar mm-pkcs7-signed-magic
98344
7fa3e064d230 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95820
diff changeset
643 "\x30\x5c\x28\x80\x5c\x7c\x81\x2e\x5c\x7c\x82\x2e\x2e\x5c\x7c\x83\x2e\x2e\
7fa3e064d230 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95820
diff changeset
644 \x2e\x5c\x29\x06\x09\x5c\x2a\x86\x48\x86\xf7\x0d\x01\x07\x02")
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
645
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
646 ;; id-envelopedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
647 ;; us(840) rsadsi(113549) pkcs(1) pkcs7(7) 3 }
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
648 (defvar mm-pkcs7-enveloped-magic
98344
7fa3e064d230 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95820
diff changeset
649 "\x30\x5c\x28\x80\x5c\x7c\x81\x2e\x5c\x7c\x82\x2e\x2e\x5c\x7c\x83\x2e\x2e\
7fa3e064d230 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95820
diff changeset
650 \x2e\x5c\x29\x06\x09\x5c\x2a\x86\x48\x86\xf7\x0d\x01\x07\x03")
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
651
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
652 (defun mm-view-pkcs7-get-type (handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
653 (mm-with-unibyte-buffer
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
654 (mm-insert-part handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
655 (cond ((looking-at mm-pkcs7-enveloped-magic)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
656 'enveloped)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
657 ((looking-at mm-pkcs7-signed-magic)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
658 'signed)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
659 (t
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
660 (error "Could not identify PKCS#7 type")))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
661
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
662 (defun mm-view-pkcs7 (handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
663 (case (mm-view-pkcs7-get-type handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
664 (enveloped (mm-view-pkcs7-decrypt handle))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
665 (signed (mm-view-pkcs7-verify handle))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
666 (otherwise (error "Unknown or unimplemented PKCS#7 type"))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
667
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
668 (defun mm-view-pkcs7-verify (handle)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
669 (let ((verified nil))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
670 (with-temp-buffer
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
671 (insert "MIME-Version: 1.0\n")
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
672 (mm-insert-headers "application/pkcs7-mime" "base64" "smime.p7m")
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
673 (insert-buffer-substring (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
674 (setq verified (smime-verify-region (point-min) (point-max))))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
675 (goto-char (point-min))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
676 (mm-insert-part handle)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
677 (if (search-forward "Content-Type: " nil t)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
678 (delete-region (point-min) (match-beginning 0)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
679 (goto-char (point-max))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
680 (if (re-search-backward "--\r?\n?" nil t)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
681 (delete-region (match-end 0) (point-max)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
682 (unless verified
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
683 (insert-buffer-substring smime-details-buffer)))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
684 (goto-char (point-min))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
685 (while (search-forward "\r\n" nil t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
686 (replace-match "\n"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
687 t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
688
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
689 (defun mm-view-pkcs7-decrypt (handle)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
690 (insert-buffer-substring (mm-handle-buffer handle))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
691 (goto-char (point-min))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
692 (insert "MIME-Version: 1.0\n")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
693 (mm-insert-headers "application/pkcs7-mime" "base64" "smime.p7m")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
694 (smime-decrypt-region
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
695 (point-min) (point-max)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
696 (if (= (length smime-keys) 1)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
697 (cadar smime-keys)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
698 (smime-get-key-by-email
110661
2b8ece636433 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
699 (gnus-completing-read
2b8ece636433 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
700 "Decipher using key"
2b8ece636433 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
701 smime-keys nil nil nil (car-safe (car-safe smime-keys))))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
702 (goto-char (point-min))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
703 (while (search-forward "\r\n" nil t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
704 (replace-match "\n"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
705 (goto-char (point-min)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 55680
diff changeset
706
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
707 (provide 'mm-view)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
708
38413
a26d9b55abb6 Some fixes to follow coding conventions in files from Gnus.
Pavel Janík <Pavel@Janik.cz>
parents: 33329
diff changeset
709 ;;; mm-view.el ends here