annotate lisp/tm/gnus-charset.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents e04119814345
children 54cc21c15cbb
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:
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
8 ;; $Id: gnus-charset.el,v 1.1.1.1 1996/12/18 22:43:38 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 ()
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
86 (defun nnheader-find-file-noselect (filename &optional nowarn rawfile)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
87 (as-binary-input-file (find-file-noselect filename nowarn rawfile))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
88 )
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
89 (defun nnheader-insert-file-contents-literally
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
90 (filename &optional visit beg end replace)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
91 (as-binary-input-file
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
92 (insert-file-contents-literally filename visit beg end replace)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
93 ))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
94 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
95 (call-after-loaded
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
96 'nnmail
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
97 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
98 (defun nnmail-find-file (file)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
99 "Insert FILE in server buffer safely. [gnus-charset.el]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
100 (set-buffer nntp-server-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
101 (erase-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
102 (let ((format-alist nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
103 (after-insert-file-functions ; for jam-code-guess
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
104 (if (memq 'jam-code-guess-after-insert-file-function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
105 after-insert-file-functions)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
106 '(jam-code-guess-after-insert-file-function)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
107 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
108 (as-binary-input-file
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
109 (condition-case ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
110 (progn (insert-file-contents file) t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
111 (file-error nil))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
112 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
113 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
114 (defun gnus-prepare-save-mail-function ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
115 (setq file-coding-system *noconv*
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
116 coding-system-for-write 'no-conversion)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
117 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
118 (add-hook 'nnmail-prepare-save-mail-hook
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
119 'gnus-prepare-save-mail-function)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
120
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
121 (gnus-set-newsgroup-default-charset "alt.chinese" 'hz-gb-2312)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
122 (gnus-set-newsgroup-default-charset "alt.chinese.text.big5" 'cn-big5)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
123 (gnus-set-newsgroup-default-charset "fj" 'iso-2022-jp-2)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
124 (gnus-set-newsgroup-default-charset "han" 'euc-kr)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
125 (gnus-set-newsgroup-default-charset "hk" 'cn-big5)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
126 (gnus-set-newsgroup-default-charset "hkstar" 'cn-big5)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
127 (gnus-set-newsgroup-default-charset "relcom" 'koi8-r)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
128 (gnus-set-newsgroup-default-charset "tw" 'cn-big5)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
129 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
130
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
131
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
132 ;;; @ end
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
133 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
134
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
135 (provide 'gnus-charset)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
136
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
137 ;;; gnus-charset.el ends here