diff options
| author | Kenichi Handa | 1997-09-26 01:50:55 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-09-26 01:50:55 +0000 |
| commit | ecd70f86ff767537a7bcc4477286d524bc588cd4 (patch) | |
| tree | d6aff93d5fe8f52665464e59053ba8e7deeeeb6d | |
| parent | c8e521b489726fcbdb0ab5d3345812e28464edca (diff) | |
| download | emacs-ecd70f86ff767537a7bcc4477286d524bc588cd4.tar.gz emacs-ecd70f86ff767537a7bcc4477286d524bc588cd4.zip | |
Require nntp instead of gnus and message.
Set euc-kr for newsgroup "han". Delete code for add-hooking
gnus-mule-initialize and setting coding system for nntp.
Set default coding system for encoding to
iso-latin-1.
(gnus-mule-select-coding-system): Get a coding system of the
current newsgroup from gnus-summary-buffer.
(gnus-mule-decode-summary): Deleted.
(gnus-mule-initialize): Add-hook gnus-mule-select-coding-system to
gnus-parse-headers-hook. Don't add-hook gnus-mule-decode-summary
and gnus-mule-decode-article. Don't set process coding system for
nntp stream to 'no-conversion, instead set
nntp-coding-system-for-read to 'binary. Set
nnheader-file-coding-system and nnmail-file-coding-system to
'binary.
Set nntp-coding-system-for-write to
binary.
| -rw-r--r-- | lisp/gnus/gnus-mule.el | 59 |
1 files changed, 21 insertions, 38 deletions
diff --git a/lisp/gnus/gnus-mule.el b/lisp/gnus/gnus-mule.el index 75e224aace9..d3183743a9f 100644 --- a/lisp/gnus/gnus-mule.el +++ b/lisp/gnus/gnus-mule.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; gnus-mule.el --- Provide multilingual environment to GNUS | 1 | ;;; gnus-mule.el --- Provide multilingual environment to GNUS |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1995 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1995,1997 Free Software Foundation, Inc. |
| 4 | ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. | 4 | ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. |
| 5 | 5 | ||
| 6 | ;; Keywords: gnus, mule | 6 | ;; Keywords: gnus, mule |
| @@ -24,10 +24,8 @@ | |||
| 24 | 24 | ||
| 25 | ;;; Commentary: | 25 | ;;; Commentary: |
| 26 | 26 | ||
| 27 | ;; This package enables GNUS to code convert automatically | 27 | ;; This package enables Gnus to code convert automatically |
| 28 | ;; accoding to a coding system specified for each news group. | 28 | ;; accoding to a coding system specified for each news group. |
| 29 | ;; Please put the following line in your .emacs: | ||
| 30 | ;; (add-hook 'gnus-startup-hook 'gnus-mule-initialize) | ||
| 31 | ;; If you want to specify some coding system for a specific news | 29 | ;; If you want to specify some coding system for a specific news |
| 32 | ;; group, add the fllowing line in your .emacs: | 30 | ;; group, add the fllowing line in your .emacs: |
| 33 | ;; (gnus-mule-add-group "xxx.yyy.zzz" 'some-coding-system) | 31 | ;; (gnus-mule-add-group "xxx.yyy.zzz" 'some-coding-system) |
| @@ -37,8 +35,7 @@ | |||
| 37 | ;; appropriate coding system for as below: | 35 | ;; appropriate coding system for as below: |
| 38 | ;; (gnus-mule-add-group "" 'iso-2022-jp) ;; the case for Japanese | 36 | ;; (gnus-mule-add-group "" 'iso-2022-jp) ;; the case for Japanese |
| 39 | 37 | ||
| 40 | (require 'gnus) | 38 | (require 'nntp) |
| 41 | (require 'message) | ||
| 42 | 39 | ||
| 43 | (defvar gnus-newsgroup-coding-systems nil | 40 | (defvar gnus-newsgroup-coding-systems nil |
| 44 | "Assoc list of news groups vs corresponding coding systems. | 41 | "Assoc list of news groups vs corresponding coding systems. |
| @@ -82,6 +79,7 @@ coding-system for reading and writing respectively." | |||
| 82 | (defvar gnus-mule-article-decoded nil) | 79 | (defvar gnus-mule-article-decoded nil) |
| 83 | ;; Coding system for reading articles of the current news group. | 80 | ;; Coding system for reading articles of the current news group. |
| 84 | (defvar gnus-mule-coding-system nil) | 81 | (defvar gnus-mule-coding-system nil) |
| 82 | ;;(make-variable-buffer-local 'gnus-mule-coding-system) | ||
| 85 | (defvar gnus-mule-subject nil) | 83 | (defvar gnus-mule-subject nil) |
| 86 | (defvar gnus-mule-decoded-subject nil) | 84 | (defvar gnus-mule-decoded-subject nil) |
| 87 | (defvar gnus-mule-original-subject nil) | 85 | (defvar gnus-mule-original-subject nil) |
| @@ -125,35 +123,21 @@ coding-system for reading and writing respectively." | |||
| 125 | 123 | ||
| 126 | ;; Set `gnus-mule-coding-system' to the coding system articles of the | 124 | ;; Set `gnus-mule-coding-system' to the coding system articles of the |
| 127 | ;; current news group is encoded. This function is set in | 125 | ;; current news group is encoded. This function is set in |
| 128 | ;; `gnus-select-group-hook'. | 126 | ;; `gnus-parse-headers-hook'. |
| 129 | (defun gnus-mule-select-coding-system () | 127 | (defun gnus-mule-select-coding-system () |
| 130 | (let ((coding-system (gnus-mule-get-coding-system gnus-newsgroup-name))) | 128 | (save-excursion |
| 131 | (setq gnus-mule-coding-system | 129 | (set-buffer gnus-summary-buffer) |
| 132 | (if (and coding-system (coding-system-p (car coding-system))) | 130 | (let ((coding-system (gnus-mule-get-coding-system gnus-newsgroup-name))) |
| 133 | (car coding-system))))) | 131 | (setq gnus-mule-coding-system |
| 132 | (if (and coding-system (coding-system-p (car coding-system))) | ||
| 133 | (car coding-system)))))) | ||
| 134 | 134 | ||
| 135 | ;; Decode the current article. This function is set in | 135 | ;; Decode the current article. This function is set in |
| 136 | ;; `gnus-article-prepare-hook'. | 136 | ;; `gnus-show-traditional-method'. |
| 137 | (defun gnus-mule-decode-article () | 137 | (defun gnus-mule-decode-article () |
| 138 | (gnus-mule-code-convert gnus-mule-coding-system nil) | 138 | (gnus-mule-code-convert gnus-mule-coding-system nil) |
| 139 | (setq gnus-mule-article-decoded t)) | 139 | (setq gnus-mule-article-decoded t)) |
| 140 | 140 | ||
| 141 | ;; Decode the current summary buffer. This function is set in | ||
| 142 | ;; `gnus-summary-generate-hook'. | ||
| 143 | ;; Made by <sangil@hugsvr.kaist.ac.kr>, | ||
| 144 | ;; coded by <crisp@hugsvr.kaist.ac.kr>. | ||
| 145 | (defun gnus-mule-decode-summary () | ||
| 146 | (if gnus-mule-coding-system | ||
| 147 | (mapcar | ||
| 148 | (lambda (headers) | ||
| 149 | (let ((subject (aref headers 1)) | ||
| 150 | (author (aref headers 2))) | ||
| 151 | (aset headers 1 | ||
| 152 | (decode-coding-string subject gnus-mule-coding-system)) | ||
| 153 | (aset headers 2 | ||
| 154 | (decode-coding-string author gnus-mule-coding-system)))) | ||
| 155 | gnus-newsgroup-headers))) | ||
| 156 | |||
| 157 | (defun gnus-mule-toggle-article-format () | 141 | (defun gnus-mule-toggle-article-format () |
| 158 | "Toggle decoding/encoding of the current article buffer." | 142 | "Toggle decoding/encoding of the current article buffer." |
| 159 | (interactive) | 143 | (interactive) |
| @@ -200,30 +184,29 @@ coding-system for reading and writing respectively." | |||
| 200 | (define-key gnus-article-mode-map "z" 'gnus-mule-toggle-article-format) | 184 | (define-key gnus-article-mode-map "z" 'gnus-mule-toggle-article-format) |
| 201 | (define-key gnus-summary-mode-map "z" 'gnus-mule-toggle-article-format) | 185 | (define-key gnus-summary-mode-map "z" 'gnus-mule-toggle-article-format) |
| 202 | ;; Hook definition | 186 | ;; Hook definition |
| 203 | (add-hook 'gnus-select-group-hook 'gnus-mule-select-coding-system) | 187 | (add-hook 'gnus-parse-headers-hook 'gnus-mule-select-coding-system) |
| 204 | (add-hook 'gnus-summary-generate-hook 'gnus-mule-decode-summary) | ||
| 205 | (add-hook 'gnus-article-prepare-hook 'gnus-mule-decode-article) | ||
| 206 | (add-hook 'message-send-news-hook | 188 | (add-hook 'message-send-news-hook |
| 207 | 'gnus-mule-message-send-news-function) | 189 | 'gnus-mule-message-send-news-function) |
| 208 | (add-hook 'message-send-mail-hook | 190 | (add-hook 'message-send-mail-hook |
| 209 | 'gnus-mule-message-send-mail-function) | 191 | 'gnus-mule-message-send-mail-function) |
| 210 | (let ((stream (get-process "nntpd"))) | 192 | (setq nntp-coding-system-for-read 'binary |
| 211 | (if (processp stream) | 193 | nntp-coding-system-for-write 'binary |
| 212 | (set-process-coding-system stream 'no-conversion 'no-conversion)))) | 194 | nnheader-file-coding-system 'binary |
| 195 | nnmail-file-coding-system 'binary) | ||
| 196 | ) | ||
| 213 | 197 | ||
| 214 | (gnus-mule-add-group "" 'undecided) | 198 | (gnus-mule-add-group "" '(undecided . iso-latin-1)) |
| 215 | (gnus-mule-add-group "fj" 'iso-2022-7bit) | 199 | (gnus-mule-add-group "fj" 'iso-2022-7bit) |
| 216 | (gnus-mule-add-group "tnn" 'iso-2022-7bit) | 200 | (gnus-mule-add-group "tnn" 'iso-2022-7bit) |
| 217 | (gnus-mule-add-group "japan" 'iso-2022-7bit) | 201 | (gnus-mule-add-group "japan" 'iso-2022-7bit) |
| 218 | (gnus-mule-add-group "pin" 'iso-2022-7bit) | 202 | (gnus-mule-add-group "pin" 'iso-2022-7bit) |
| 203 | (gnus-mule-add-group "han" 'euc-kr) | ||
| 219 | (gnus-mule-add-group "alt.chinese.text" 'chinese-hz) | 204 | (gnus-mule-add-group "alt.chinese.text" 'chinese-hz) |
| 220 | (gnus-mule-add-group "alt.hk" 'chinese-hz) | 205 | (gnus-mule-add-group "alt.hk" 'chinese-hz) |
| 221 | (gnus-mule-add-group "alt.chinese.text.big5" 'chinese-big5) | 206 | (gnus-mule-add-group "alt.chinese.text.big5" 'chinese-big5) |
| 222 | (gnus-mule-add-group "soc.culture.vietnamese" '(nil . vietnamese-viqr)) | 207 | (gnus-mule-add-group "soc.culture.vietnamese" '(nil . vietnamese-viqr)) |
| 223 | (gnus-mule-add-group "relcom" 'cyrillic-koi8) | 208 | (gnus-mule-add-group "relcom" 'cyrillic-koi8) |
| 224 | 209 | ||
| 225 | (add-hook 'gnus-startup-hook 'gnus-mule-initialize) | 210 | (provide 'gnus-mule) |
| 226 | |||
| 227 | (modify-coding-system-alist 'network "nntp" 'no-conversion) | ||
| 228 | 211 | ||
| 229 | ;; gnus-mule.el ends here | 212 | ;; gnus-mule.el ends here |