annotate lisp/gnus/mm-view.el @ 82977:e300f00a427a

[ Merge from Gnus v5-10 branch. See the tags "gnus-5_10-pre-merge-josefsson" and "gnus-5_10-post-merge-josefsson". ] 2004-08-31 Simon Josefsson <jas@extundo.com> * rfc2231.el (rfc2231-parse-string): Restore whitespace syntax for ?* and ?\; (tiny patch). From Andreas Schwab <schwab@suse.de>. * ietf-drums.el (ietf-drums-syntax-table): Set syntax of ?* ?\; and ?\' to symbol instead of whitespace (tiny patch). From Andreas Schwab <schwab@suse.de>. 2004-08-31 Jesper Harder <harder@ifa.au.dk> * message.el (message-idna-to-ascii-rhs-1): Don't choke on invalid addresses. 2004-08-31 Reiner Steib <Reiner.Steib@gmx.de> * message.el (message-idna-to-ascii-rhs-1): Fix typo. 2004-08-31 Lars Magne Ingebrigtsen <larsi@gnus.org> * message.el (message-idna-to-ascii-rhs-1): Don't use equalp. 2004-08-31 Lars Magne Ingebrigtsen <larsi@gnus.org> * gnus-art.el (article-decode-idna-rhs): Don't use message-idna-inside-rhs-p. 2004-08-31 Lars Magne Ingebrigtsen <larsi@gnus.org> * message.el (message-idna-inside-rhs-p): Removed. (message-idna-to-ascii-rhs-1): Use proper address parsing.
author Reiner Steib <Reiner.Steib@gmx.de>
date Tue, 31 Aug 2004 15:38:25 +0000
parents 590114f9753d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38413
a26d9b55abb6 Some fixes to follow coding conventions in files from Gnus.
Pavel Janík <Pavel@Janik.cz>
parents: 33329
diff changeset
1 ;;; mm-view.el --- functions for viewing MIME objects
82975
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
2 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
3 ;; Free Software Foundation, Inc.
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
4
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
6 ;; This file is part of GNU Emacs.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
7
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8 ;; GNU Emacs is free software; you can redistribute it and/or modify
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9 ;; it under the terms of the GNU General Public License as published by
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10 ;; the Free Software Foundation; either version 2, or (at your option)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11 ;; any later version.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
12
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13 ;; GNU Emacs is distributed in the hope that it will be useful,
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16 ;; GNU General Public License for more details.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18 ;; You should have received a copy of the GNU General Public License
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19 ;; along with GNU Emacs; see the file COPYING. If not, write to the
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21 ;; Boston, MA 02111-1307, USA.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
23 ;;; Commentary:
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
25 ;;; Code:
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
26
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
27 (eval-when-compile (require 'cl))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28 (require 'mail-parse)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29 (require 'mailcap)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
30 (require 'mm-bodies)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31 (require 'mm-decode)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
32
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
33 (eval-and-compile
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
34 (autoload 'gnus-article-prepare-display "gnus-art")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
35 (autoload 'vcard-parse-string "vcard")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
36 (autoload 'vcard-format-string "vcard")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
37 (autoload 'fill-flowed "flow-fill")
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
38 (autoload 'html2text "html2text")
38635
b6a0070476c7 (autoload): Don't autoload `diff-mode' if it's
Gerd Moellmann <gerd@gnu.org>
parents: 38413
diff changeset
39 (unless (fboundp 'diff-mode)
b6a0070476c7 (autoload): Don't autoload `diff-mode' if it's
Gerd Moellmann <gerd@gnu.org>
parents: 38413
diff changeset
40 (autoload 'diff-mode "diff-mode" "" t nil)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
41
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
42 (defvar mm-text-html-renderer-alist
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
43 '((w3 . mm-inline-text-html-render-with-w3)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
44 (w3m . mm-inline-text-html-render-with-w3m)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
45 (w3m-standalone mm-inline-render-with-stdin nil
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
46 "w3m" "-dump" "-T" "text/html")
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
47 (links mm-inline-render-with-file
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
48 mm-links-remove-leading-blank
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
49 "links" "-dump" file)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
50 (lynx mm-inline-render-with-stdin nil
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
51 "lynx" "-dump" "-force_html" "-stdin" "-nolist")
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
52 (html2text mm-inline-render-with-function html2text))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
53 "The attributes of renderer types for text/html.")
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
54
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
55 (defvar mm-text-html-washer-alist
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
56 '((w3 . gnus-article-wash-html-with-w3)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
57 (w3m . gnus-article-wash-html-with-w3m)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
58 (w3m-standalone mm-inline-wash-with-stdin nil
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
59 "w3m" "-dump" "-T" "text/html")
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
60 (links mm-inline-wash-with-file
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
61 mm-links-remove-leading-blank
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
62 "links" "-dump" file)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
63 (lynx mm-inline-wash-with-stdin nil
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
64 "lynx" "-dump" "-force_html" "-stdin" "-nolist")
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
65 (html2text html2text))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
66 "The attributes of washer types for text/html.")
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
67
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
68 ;;; Internal variables.
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
69
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
70 ;;;
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
71 ;;; Functions for displaying various formats inline
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72 ;;;
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
73
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
74 (defun mm-inline-image-emacs (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
75 (let ((b (point-marker))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
76 buffer-read-only)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
77 (put-image (mm-get-image handle) b)
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
78 (insert "\n\n")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
79 (mm-handle-set-undisplayer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
80 handle
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
81 `(lambda ()
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
82 (let ((b ,b)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
83 buffer-read-only)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
84 (remove-images b b)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
85 (delete-region b (+ b 2)))))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
86
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
87 (defun mm-inline-image-xemacs (handle)
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
88 (insert "\n\n")
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
89 (forward-char -2)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
90 (let ((annot (make-annotation (mm-get-image handle) nil 'text))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
91 buffer-read-only)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
92 (mm-handle-set-undisplayer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
93 handle
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
94 `(lambda ()
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
95 (let ((b ,(point-marker))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
96 buffer-read-only)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
97 (delete-annotation ,annot)
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
98 (delete-region (- b 2) b))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
99 (set-extent-property annot 'mm t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
100 (set-extent-property annot 'duplicable t)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
102 (eval-and-compile
33329
71ce9ad48432 Use featurep for XEmacs test.
Dave Love <fx@gnu.org>
parents: 31764
diff changeset
103 (if (featurep 'xemacs)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
104 (defalias 'mm-inline-image 'mm-inline-image-xemacs)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
105 (defalias 'mm-inline-image 'mm-inline-image-emacs)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
106
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
107 (defvar mm-w3-setup nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
108 (defun mm-setup-w3 ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
109 (unless mm-w3-setup
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
110 (require 'w3)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
111 (w3-do-setup)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
112 (require 'url)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
113 (require 'w3-vars)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
114 (require 'url-vars)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
115 (setq mm-w3-setup t)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
116
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
117 (defun mm-inline-text-html-render-with-w3 (handle)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
118 (mm-setup-w3)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
119 (let ((text (mm-get-part handle))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
120 (b (point))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
121 (url-standalone-mode t)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
122 (url-gateway-unplugged t)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
123 (w3-honor-stylesheets nil)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
124 (url-current-object
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
125 (url-generic-parse-url (format "cid:%s" (mm-handle-id handle))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
126 (width (window-width))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
127 (charset (mail-content-type-get
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
128 (mm-handle-type handle) 'charset)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
129 (save-excursion
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
130 (insert text)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
131 (save-restriction
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
132 (narrow-to-region b (point))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
133 (goto-char (point-min))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
134 (if (or (and (boundp 'w3-meta-content-type-charset-regexp)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
135 (re-search-forward
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
136 w3-meta-content-type-charset-regexp nil t))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
137 (and (boundp 'w3-meta-charset-content-type-regexp)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
138 (re-search-forward
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
139 w3-meta-charset-content-type-regexp nil t)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
140 (setq charset
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
141 (or (let ((bsubstr (buffer-substring-no-properties
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
142 (match-beginning 2)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
143 (match-end 2))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
144 (if (fboundp 'w3-coding-system-for-mime-charset)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
145 (w3-coding-system-for-mime-charset bsubstr)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
146 (mm-charset-to-coding-system bsubstr)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
147 charset)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
148 (delete-region (point-min) (point-max))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
149 (insert (mm-decode-string text charset))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
150 (save-window-excursion
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
151 (save-restriction
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
152 (let ((w3-strict-width width)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
153 ;; Don't let w3 set the global version of
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
154 ;; this variable.
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
155 (fill-column fill-column))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
156 (if (or debug-on-error debug-on-quit)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
157 (w3-region (point-min) (point-max))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
158 (condition-case ()
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
159 (w3-region (point-min) (point-max))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
160 (error
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
161 (delete-region (point-min) (point-max))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
162 (let ((b (point))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
163 (charset (mail-content-type-get
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
164 (mm-handle-type handle) 'charset)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
165 (if (or (eq charset 'gnus-decoded)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
166 (eq mail-parse-charset 'gnus-decoded))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
167 (save-restriction
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
168 (narrow-to-region (point) (point))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
169 (mm-insert-part handle)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
170 (goto-char (point-max)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
171 (insert (mm-decode-string (mm-get-part handle)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
172 charset))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
173 (message
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
174 "Error while rendering html; showing as text/plain")))))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
175 (mm-handle-set-undisplayer
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
176 handle
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
177 `(lambda ()
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
178 (let (buffer-read-only)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
179 (if (functionp 'remove-specifier)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
180 (mapcar (lambda (prop)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
181 (remove-specifier
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
182 (face-property 'default prop)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
183 (current-buffer)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
184 '(background background-pixmap foreground)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
185 (delete-region ,(point-min-marker)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
186 ,(point-max-marker)))))))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
187
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
188 (defvar mm-w3m-setup nil
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
189 "Whether gnus-article-mode has been setup to use emacs-w3m.")
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
190
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
191 (defun mm-setup-w3m ()
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
192 "Setup gnus-article-mode to use emacs-w3m."
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
193 (unless mm-w3m-setup
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
194 (require 'w3m)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
195 (unless (assq 'gnus-article-mode w3m-cid-retrieve-function-alist)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
196 (push (cons 'gnus-article-mode 'mm-w3m-cid-retrieve)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
197 w3m-cid-retrieve-function-alist))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
198 (setq mm-w3m-setup t))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
199 (setq w3m-display-inline-images mm-inline-text-html-with-images))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
200
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
201 (defun mm-w3m-cid-retrieve-1 (url handle)
82975
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
202 (if (mm-multiple-handles handle)
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
203 (dolist (elem handle)
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
204 (mm-w3m-cid-retrieve-1 url elem))
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
205 (when (and (listp handle)
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
206 (equal url (mm-handle-id handle)))
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
207 (mm-insert-part handle)
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
208 (throw 'found-handle (mm-handle-media-type handle)))))
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
209
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
210 (defun mm-w3m-cid-retrieve (url &rest args)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
211 "Insert a content pointed by URL if it has the cid: scheme."
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
212 (when (string-match "\\`cid:" url)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
213 (catch 'found-handle
82975
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
214 (mm-w3m-cid-retrieve-1 (concat "<" (substring url (match-end 0)) ">")
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
215 (with-current-buffer w3m-current-buffer
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
216 gnus-article-mime-handles)))))
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
217
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
218 (defun mm-inline-text-html-render-with-w3m (handle)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
219 "Render a text/html part using emacs-w3m."
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
220 (mm-setup-w3m)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
221 (let ((text (mm-get-part handle))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
222 (b (point))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
223 (charset (mail-content-type-get (mm-handle-type handle) 'charset)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
224 (save-excursion
82975
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
225 (insert (if charset (mm-decode-string text charset) text))
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
226 (save-restriction
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
227 (narrow-to-region b (point))
82975
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
228 (unless charset
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
229 (goto-char (point-min))
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
230 (when (setq charset (w3m-detect-meta-charset))
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
231 (delete-region (point-min) (point-max))
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
232 (insert (mm-decode-string text charset))))
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
233 (let ((w3m-safe-url-regexp mm-w3m-safe-url-regexp)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
234 w3m-force-redisplay)
82975
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
235 (w3m-region (point-min) (point-max) nil charset))
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
236 (when (and mm-inline-text-html-with-w3m-keymap
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
237 (boundp 'w3m-minor-mode-map)
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
238 w3m-minor-mode-map)
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
239 (add-text-properties
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
240 (point-min) (point-max)
82975
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
241 (list 'keymap w3m-minor-mode-map
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
242 ;; Put the mark meaning this part was rendered by emacs-w3m.
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
243 'mm-inline-text-html-with-w3m t))))
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
244 (mm-handle-set-undisplayer
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
245 handle
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
246 `(lambda ()
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
247 (let (buffer-read-only)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
248 (if (functionp 'remove-specifier)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
249 (mapcar (lambda (prop)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
250 (remove-specifier
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
251 (face-property 'default prop)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
252 (current-buffer)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
253 '(background background-pixmap foreground)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
254 (delete-region ,(point-min-marker)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
255 ,(point-max-marker))))))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
256
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
257 (defun mm-links-remove-leading-blank ()
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
258 ;; Delete the annoying three spaces preceding each line of links
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
259 ;; output.
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
260 (goto-char (point-min))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
261 (while (re-search-forward "^ " nil t)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
262 (delete-region (match-beginning 0) (match-end 0))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
263
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
264 (defun mm-inline-wash-with-file (post-func cmd &rest args)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
265 (let ((file (mm-make-temp-file
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
266 (expand-file-name "mm" mm-tmp-directory))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
267 (let ((coding-system-for-write 'binary))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
268 (write-region (point-min) (point-max) file nil 'silent))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
269 (delete-region (point-min) (point-max))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
270 (unwind-protect
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
271 (apply 'call-process cmd nil t nil (mapcar 'eval args))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
272 (delete-file file))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
273 (and post-func (funcall post-func))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
274
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
275 (defun mm-inline-wash-with-stdin (post-func cmd &rest args)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
276 (let ((coding-system-for-write 'binary))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
277 (apply 'call-process-region (point-min) (point-max)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
278 cmd t t nil args))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
279 (and post-func (funcall post-func)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
280
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
281 (defun mm-inline-render-with-file (handle post-func cmd &rest args)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
282 (let ((source (mm-get-part handle)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
283 (mm-insert-inline
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
284 handle
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
285 (mm-with-unibyte-buffer
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
286 (insert source)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
287 (apply 'mm-inline-wash-with-file post-func cmd args)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
288 (buffer-string)))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
289
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
290 (defun mm-inline-render-with-stdin (handle post-func cmd &rest args)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
291 (let ((source (mm-get-part handle)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
292 (mm-insert-inline
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
293 handle
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
294 (mm-with-unibyte-buffer
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
295 (insert source)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
296 (apply 'mm-inline-wash-with-stdin post-func cmd args)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
297 (buffer-string)))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
298
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
299 (defun mm-inline-render-with-function (handle func &rest args)
82975
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
300 (let ((source (mm-get-part handle))
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
301 (charset (mail-content-type-get (mm-handle-type handle) 'charset)))
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
302 (mm-insert-inline
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
303 handle
82975
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
304 (mm-with-multibyte-buffer
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
305 (insert (if charset
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
306 (mm-decode-string source charset)
590114f9753d 2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org>
Reiner Steib <Reiner.Steib@gmx.de>
parents: 82951
diff changeset
307 source))
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
308 (apply func args)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
309 (buffer-string)))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
310
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
311 (defun mm-inline-text-html (handle)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
312 (let* ((func (or mm-inline-text-html-renderer mm-text-html-renderer))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
313 (entry (assq func mm-text-html-renderer-alist))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
314 buffer-read-only)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
315 (if entry
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
316 (setq func (cdr entry)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
317 (cond
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
318 ((functionp func)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
319 (funcall func handle))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
320 (t
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
321 (apply (car func) handle (cdr func))))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
322
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
323 (defun mm-inline-text-vcard (handle)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
324 (let (buffer-read-only)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
325 (mm-insert-inline
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
326 handle
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
327 (concat "\n-- \n"
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
328 (ignore-errors
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
329 (if (fboundp 'vcard-pretty-print)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
330 (vcard-pretty-print (mm-get-part handle))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
331 (vcard-format-string
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
332 (vcard-parse-string (mm-get-part handle)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
333 'vcard-standard-filter))))))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
334
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
335 (defun mm-inline-text (handle)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
336 (let ((b (point))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
337 (type (mm-handle-media-subtype handle))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
338 (charset (mail-content-type-get
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
339 (mm-handle-type handle) 'charset))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
340 buffer-read-only)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
341 (if (or (eq charset 'gnus-decoded)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
342 ;; This is probably not entirely correct, but
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
343 ;; makes rfc822 parts with embedded multiparts work.
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
344 (eq mail-parse-charset 'gnus-decoded))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
345 (save-restriction
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
346 (narrow-to-region (point) (point))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
347 (mm-insert-part handle)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
348 (goto-char (point-max)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
349 (insert (mm-decode-string (mm-get-part handle) charset)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
350 (when (and (equal type "plain")
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
351 (equal (cdr (assoc 'format (mm-handle-type handle)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
352 "flowed"))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
353 (save-restriction
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
354 (narrow-to-region b (point))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
355 (goto-char b)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
356 (fill-flowed)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
357 (goto-char (point-max))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
358 (save-restriction
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
359 (narrow-to-region b (point))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
360 (set-text-properties (point-min) (point-max) nil)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
361 (when (or (equal type "enriched")
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
362 (equal type "richtext"))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
363 (ignore-errors
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
364 (enriched-decode (point-min) (point-max))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
365 (mm-handle-set-undisplayer
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
366 handle
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
367 `(lambda ()
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
368 (let (buffer-read-only)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
369 (delete-region ,(point-min-marker)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
370 ,(point-max-marker))))))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
371
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
372 (defun mm-insert-inline (handle text)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
373 "Insert TEXT inline from HANDLE."
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
374 (let ((b (point)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
375 (insert text)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
376 (mm-handle-set-undisplayer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
377 handle
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
378 `(lambda ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
379 (let (buffer-read-only)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
380 (delete-region ,(set-marker (make-marker) b)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
381 ,(set-marker (make-marker) (point))))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
382
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
383 (defun mm-inline-audio (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
384 (message "Not implemented"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
385
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
386 (defun mm-view-sound-file ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
387 (message "Not implemented"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
388
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
389 (defun mm-w3-prepare-buffer ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
390 (require 'w3)
43166
aa31e3865857 * gnus-art.el (article-wash-html): Bind url-gateway-unplugged.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 41829
diff changeset
391 (let ((url-standalone-mode t)
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
392 (url-gateway-unplugged t)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
393 (w3-honor-stylesheets nil))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
394 (w3-prepare-buffer)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
395
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
396 (defun mm-view-message ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
397 (mm-enable-multibyte)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
398 (let (handles)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
399 (let (gnus-article-mime-handles)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
400 ;; Double decode problem may happen. See mm-inline-message.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
401 (run-hooks 'gnus-article-decode-hook)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
402 (gnus-article-prepare-display)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
403 (setq handles gnus-article-mime-handles))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
404 (when handles
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
405 (setq gnus-article-mime-handles
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
406 (mm-merge-handles gnus-article-mime-handles handles))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
407 (fundamental-mode)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
408 (goto-char (point-min)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
409
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
410 (defun mm-inline-message (handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
411 (let ((b (point))
41829
b4833df45a4c 2001-12-05 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 38635
diff changeset
412 (bolp (bolp))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
413 (charset (mail-content-type-get
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
414 (mm-handle-type handle) 'charset))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
415 gnus-displaying-mime handles)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
416 (when (and charset
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
417 (stringp charset))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
418 (setq charset (intern (downcase charset)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
419 (when (eq charset 'us-ascii)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
420 (setq charset nil)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
421 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
422 (save-restriction
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
423 (narrow-to-region b b)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
424 (mm-insert-part handle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
425 (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
426 ;; disable prepare hook
b4833df45a4c 2001-12-05 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 38635
diff changeset
427 gnus-article-prepare-hook
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
428 (gnus-newsgroup-charset
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
429 (or charset gnus-newsgroup-charset)))
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
430 (let ((gnus-original-article-buffer (mm-handle-buffer handle)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
431 (run-hooks 'gnus-article-decode-hook))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
432 (gnus-article-prepare-display)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
433 (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
434 (goto-char (point-min))
b4833df45a4c 2001-12-05 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 38635
diff changeset
435 (unless bolp
b4833df45a4c 2001-12-05 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 38635
diff changeset
436 (insert "\n"))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
437 (goto-char (point-max))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
438 (unless (bolp)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
439 (insert "\n"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
440 (insert "----------\n\n")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
441 (when handles
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
442 (setq gnus-article-mime-handles
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
443 (mm-merge-handles gnus-article-mime-handles handles)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
444 (mm-handle-set-undisplayer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
445 handle
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
446 `(lambda ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
447 (let (buffer-read-only)
33329
71ce9ad48432 Use featurep for XEmacs test.
Dave Love <fx@gnu.org>
parents: 31764
diff changeset
448 (if (fboundp 'remove-specifier)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
449 ;; This is only valid on XEmacs.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
450 (mapcar (lambda (prop)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
451 (remove-specifier
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
452 (face-property 'default prop) (current-buffer)))
33329
71ce9ad48432 Use featurep for XEmacs test.
Dave Love <fx@gnu.org>
parents: 31764
diff changeset
453 '(background background-pixmap foreground)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
454 (delete-region ,(point-min-marker) ,(point-max-marker)))))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
455
31764
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
456 (defun mm-display-inline-fontify (handle mode)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
457 (let (text)
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
458 ;; XEmacs @#$@ version of font-lock refuses to fully turn itself
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
459 ;; on for buffers whose name begins with " ". That's why we use
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
460 ;; save-current-buffer/get-buffer-create rather than
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
461 ;; with-temp-buffer.
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
462 (save-current-buffer
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
463 (set-buffer (generate-new-buffer "*fontification*"))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
464 (unwind-protect
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
465 (progn
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
466 (buffer-disable-undo)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
467 (mm-insert-part handle)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
468 (funcall mode)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
469 (require 'font-lock)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
470 (let ((font-lock-verbose nil))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
471 ;; I find font-lock a bit too verbose.
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
472 (font-lock-fontify-buffer))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
473 ;; By default, XEmacs font-lock uses non-duplicable text
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
474 ;; properties. This code forces all the text properties
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
475 ;; to be copied along with the text.
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
476 (when (fboundp 'extent-list)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
477 (map-extents (lambda (ext ignored)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
478 (set-extent-property ext 'duplicable t)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
479 nil)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
480 nil nil nil nil nil 'text-prop))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
481 (setq text (buffer-string)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
482 (kill-buffer (current-buffer))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
483 (mm-insert-inline handle text)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
484
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
485 ;; Shouldn't these functions check whether the user even wants to use
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
486 ;; font-lock? At least under XEmacs, this fontification is pretty
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
487 ;; much unconditional. Also, it would be nice to change for the size
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
488 ;; of the fontified region.
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
489
31764
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
490 (defun mm-display-patch-inline (handle)
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
491 (mm-display-inline-fontify handle 'diff-mode))
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
492
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
493 (defun mm-display-elisp-inline (handle)
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
494 (mm-display-inline-fontify handle 'emacs-lisp-mode))
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
495
82951
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
496 ;; id-signedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
497 ;; us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 }
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
498 (defvar mm-pkcs7-signed-magic
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
499 (mm-string-as-unibyte
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
500 (apply 'concat
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
501 (mapcar 'char-to-string
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
502 (list ?\x30 ?\x5c ?\x28 ?\x80 ?\x5c ?\x7c ?\x81 ?\x2e ?\x5c
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
503 ?\x7c ?\x82 ?\x2e ?\x2e ?\x5c ?\x7c ?\x83 ?\x2e ?\x2e
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
504 ?\x2e ?\x5c ?\x29 ?\x06 ?\x09 ?\x5c ?\x2a ?\x86 ?\x48
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
505 ?\x86 ?\xf7 ?\x0d ?\x01 ?\x07 ?\x02)))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
506
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
507 ;; id-envelopedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
508 ;; us(840) rsadsi(113549) pkcs(1) pkcs7(7) 3 }
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
509 (defvar mm-pkcs7-enveloped-magic
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
510 (mm-string-as-unibyte
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
511 (apply 'concat
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
512 (mapcar 'char-to-string
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
513 (list ?\x30 ?\x5c ?\x28 ?\x80 ?\x5c ?\x7c ?\x81 ?\x2e ?\x5c
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
514 ?\x7c ?\x82 ?\x2e ?\x2e ?\x5c ?\x7c ?\x83 ?\x2e ?\x2e
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
515 ?\x2e ?\x5c ?\x29 ?\x06 ?\x09 ?\x5c ?\x2a ?\x86 ?\x48
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
516 ?\x86 ?\xf7 ?\x0d ?\x01 ?\x07 ?\x03)))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
517
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
518 (defun mm-view-pkcs7-get-type (handle)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
519 (mm-with-unibyte-buffer
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
520 (mm-insert-part handle)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
521 (cond ((looking-at mm-pkcs7-enveloped-magic)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
522 'enveloped)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
523 ((looking-at mm-pkcs7-signed-magic)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
524 'signed)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
525 (t
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
526 (error "Could not identify PKCS#7 type")))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
527
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
528 (defun mm-view-pkcs7 (handle)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
529 (case (mm-view-pkcs7-get-type handle)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
530 (enveloped (mm-view-pkcs7-decrypt handle))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
531 (signed (mm-view-pkcs7-verify handle))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
532 (otherwise (error "Unknown or unimplemented PKCS#7 type"))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
533
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
534 (defun mm-view-pkcs7-verify (handle)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
535 ;; A bogus implementation of PKCS#7. FIXME::
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
536 (mm-insert-part handle)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
537 (goto-char (point-min))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
538 (if (search-forward "Content-Type: " nil t)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
539 (delete-region (point-min) (match-beginning 0)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
540 (goto-char (point-max))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
541 (if (re-search-backward "--\r?\n?" nil t)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
542 (delete-region (match-end 0) (point-max)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
543 (goto-char (point-min))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
544 (while (search-forward "\r\n" nil t)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
545 (replace-match "\n"))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
546 (message "Verify signed PKCS#7 message is unimplemented.")
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
547 (sit-for 1)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
548 t)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
549
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
550 (autoload 'gnus-completing-read-maybe-default "gnus-util" nil nil 'macro)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
551
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
552 (defun mm-view-pkcs7-decrypt (handle)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
553 (insert-buffer-substring (mm-handle-buffer handle))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
554 (goto-char (point-min))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
555 (insert "MIME-Version: 1.0\n")
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
556 (mm-insert-headers "application/pkcs7-mime" "base64" "smime.p7m")
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
557 (smime-decrypt-region
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
558 (point-min) (point-max)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
559 (if (= (length smime-keys) 1)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
560 (cadar smime-keys)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
561 (smime-get-key-by-email
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
562 (gnus-completing-read-maybe-default
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
563 (concat "Decipher using which key? "
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
564 (if smime-keys (concat "(default " (caar smime-keys) ") ")
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
565 ""))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
566 smime-keys nil nil nil nil (car-safe (car-safe smime-keys))))))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
567 (goto-char (point-min))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
568 (while (search-forward "\r\n" nil t)
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
569 (replace-match "\n"))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
570 (goto-char (point-min)))
0fde48feb604 Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents: 55680
diff changeset
571
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
572 (provide 'mm-view)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
573
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49598
diff changeset
574 ;;; 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
575 ;;; mm-view.el ends here