annotate lisp/tm/gnus-charset.el @ 136:b980b6286996 r20-2b2

Import from CVS: tag r20-2b2
author cvs
date Mon, 13 Aug 2007 09:31:12 +0200
parents fe104dbd9147
children
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-charset.el --- MIME charset extension for Gnus
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
2
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
3 ;; Copyright (C) 1995,1996 Free Software Foundation, Inc.
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:
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 78
diff changeset
8 ;; $Id: gnus-charset.el,v 1.3 1997/03/16 03:05:45 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 'gnus)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
31
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
32 (defvar gnus-is-red-gnus-or-later
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
33 (or (featurep 'gnus-load)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
34 (module-installed-p 'gnus-sum)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
35 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
36
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
37
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
38 ;;; @ newsgroup default charset
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 (defvar gnus-newsgroup-default-charset-alist nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
42
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
43 (defun gnus-set-newsgroup-default-charset (newsgroup charset)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
44 "Set CHARSET for the NEWSGROUP as default MIME charset."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
45 (let* ((ng-regexp (concat "^" (regexp-quote newsgroup) "\\($\\|\\.\\)"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
46 (pair (assoc ng-regexp gnus-newsgroup-default-charset-alist))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
47 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
48 (if pair
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
49 (setcdr pair charset)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
50 (setq gnus-newsgroup-default-charset-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
51 (cons (cons ng-regexp charset)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
52 gnus-newsgroup-default-charset-alist))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
53 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
54
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
55
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
56 ;;; @ for mule (Multilingual support)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
57 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
58
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
59 (cond
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
60 ((featurep 'mule)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
61 (require 'emu)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
62 (defvar nntp-open-binary-connection-function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
63 (if gnus-is-red-gnus-or-later
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
64 ;; maybe Red Gnus
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
65 (if (boundp 'nntp-open-connection-function)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
66 nntp-open-connection-function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
67 'nntp-open-network-stream)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
68 ;; maybe Gnus 5.[01] or Gnus 5.[23]
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
69 (if (boundp 'nntp-open-server-function)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
70 nntp-open-server-function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
71 'nntp-open-network-stream)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
72 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
73 (defun nntp-open-network-stream-with-no-code-conversion (&rest args)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
74 (let ((proc (apply nntp-open-binary-connection-function args)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
75 (set-process-input-coding-system proc *noconv*)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
76 proc))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
77 (if gnus-is-red-gnus-or-later
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
78 (setq nntp-open-connection-function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
79 'nntp-open-network-stream-with-no-code-conversion)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
80 (setq nntp-open-server-function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
81 'nntp-open-network-stream-with-no-code-conversion)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
82 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
83 (call-after-loaded
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
84 'nnheader
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
85 (lambda ()
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
86 (defun nnheader-find-file-noselect (&rest args)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
87 (as-binary-input-file
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
88 (let ((format-alist nil)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
89 (auto-mode-alist (nnheader-auto-mode-alist))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
90 (default-major-mode 'fundamental-mode)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
91 (after-insert-file-functions ; for jam-code-guess
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
92 (if (memq 'jam-code-guess-after-insert-file-function
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
93 after-insert-file-functions)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
94 '(jam-code-guess-after-insert-file-function))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
95 (apply 'find-file-noselect args)))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
96 )
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
97 ;; Red Gnus 0.67 or later
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
98 (defun nnheader-insert-file-contents
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
99 (filename &optional visit beg end replace)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
100 (as-binary-input-file
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
101 (let ((format-alist nil)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
102 (auto-mode-alist (nnheader-auto-mode-alist))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
103 (default-major-mode 'fundamental-mode)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
104 (enable-local-variables nil)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
105 (after-insert-file-functions ; for jam-code-guess
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
106 (if (memq 'jam-code-guess-after-insert-file-function
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
107 after-insert-file-functions)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
108 '(jam-code-guess-after-insert-file-function))))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
109 (insert-file-contents filename visit beg end replace))
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
110 )
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
111 ;; for gnspool on OS/2
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
112 (while (re-search-forward "\r$" nil t)
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
113 (replace-match "")
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
114 )
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 74
diff changeset
115 )
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
116 ;; imported from Red Gnus 0.66
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
117 (or (fboundp 'nnheader-auto-mode-alist)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
118 (defun nnheader-auto-mode-alist ()
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
119 (let ((alist auto-mode-alist)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
120 out)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
121 (while alist
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
122 (when (listp (cdar alist))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
123 (push (car alist) out))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
124 (pop alist))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
125 (nreverse out)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
126 )
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
127 ;; alias for Old Gnus
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
128 (defalias 'nnheader-insert-file-contents-literally
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
129 'nnheader-insert-file-contents)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
130 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
131 (call-after-loaded
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
132 'nnmail
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
133 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
134 (defun nnmail-find-file (file)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
135 "Insert FILE in server buffer safely. [gnus-charset.el]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
136 (set-buffer nntp-server-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
137 (erase-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
138 (let ((format-alist nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
139 (after-insert-file-functions ; for jam-code-guess
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
140 (if (memq 'jam-code-guess-after-insert-file-function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
141 after-insert-file-functions)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
142 '(jam-code-guess-after-insert-file-function)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
143 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
144 (as-binary-input-file
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
145 (condition-case ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
146 (progn (insert-file-contents file) t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
147 (file-error nil))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
148 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
149 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
150 (defun gnus-prepare-save-mail-function ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
151 (setq file-coding-system *noconv*
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 78
diff changeset
152 buffer-file-coding-system 'no-conversion)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
153 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
154 (add-hook 'nnmail-prepare-save-mail-hook
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
155 'gnus-prepare-save-mail-function)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
156
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
157 (gnus-set-newsgroup-default-charset "alt.chinese" 'hz-gb-2312)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
158 (gnus-set-newsgroup-default-charset "alt.chinese.text.big5" 'cn-big5)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
159 (gnus-set-newsgroup-default-charset "fj" 'iso-2022-jp-2)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
160 (gnus-set-newsgroup-default-charset "han" 'euc-kr)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
161 (gnus-set-newsgroup-default-charset "hk" 'cn-big5)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
162 (gnus-set-newsgroup-default-charset "hkstar" 'cn-big5)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
163 (gnus-set-newsgroup-default-charset "relcom" 'koi8-r)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
164 (gnus-set-newsgroup-default-charset "tw" 'cn-big5)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
165 ))
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 ;;; @ end
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
169 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
170
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
171 (provide 'gnus-charset)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
172
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
173 ;;; gnus-charset.el ends here