[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nnshimbun]
日
本語のグループ名
- From: ari@xxxxxxxxxxxxx (ARISAWA Akihiro)
- Date: Fri, 18 Feb 2005 12:09:34 +0900
- X-ml-name: emacs-w3m
- X-mail-count: 07622
- References: <878y5ncmqy.fsf@puyo.nijino.com>
ARISAWA Akihiro writes:
> ;; ただし keyword に日本語を使うとまずそうです。
> ;; このあたりは後ほど調べてみます。
*Group* バッファなどでグループ名が化けてしまったのですが、
グループ名はエンコードせずに emacs の内部コードで持っているのに対し、
gnus-group-name-charset-group-alist がデフォルトのままだと utf-8 で
デコードしてしまうためでした。
ということで、以下のような設定をすると正常に動作しました。
(add-to-list 'gnus-group-name-charset-group-alist '("nnshimbun" . nil))
しかしながら、nnrss のようにグループ名を utf-8 でエンコードして持つという
手もあるのですが、どちらが良いでしょうか?
添付のような変更で、gnus-group-name-charset-group-alist がデフォルトの
ままで表示できることは確認しています。
--
有沢 明宏
Index: shimbun/nnshimbun.el
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/shimbun/nnshimbun.el,v
retrieving revision 1.25
diff -u -r1.25 nnshimbun.el
--- shimbun/nnshimbun.el 17 Feb 2005 13:54:27 -0000 1.25
+++ shimbun/nnshimbun.el 18 Feb 2005 01:05:32 -0000
@@ -352,6 +352,10 @@
(t
`(plist-get (nnshimbun-find-group-parameters ,name) ,symbol)))))
+(defun nnshimbun-decode-group-name (group)
+ (if (and group (mm-coding-system-p 'utf-8))
+ (mm-decode-coding-string group 'utf-8)
+ group))
;; Interface functions:
@@ -473,6 +477,7 @@
(cons group article)))))))
(deffoo nnshimbun-request-article (article &optional group server to-buffer)
+ (setq group (nnshimbun-decode-group-name group))
(when (nnshimbun-possibly-change-group group server)
(if (or (integerp article)
(when (stringp article)
@@ -490,6 +495,7 @@
(prin1-to-string article)))))
(deffoo nnshimbun-request-group (group &optional server dont-check)
+ (setq group (nnshimbun-decode-group-name group))
(if (not (nnshimbun-possibly-change-group group server))
(nnheader-report 'nnshimbun "Invalid group (no such directory)")
(let (beg end lines)
@@ -505,6 +511,7 @@
lines (or beg 0) (or end 0) group))))
(deffoo nnshimbun-request-scan (&optional group server)
+ (setq group (nnshimbun-decode-group-name group))
(when (nnshimbun-possibly-change-group nil server)
(if group
(nnshimbun-generate-nov-database group)
@@ -512,6 +519,7 @@
(nnshimbun-generate-nov-database group)))))
(deffoo nnshimbun-close-group (group &optional server)
+ (setq group (nnshimbun-decode-group-name group))
(nnshimbun-write-nov group)
t)
@@ -532,6 +540,7 @@
t)) ;; return value
(deffoo nnshimbun-retrieve-headers (articles &optional group server fetch-old)
+ (setq group (nnshimbun-decode-group-name group))
(when (nnshimbun-possibly-change-group group server)
(if (nnshimbun-retrieve-headers-with-nov articles group fetch-old)
'nov
@@ -750,6 +759,7 @@
Note that nnshimbun does not actually delete any articles, it simply
deletes the entry in your own NOV database corresponding to the
article to be expired. The optional fourth argument FORCE is ignored."
+ (setq group (nnshimbun-decode-group-name group))
(when (nnshimbun-possibly-change-group group server)
(let* ((expirable (copy-sequence articles))
(name (concat "nnshimbun+" (nnshimbun-current-server) ":" group))
@@ -799,6 +809,7 @@
(deffoo nnshimbun-request-delete-group (group &optional force server)
"Delete the NOV file used for GROUP and the parent directories.
Other files in the directory are also deleted."
+ (setq group (nnshimbun-decode-group-name group))
(when (nnshimbun-possibly-change-group group server)
(let ((dir (nnmail-group-pathname group (nnshimbun-server-directory)))
(nov (nnshimbun-nov-buffer-name group))
@@ -889,16 +900,21 @@
server groups group)
(unless (eq major-mode 'gnus-group-mode)
(error "Command invoked outside of a Gnus group buffer"))
- (setq server (completing-read
- "Shimbun server address [Hit TAB to see candidates]: "
- alist nil t
- (car (delete "" nnshimbun-server-history))
- 'nnshimbun-server-history))
+ (setq server (mm-string-make-unibyte
+ (completing-read
+ "Shimbun server address [Hit TAB to see candidates]: "
+ alist nil t
+ (car (delete "" nnshimbun-server-history))
+ 'nnshimbun-server-history)))
(if (assoc server alist)
(let ((shimbun (shimbun-open server)))
(setq group (completing-read
"Group name [Hit TAB to see candidates]: "
(mapcar 'list (shimbun-groups shimbun))))
+ ;; Unify non-ASCII text.
+ (when (mm-coding-system-p 'utf-8)
+ (setq group (mm-decode-coding-string
+ (mm-encode-coding-string group 'utf-8) 'utf-8)))
(unless (shimbun-group-p shimbun group)
(setq group nil)))
(setq server nil))
@@ -908,7 +924,11 @@
gnus-newsrc-hashtb)
(error "Group nnshimbun+%s:%s already exists" server group)
(let (nnshimbun-pre-fetch-article)
- (gnus-group-make-group group (list 'nnshimbun server))))
+ (gnus-group-make-group
+ (if (mm-coding-system-p 'utf-8)
+ (mm-encode-coding-string group 'utf-8)
+ group)
+ (list 'nnshimbun server))))
(error "Can't find group")))