annotate lisp/tm/gnus-art-mime.el @ 76:c0c698873ce1 r20-0b33

Import from CVS: tag r20-0b33
author cvs
date Mon, 13 Aug 2007 09:05:10 +0200
parents 54cc21c15cbb
children 0d2f883870bc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1 ;;; gnus-art-mime.el --- MIME extension for article mode of Gnus
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
2
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 16
diff changeset
3 ;; Copyright (C) 1995,1996 Free Software Foundation, Inc.
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
6 ;; Created: 1996/8/6
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
7 ;; Version:
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
8 ;; $Id: gnus-art-mime.el,v 1.1.1.2 1996/12/21 20:50:48 steve Exp $
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
9 ;; Keywords: news, MIME, multimedia, multilingual, encoded-word
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
10
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
11 ;; This file is not part of GNU Emacs yet.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
12
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
13 ;; This program is free software; you can redistribute it and/or
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
14 ;; modify it under the terms of the GNU General Public License as
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
15 ;; published by the Free Software Foundation; either version 2, or (at
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
16 ;; your option) any later version.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
17
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
18 ;; This program is distributed in the hope that it will be useful, but
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
21 ;; General Public License for more details.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
22
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
26 ;; Boston, MA 02111-1307, USA.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
27
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
28 ;;; Code:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
29
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
30 (require 'emu)
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
31 (require 'gnus-mime)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
32 (require 'gnus-art)
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
33 (require 'tm-view)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
34
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
35 (autoload 'mime-eword/decode-region "tm-ew-d"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
36 "Decode MIME encoded-words in region." t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
37 (autoload 'mime/decode-message-header "tm-ew-d"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
38 "Decode MIME encoded-words in message header." t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
39
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
40
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
41 ;;; @ encoded-word
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
42 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
43
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
44 ;;; `gnus-decode-rfc1522' of Gnus works only Q-encoded iso-8859-1
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
45 ;;; encoded-words. In addition, it does not apply decoding rule of
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
46 ;;; RFC 1522 and it does not do unfolding. So gnus-mime defines own
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
47 ;;; function using tm-ew-d.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
48
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 16
diff changeset
49 (defun gnus-decode-rfc1522 ()
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
50 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
51 (if (re-search-forward "^[0-9]+\t" nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
52 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
53 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
54 ;; for XOVER
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
55 (while (re-search-forward "^[0-9]+\t\\([^\t]+\\)\t" nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
56 (mime-eword/decode-region (match-beginning 1) (match-end 1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
57 'unfolding 'must-unfold)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
58 (if (re-search-forward "[^\t]+" nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
59 (mime-eword/decode-region (match-beginning 0)(match-end 0)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
60 'unfolding 'must-unfold)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
61 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
62 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
63 (mime-eword/decode-region (point-min)(point-max) t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
64 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
65
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
66
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
67 ;;; @ article filter
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
68 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
69
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
70 (defun gnus-article-preview-mime-message ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
71 (make-local-variable 'tm:mother-button-dispatcher)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
72 (setq tm:mother-button-dispatcher
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
73 (function gnus-article-push-button))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
74 (let ((mime-viewer/ignored-field-regexp "^:$")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
75 (default-mime-charset
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
76 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
77 (set-buffer gnus-summary-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
78 default-mime-charset))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
79 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
80 (save-window-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
81 (mime/viewer-mode nil nil nil gnus-original-article-buffer
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
82 gnus-article-buffer
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
83 gnus-article-mode-map)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
84 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
85 (run-hooks 'tm-gnus/article-prepare-hook)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
86 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
87
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
88 (defun gnus-article-decode-encoded-word ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
89 (decode-mime-charset-region (point-min)(point-max)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
90 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
91 (set-buffer gnus-summary-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
92 default-mime-charset))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
93 (mime/decode-message-header)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
94 (run-hooks 'tm-gnus/article-prepare-hook)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
95 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
96
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
97
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
98 ;;; @ for tm-view
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
99 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
100
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
101 (defun gnus-content-header-filter ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
102 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
103 (mime-preview/cut-header)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
104 (decode-mime-charset-region (point-min)(point-max) default-mime-charset)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
105 (mime/decode-message-header)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
106 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
107
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
108 (defun mime-viewer/quitting-method-for-gnus ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
109 (if (not gnus-show-mime)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
110 (mime-viewer/kill-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
111 (delete-other-windows)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
112 (gnus-article-show-summary)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
113 (if (or (not gnus-show-mime)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
114 (null gnus-have-all-headers))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
115 (gnus-summary-select-article nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
116 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
117
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
118 (call-after-loaded
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
119 'tm-view
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
120 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
121 (set-alist 'mime-viewer/content-header-filter-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
122 'gnus-original-article-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
123 (function gnus-content-header-filter))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
124
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
125 (set-alist 'mime-viewer/code-converter-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
126 'gnus-original-article-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
127 (function mime-charset/decode-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
128
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
129 (set-alist 'mime-viewer/quitting-method-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
130 'gnus-original-article-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
131 (function mime-viewer/quitting-method-for-gnus))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
132
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
133 (set-alist 'mime-viewer/show-summary-method
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
134 'gnus-original-article-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
135 (function mime-viewer/quitting-method-for-gnus))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
136 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
137
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
138
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
139 ;;; @ for BBDB
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
140 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
141
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
142 (call-after-loaded
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
143 'bbdb
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
144 (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
145 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
146 (require 'tm-bbdb)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
147 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
148
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
149 (autoload 'tm-bbdb/update-record "tm-bbdb")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
150
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
151 (defun tm-gnus/bbdb-setup ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
152 (if (and (boundp 'gnus-article-prepare-hook)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
153 (memq 'bbdb/gnus-update-record gnus-article-prepare-hook)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
154 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
155 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
156 (remove-hook 'gnus-article-prepare-hook 'bbdb/gnus-update-record)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
157 (add-hook 'gnus-article-display-hook 'tm-bbdb/update-record)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
158 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
159
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
160 (add-hook 'gnus-startup-hook 'tm-gnus/bbdb-setup t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
161
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
162 (tm-gnus/bbdb-setup)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
163
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
164
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
165 ;;; @ end
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
166 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
167
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
168 (provide 'gnus-art-mime)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
169
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
170 ;;; gnus-art-mime.el ends here