From 6793b736db5755bce9c5be859d8001ff6a2ab3e5 Mon Sep 17 00:00:00 2001 From: ueno Date: Thu, 21 Feb 2002 20:24:01 +0000 Subject: [PATCH] * gnus-group.el (gnus-group-name-encode): New function. (gnus-group-encoded-name): New function. (gnus-group-completing-read-group-name): New function. (gnus-fetch-group): Use it. (gnus-group-jump-to-group): Use it. (gnus-group-unsubscribe-current-group): Use it. --- ChangeLog | 9 +++++++++ lisp/gnus-group.el | 40 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c312a98..883e674 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2002-02-21 Daiki Ueno + * lisp/gnus-group.el (gnus-group-name-encode): New function. + (gnus-group-encoded-name): New function. + (gnus-group-completing-read-group-name): New function. + (gnus-fetch-group): Use it. + (gnus-group-jump-to-group): Use it. + (gnus-group-unsubscribe-current-group): Use it. + +2002-02-21 Daiki Ueno + * lisp/nnheader.el (mm-string-as-unibyte): Undo the last change. * lisp/gnus-srvr.el (gnus-browse-foreign-server): Ditto. diff --git a/lisp/gnus-group.el b/lisp/gnus-group.el index a14ea3c..fccd242 100644 --- a/lisp/gnus-group.el +++ b/lisp/gnus-group.el @@ -1050,6 +1050,39 @@ The following commands are available: (let ((charset (gnus-group-name-charset nil string))) (gnus-group-name-decode string charset))) +(defun gnus-group-name-encode (string charset) + (if (and string charset (featurep 'mule)) + (encode-coding-string string charset) + string)) + +(defun gnus-group-encoded-name (string) + (let ((charset (gnus-group-name-charset nil string))) + (gnus-group-name-encode string charset))) + +(defun gnus-group-completing-read-group-name + (prompt table &optional predicate require-match initial-contents history) + (if (vectorp table) + (let ((decoded-table (make-vector (length table) 0))) + (mapatoms + (lambda (atom) + (set (intern (gnus-group-decoded-name (symbol-name atom)) + decoded-table) + (symbol-value atom))) + table) + (setq table decoded-table)) + (setq table (mapcar + (lambda (entry) + (cons (gnus-group-decoded-name + (car entry)) + (cdr entry))) + table))) + (gnus-group-encoded-name + (completing-read + prompt table predicate + require-match + initial-contents + history))) + (defun gnus-group-list-groups (&optional level unread lowest) "List newsgroups with level LEVEL or lower that have unread articles. Default is all subscribed groups. @@ -1856,7 +1889,8 @@ be permanent." (defun gnus-fetch-group (group) "Start Gnus if necessary and enter GROUP. Returns whether the fetching was successful or not." - (interactive (list (completing-read "Group name: " gnus-active-hashtb))) + (interactive (list (gnus-group-completing-read-group-name + "Group name: " gnus-active-hashtb))) (unless (get-buffer gnus-group-buffer) (gnus-no-server)) (gnus-group-read-group nil nil group)) @@ -1935,7 +1969,7 @@ Return the name of the group if selection was successful." (defun gnus-group-jump-to-group (group) "Jump to newsgroup GROUP." (interactive - (list (completing-read + (list (gnus-group-completing-read-group-name "Group: " gnus-active-hashtb nil (gnus-read-active-file-p) gnus-group-jump-to-group-prompt @@ -3120,7 +3154,7 @@ If given numerical prefix, toggle the N next groups." Killed newsgroups are subscribed. If SILENT, don't try to update the group line." (interactive - (list (completing-read + (list (gnus-group-completing-read-group-name "Group: " gnus-active-hashtb nil (gnus-read-active-file-p) nil -- 1.7.10.4