Mercurial > emacs
annotate lisp/gnus/mm-view.el @ 95625:ca7011bae7f9
(mail-interactive): Add :version.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 07 Jun 2008 02:40:47 +0000 |
parents | f42ef85caf91 |
children | 645fb33380d6 |
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 |
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64085
diff
changeset
|
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
79708 | 4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
31717 | 5 |
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> | |
7 ;; This file is part of GNU Emacs. | |
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 | 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 | 13 |
14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
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 | 17 ;; GNU General Public License for more details. |
18 | |
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 | 21 |
22 ;;; Commentary: | |
23 | |
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 | 27 (eval-when-compile (require 'cl)) |
28 (require 'mail-parse) | |
29 (require 'mailcap) | |
30 (require 'mm-bodies) | |
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 | 33 |
34 (eval-and-compile | |
35 (autoload 'gnus-article-prepare-display "gnus-art") | |
36 (autoload 'vcard-parse-string "vcard") | |
37 (autoload 'vcard-format-string "vcard") | |
38 (autoload 'fill-flowed "flow-fill") | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
39 (autoload 'html2text "html2text" nil t)) |
31717 | 40 |
65278
1c443c9ad5cf
(gnus-article-mime-handles, gnus-newsgroup-charset, smime-keys,
Juanma Barranquero <lekktu@gmail.com>
parents:
64754
diff
changeset
|
41 (defvar gnus-article-mime-handles) |
1c443c9ad5cf
(gnus-article-mime-handles, gnus-newsgroup-charset, smime-keys,
Juanma Barranquero <lekktu@gmail.com>
parents:
64754
diff
changeset
|
42 (defvar gnus-newsgroup-charset) |
1c443c9ad5cf
(gnus-article-mime-handles, gnus-newsgroup-charset, smime-keys,
Juanma Barranquero <lekktu@gmail.com>
parents:
64754
diff
changeset
|
43 (defvar smime-keys) |
1c443c9ad5cf
(gnus-article-mime-handles, gnus-newsgroup-charset, smime-keys,
Juanma Barranquero <lekktu@gmail.com>
parents:
64754
diff
changeset
|
44 (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
|
45 (defvar w3m-current-buffer) |
1c443c9ad5cf
(gnus-article-mime-handles, gnus-newsgroup-charset, smime-keys,
Juanma Barranquero <lekktu@gmail.com>
parents:
64754
diff
changeset
|
46 (defvar w3m-display-inline-images) |
1c443c9ad5cf
(gnus-article-mime-handles, gnus-newsgroup-charset, smime-keys,
Juanma Barranquero <lekktu@gmail.com>
parents:
64754
diff
changeset
|
47 (defvar w3m-minor-mode-map) |
1c443c9ad5cf
(gnus-article-mime-handles, gnus-newsgroup-charset, smime-keys,
Juanma Barranquero <lekktu@gmail.com>
parents:
64754
diff
changeset
|
48 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
49 (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
|
50 '((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
|
51 (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
|
52 (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
|
53 (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
|
54 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
|
55 "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
|
56 (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
|
57 "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
|
58 (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
|
59 "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
|
60 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
61 (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
|
62 '((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
|
63 (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
|
64 (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
|
65 (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
|
66 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
|
67 "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
|
68 (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
|
69 "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
|
70 (html2text html2text)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
71 "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
|
72 |
69135
12d289b6e5de
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-118
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
73 (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
|
74 "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
|
75 :type 'boolean |
12d289b6e5de
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-118
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
76 :version "22.1" |
12d289b6e5de
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-118
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
77 :group 'mime-display) |
12d289b6e5de
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-118
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
78 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
79 ;;; Internal variables. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
80 |
31717 | 81 ;;; |
82 ;;; Functions for displaying various formats inline | |
83 ;;; | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
84 |
31717 | 85 (defun mm-inline-image-emacs (handle) |
86 (let ((b (point-marker)) | |
92774
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
87 (inhibit-read-only t)) |
31717 | 88 (put-image (mm-get-image handle) b) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
89 (insert "\n\n") |
31717 | 90 (mm-handle-set-undisplayer |
91 handle | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
92 `(lambda () |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
93 (let ((b ,b) |
92774
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
94 (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
|
95 (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
|
96 (delete-region b (+ b 2))))))) |
31717 | 97 |
98 (defun mm-inline-image-xemacs (handle) | |
86154 | 99 (when (featurep 'xemacs) |
100 (insert "\n\n") | |
101 (forward-char -2) | |
102 (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
|
103 (inhibit-read-only t)) |
86154 | 104 (mm-handle-set-undisplayer |
105 handle | |
106 `(lambda () | |
107 (let ((b ,(point-marker)) | |
92774
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
108 (inhibit-read-only t)) |
86154 | 109 (delete-annotation ,annot) |
110 (delete-region (- b 2) b)))) | |
111 (set-extent-property annot 'mm t) | |
112 (set-extent-property annot 'duplicable t)))) | |
31717 | 113 |
114 (eval-and-compile | |
33329 | 115 (if (featurep 'xemacs) |
31717 | 116 (defalias 'mm-inline-image 'mm-inline-image-xemacs) |
117 (defalias 'mm-inline-image 'mm-inline-image-emacs))) | |
118 | |
87192
4b72ecd263bd
(declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents:
86154
diff
changeset
|
119 ;; External. |
4b72ecd263bd
(declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents:
86154
diff
changeset
|
120 (declare-function w3-do-setup "ext:w3" ()) |
4b72ecd263bd
(declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents:
86154
diff
changeset
|
121 (declare-function w3-region "ext:w3-display" (st nd)) |
4b72ecd263bd
(declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents:
86154
diff
changeset
|
122 (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
|
123 |
31717 | 124 (defvar mm-w3-setup nil) |
125 (defun mm-setup-w3 () | |
126 (unless mm-w3-setup | |
127 (require 'w3) | |
128 (w3-do-setup) | |
129 (require 'url) | |
130 (require 'w3-vars) | |
131 (require 'url-vars) | |
132 (setq mm-w3-setup t))) | |
133 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
134 (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
|
135 (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
|
136 (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
|
137 (b (point)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
138 (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
|
139 (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
|
140 (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
|
141 (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
|
142 (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
|
143 (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
|
144 (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
|
145 (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
|
146 (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
|
147 (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
|
148 (save-restriction |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
149 (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
|
150 (unless charset |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
151 (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
|
152 (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
|
153 (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
|
154 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
|
155 (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
|
156 (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
|
157 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
|
158 (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
|
159 (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
|
160 (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
|
161 (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
|
162 (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
|
163 (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
|
164 (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
|
165 (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
|
166 (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
|
167 (save-window-excursion |
31717 | 168 (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
|
169 (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
|
170 ;; 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
|
171 ;; this variable. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
172 (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
|
173 (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
|
174 (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
|
175 (condition-case () |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
176 (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
|
177 (error |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
178 (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
|
179 (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
|
180 (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
|
181 (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
|
182 (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
|
183 (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
|
184 (save-restriction |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
185 (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
|
186 (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
|
187 (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
|
188 (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
|
189 charset)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
190 (message |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
191 "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
|
192 (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
|
193 handle |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
194 `(lambda () |
92774
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
195 (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
|
196 ,@(if (functionp 'remove-specifier) |
92774
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
197 '((dolist (prop '(background background-pixmap foreground)) |
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
198 (remove-specifier |
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
199 (face-property 'default prop) |
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
200 (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
|
201 (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
|
202 ,(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
|
203 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
204 (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
|
205 "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
|
206 |
87192
4b72ecd263bd
(declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents:
86154
diff
changeset
|
207 ;; External. |
4b72ecd263bd
(declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents:
86154
diff
changeset
|
208 (declare-function w3m-detect-meta-charset "ext:w3m" ()) |
4b72ecd263bd
(declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents:
86154
diff
changeset
|
209 (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
|
210 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
211 (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
|
212 "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
|
213 (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
|
214 (require 'w3m) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
215 (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
|
216 (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
|
217 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
|
218 (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
|
219 (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
|
220 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
221 (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
|
222 (dolist (elem handle) |
69304
55d8c694b9cf
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents:
69135
diff
changeset
|
223 (when (consp elem) |
55d8c694b9cf
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents:
69135
diff
changeset
|
224 (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
|
225 (mm-insert-part elem) |
55d8c694b9cf
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents:
69135
diff
changeset
|
226 (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
|
227 (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
|
228 (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
|
229 (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
|
230 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
231 (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
|
232 "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
|
233 (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
|
234 (or (catch 'found-handle |
55d8c694b9cf
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents:
69135
diff
changeset
|
235 (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
|
236 (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
|
237 (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
|
238 gnus-article-mime-handles))) |
55d8c694b9cf
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents:
69135
diff
changeset
|
239 (prog1 |
55d8c694b9cf
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents:
69135
diff
changeset
|
240 nil |
55d8c694b9cf
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-139
Miles Bader <miles@gnu.org>
parents:
69135
diff
changeset
|
241 (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
|
242 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
243 (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
|
244 "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
|
245 (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
|
246 (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
|
247 (b (point)) |
77309 | 248 (charset (or (mail-content-type-get (mm-handle-type handle) 'charset) |
249 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
|
250 (save-excursion |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
251 (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
|
252 (save-restriction |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
253 (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
|
254 (unless charset |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
255 (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
|
256 (when (setq charset (w3m-detect-meta-charset)) |
31717 | 257 (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
|
258 (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
|
259 (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
|
260 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
|
261 (w3m-region (point-min) (point-max) nil charset)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
262 (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
|
263 (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
|
264 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
|
265 (add-text-properties |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
266 (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
|
267 (list 'keymap 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
|
268 ;; Put the mark meaning this part was rendered by emacs-w3m. |
67418
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
65719
diff
changeset
|
269 'mm-inline-text-html-with-w3m t))) |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
65719
diff
changeset
|
270 (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
|
271 handle |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
65719
diff
changeset
|
272 `(lambda () |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
273 (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
|
274 (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
|
275 ,(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
|
276 |
68380
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
277 (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
|
278 "*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
|
279 |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
280 (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
|
281 "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
|
282 (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
|
283 ((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
|
284 ((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
|
285 ((condition-case nil |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
286 (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
|
287 (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
|
288 (str (mm-decode-coding-string "\ |
92694 | 289 \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
|
290 (mm-with-multibyte-buffer |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
291 (insert str) |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
292 (call-process-region |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
293 (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
|
294 "-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
|
295 (goto-char (point-min)) |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
296 (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
|
297 (error nil)) |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
298 (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
|
299 (t |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
300 ;;(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
|
301 (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
|
302 |
68207
fbd379b34f0a
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-698
Miles Bader <miles@gnu.org>
parents:
67418
diff
changeset
|
303 (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
|
304 "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
|
305 (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
|
306 (let ((source (mm-get-part handle)) |
77309 | 307 (charset (or (mail-content-type-get (mm-handle-type handle) |
308 'charset) | |
309 (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
|
310 cs) |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
311 (unless (and charset |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
312 (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
|
313 (not (eq cs 'ascii))) |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
314 ;; The default. |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
315 (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
|
316 cs 'iso-8859-1)) |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
317 (mm-insert-inline |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
318 handle |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
319 (mm-with-unibyte-buffer |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
320 (insert source) |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
321 (mm-enable-multibyte) |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
322 (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
|
323 (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
|
324 (call-process-region |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
325 (point-min) (point-max) |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
326 "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
|
327 "-I" charset "-O" charset)) |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
328 (buffer-string)))) |
e1843613ecb8
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-14
Miles Bader <miles@gnu.org>
parents:
68230
diff
changeset
|
329 (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
|
330 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
331 (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
|
332 ;; 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
|
333 ;; output. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
334 (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
|
335 (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
|
336 (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
|
337 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
338 (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
|
339 (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
|
340 (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
|
341 (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
|
342 (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
|
343 (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
|
344 (unwind-protect |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
345 (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
|
346 (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
|
347 (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
|
348 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
349 (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
|
350 (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
|
351 (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
|
352 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
|
353 (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
|
354 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
355 (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
|
356 (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
|
357 (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
|
358 handle |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
359 (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
|
360 (insert source) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
361 (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
|
362 (buffer-string))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
363 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
364 (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
|
365 (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
|
366 (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
|
367 handle |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
368 (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
|
369 (insert source) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
370 (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
|
371 (buffer-string))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
372 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
373 (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
|
374 (let ((source (mm-get-part handle)) |
77309 | 375 (charset (or (mail-content-type-get (mm-handle-type handle) 'charset) |
376 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
|
377 (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
|
378 handle |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
379 (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
|
380 (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
|
381 (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
|
382 source)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
383 (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
|
384 (buffer-string))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
385 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
386 (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
|
387 (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
|
388 (entry (assq func mm-text-html-renderer-alist)) |
92774
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
389 (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
|
390 (if entry |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
391 (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
|
392 (cond |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
393 ((functionp func) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
394 (funcall func handle)) |
31717 | 395 (t |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
396 (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
|
397 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
398 (defun mm-inline-text-vcard (handle) |
92774
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
399 (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
|
400 (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
|
401 handle |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
402 (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
|
403 (ignore-errors |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
404 (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
|
405 (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
|
406 (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
|
407 (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
|
408 '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
|
409 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
410 (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
|
411 (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
|
412 (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
|
413 (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
|
414 (mm-handle-type handle) 'charset)) |
92774
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
415 (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
|
416 (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
|
417 ;; 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
|
418 ;; 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
|
419 (eq mail-parse-charset 'gnus-decoded)) |
31717 | 420 (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
|
421 (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
|
422 (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
|
423 (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
|
424 (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
|
425 (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
|
426 (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
|
427 (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
|
428 "flowed")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
429 (save-restriction |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
430 (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
|
431 (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
|
432 (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
|
433 "yes")) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
434 (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
|
435 (save-restriction |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
436 (narrow-to-region b (point)) |
92774
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
437 (when (member type '("enriched" "richtext")) |
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
438 (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
|
439 (ignore-errors |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
440 (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
|
441 (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
|
442 handle |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
443 `(lambda () |
92774
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
444 (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
|
445 (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
|
446 ,(point-max-marker)))))))) |
31717 | 447 |
448 (defun mm-insert-inline (handle text) | |
449 "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
|
450 (let ((b (point))) |
31717 | 451 (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
|
452 (unless (bolp) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
453 (insert "\n")) |
31717 | 454 (mm-handle-set-undisplayer |
455 handle | |
456 `(lambda () | |
92774
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
457 (let ((inhibit-read-only t)) |
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
458 (delete-region ,(copy-marker b) |
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
459 ,(copy-marker (point)))))))) |
31717 | 460 |
461 (defun mm-inline-audio (handle) | |
462 (message "Not implemented")) | |
463 | |
464 (defun mm-view-sound-file () | |
465 (message "Not implemented")) | |
466 | |
467 (defun mm-w3-prepare-buffer () | |
468 (require 'w3) | |
43166
aa31e3865857
* gnus-art.el (article-wash-html): Bind url-gateway-unplugged.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41829
diff
changeset
|
469 (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
|
470 (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
|
471 (w3-honor-stylesheets nil)) |
31717 | 472 (w3-prepare-buffer))) |
473 | |
474 (defun mm-view-message () | |
475 (mm-enable-multibyte) | |
476 (let (handles) | |
477 (let (gnus-article-mime-handles) | |
478 ;; Double decode problem may happen. See mm-inline-message. | |
479 (run-hooks 'gnus-article-decode-hook) | |
480 (gnus-article-prepare-display) | |
481 (setq handles gnus-article-mime-handles)) | |
482 (when handles | |
483 (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
|
484 (mm-merge-handles gnus-article-mime-handles handles)))) |
31717 | 485 (fundamental-mode) |
486 (goto-char (point-min))) | |
487 | |
488 (defun mm-inline-message (handle) | |
489 (let ((b (point)) | |
41829
b4833df45a4c
2001-12-05 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38635
diff
changeset
|
490 (bolp (bolp)) |
31717 | 491 (charset (mail-content-type-get |
492 (mm-handle-type handle) 'charset)) | |
493 gnus-displaying-mime handles) | |
494 (when (and charset | |
495 (stringp charset)) | |
496 (setq charset (intern (downcase charset))) | |
497 (when (eq charset 'us-ascii) | |
498 (setq charset nil))) | |
499 (save-excursion | |
500 (save-restriction | |
501 (narrow-to-region b b) | |
502 (mm-insert-part handle) | |
503 (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
|
504 ;; disable prepare hook |
b4833df45a4c
2001-12-05 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38635
diff
changeset
|
505 gnus-article-prepare-hook |
31717 | 506 (gnus-newsgroup-charset |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68380
diff
changeset
|
507 (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
|
508 (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
|
509 (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
|
510 (run-hooks 'gnus-article-decode-hook)) |
31717 | 511 (gnus-article-prepare-display) |
512 (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
|
513 (goto-char (point-min)) |
b4833df45a4c
2001-12-05 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38635
diff
changeset
|
514 (unless bolp |
b4833df45a4c
2001-12-05 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38635
diff
changeset
|
515 (insert "\n")) |
31717 | 516 (goto-char (point-max)) |
517 (unless (bolp) | |
518 (insert "\n")) | |
519 (insert "----------\n\n") | |
520 (when handles | |
521 (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
|
522 (mm-merge-handles gnus-article-mime-handles handles))) |
31717 | 523 (mm-handle-set-undisplayer |
524 handle | |
525 `(lambda () | |
92774
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
526 (let ((inhibit-read-only t)) |
33329 | 527 (if (fboundp 'remove-specifier) |
31717 | 528 ;; This is only valid on XEmacs. |
92774
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
529 (dolist (prop '(background background-pixmap foreground)) |
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
530 (remove-specifier |
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
531 (face-property 'default prop) (current-buffer)))) |
31717 | 532 (delete-region ,(point-min-marker) ,(point-max-marker))))))))) |
533 | |
31764 | 534 (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
|
535 (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
|
536 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
|
537 (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
|
538 (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
|
539 (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
|
540 (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
|
541 (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
|
542 (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
|
543 t t) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
544 (unless charset |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
545 (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
|
546 (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
|
547 ;; 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
|
548 ;; 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
|
549 ;; `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
|
550 ;; `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
|
551 (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
|
552 (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
|
553 (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
|
554 (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
|
555 (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
|
556 (buffer-string))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
557 (coding-system |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
558 (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
|
559 (charset |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
560 (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
|
561 (t |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
562 text))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
563 (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
|
564 (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
|
565 ;; 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
|
566 (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
|
567 (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
|
568 ;; 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
|
569 (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
|
570 (funcall mode) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
571 ;; 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
|
572 (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
|
573 (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
|
574 ;; 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
|
575 ;; 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
|
576 ;; to be copied along with the text. |
86154 | 577 (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
|
578 (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
|
579 (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
|
580 nil) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
581 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
|
582 (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
|
583 (kill-buffer (current-buffer))) |
31717 | 584 (mm-insert-inline handle text))) |
585 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
586 ;; 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
|
587 ;; 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
|
588 ;; 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
|
589 ;; 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
|
590 |
31764 | 591 (defun mm-display-patch-inline (handle) |
592 (mm-display-inline-fontify handle 'diff-mode)) | |
593 | |
594 (defun mm-display-elisp-inline (handle) | |
595 (mm-display-inline-fontify handle 'emacs-lisp-mode)) | |
596 | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
597 (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
|
598 (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
|
599 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
600 ;; 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
|
601 ;; 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
|
602 (defvar mm-pkcs7-signed-magic |
92774
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
603 (funcall (if (fboundp 'unibyte-string) 'unibyte-string 'string) |
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
604 ?\x30 ?\x5c ?\x28 ?\x80 ?\x5c ?\x7c ?\x81 ?\x2e ?\x5c |
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
605 ?\x7c ?\x82 ?\x2e ?\x2e ?\x5c ?\x7c ?\x83 ?\x2e ?\x2e |
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
606 ?\x2e ?\x5c ?\x29 ?\x06 ?\x09 ?\x5c ?\x2a ?\x86 ?\x48 |
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
607 ?\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
|
608 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
609 ;; 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
|
610 ;; 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
|
611 (defvar mm-pkcs7-enveloped-magic |
92774
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
612 (funcall (if (fboundp 'unibyte-string) 'unibyte-string 'string) |
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
613 ?\x30 ?\x5c ?\x28 ?\x80 ?\x5c ?\x7c ?\x81 ?\x2e ?\x5c |
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
614 ?\x7c ?\x82 ?\x2e ?\x2e ?\x5c ?\x7c ?\x83 ?\x2e ?\x2e |
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
615 ?\x2e ?\x5c ?\x29 ?\x06 ?\x09 ?\x5c ?\x2a ?\x86 ?\x48 |
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
616 ?\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
|
617 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
618 (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
|
619 (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
|
620 (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
|
621 (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
|
622 'enveloped) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
623 ((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
|
624 'signed) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
625 (t |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
626 (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
|
627 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
628 (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
|
629 (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
|
630 (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
|
631 (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
|
632 (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
|
633 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
634 (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
|
635 (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
|
636 (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
|
637 (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
|
638 (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
|
639 (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
|
640 (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
|
641 (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
|
642 (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
|
643 (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
|
644 (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
|
645 (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
|
646 (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
|
647 (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
|
648 (unless verified |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
649 (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
|
650 (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
|
651 (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
|
652 (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
|
653 t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
654 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
655 (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
|
656 (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
|
657 (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
|
658 (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
|
659 (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
|
660 (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
|
661 (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
|
662 (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
|
663 (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
|
664 (smime-get-key-by-email |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
665 (completing-read |
65682
c16795de963a
2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents:
65388
diff
changeset
|
666 (concat "Decipher using key" |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
667 (if smime-keys (concat "(default " (caar smime-keys) "): ") |
65682
c16795de963a
2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents:
65388
diff
changeset
|
668 ": ")) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
669 smime-keys nil nil nil nil (car-safe (car-safe smime-keys)))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55680
diff
changeset
|
670 (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
|
671 (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
|
672 (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
|
673 (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
|
674 |
31717 | 675 (provide 'mm-view) |
676 | |
92774
3035f32851cf
Use inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92694
diff
changeset
|
677 ;; arch-tag: b60e749a-d05c-47f2-bccd-bdaa59327cb2 |
38413
a26d9b55abb6
Some fixes to follow coding conventions in files from Gnus.
Pavel Janík <Pavel@Janik.cz>
parents:
33329
diff
changeset
|
678 ;;; mm-view.el ends here |