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