* gnus-srvr.el (gnus-browse-subscribe-newsgroup-method): New variable.
authorAndreas Seltenreich <andreas+git@gate450.dyndns.org>
Fri, 16 Jul 2010 07:12:27 +0000 (09:12 +0200)
committerAndreas Seltenreich <andreas+git@gate450.dyndns.org>
Sun, 26 Sep 2010 01:52:20 +0000 (03:52 +0200)
(gnus-browse-unsubscribe-current-group): Document it.
(gnus-browse-unsubscribe-group): Use it.

* gnus.texi (Browse Foreign Server): New variable
gnus-browse-subscribe-newsgroup-method.

* gnus-news.texi: Mention it.

lisp/ChangeLog
lisp/gnus-srvr.el
texi/ChangeLog
texi/gnus-news.texi
texi/gnus.texi

index e78824b..5e5e2b5 100644 (file)
@@ -1,3 +1,9 @@
+2010-09-26  Andreas Seltenreich  <seltenreich@gmx.de>
+
+       * gnus-srvr.el (gnus-browse-subscribe-newsgroup-method): New variable.
+       (gnus-browse-unsubscribe-current-group): Document it.
+       (gnus-browse-unsubscribe-group): Use it.
+
 2010-09-26  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * gnus-group.el (gnus-read-ephemeral-bug-group): Add the bug email
index ced0d2c..11164a8 100644 (file)
@@ -28,6 +28,7 @@
 (eval-when-compile (require 'cl))
 
 (require 'gnus)
+(require 'gnus-start)
 (require 'gnus-spec)
 (require 'gnus-group)
 (require 'gnus-int)
@@ -644,6 +645,30 @@ The following commands are available:
 (defvar gnus-browse-menu-hook nil
   "*Hook run after the creation of the browse mode menu.")
 
+(defcustom gnus-browse-subscribe-newsgroup-method
+  'gnus-subscribe-alphabetically
+  "Function(s) called when subscribing groups in the Browse Server Buffer
+A few pre-made functions are supplied: `gnus-subscribe-randomly'
+inserts new groups at the beginning of the list of groups;
+`gnus-subscribe-alphabetically' inserts new groups in strict
+alphabetic order; `gnus-subscribe-hierarchically' inserts new groups
+in hierarchical newsgroup order; `gnus-subscribe-interactively' asks
+for your decision; `gnus-subscribe-killed' kills all new groups;
+`gnus-subscribe-zombies' will make all new groups into zombies;
+`gnus-subscribe-topics' will enter groups into the topics that
+claim them."
+  :version "24.1"
+  :group 'gnus-server
+  :type '(radio (function-item gnus-subscribe-randomly)
+               (function-item gnus-subscribe-alphabetically)
+               (function-item gnus-subscribe-hierarchically)
+               (function-item gnus-subscribe-interactively)
+               (function-item gnus-subscribe-killed)
+               (function-item gnus-subscribe-zombies)
+               (function-item gnus-subscribe-topics)
+               function
+               (repeat function)))
+
 (defvar gnus-browse-mode-hook nil)
 (defvar gnus-browse-mode-map nil)
 (put 'gnus-browse-mode 'mode-class 'special)
@@ -891,7 +916,9 @@ If NUMBER, fetch this number of articles."
   (gnus-browse-next-group (- n)))
 
 (defun gnus-browse-unsubscribe-current-group (arg)
-  "(Un)subscribe to the next ARG groups."
+  "(Un)subscribe to the next ARG groups.
+The variable `gnus-browse-subscribe-newsgroup-method' determines
+how new groups will be entered into the group buffer."
   (interactive "p")
   (when (eobp)
     (error "No group at current line"))
@@ -940,22 +967,24 @@ If NUMBER, fetch this number of articles."
            ;; subscribe to it.
            (if (gnus-ephemeral-group-p group)
                (gnus-kill-ephemeral-group group))
-           ;; We need to discern between killed/zombie groups and
-           ;; just unsubscribed ones.
-           (gnus-group-change-level
-            (or (gnus-group-entry group)
-                (list t group gnus-level-default-subscribed
-                      nil nil (if (gnus-server-equal
-                                   gnus-browse-current-method "native")
-                                  nil
-                                (gnus-method-simplify
-                                 gnus-browse-current-method))))
-            gnus-level-default-subscribed (gnus-group-level group)
-            (and (car (nth 1 gnus-newsrc-alist))
-                 (gnus-group-entry (car (nth 1 gnus-newsrc-alist))))
-            (null (gnus-group-entry group)))
+           (let ((entry (gnus-group-entry group)))
+             (if entry
+                 ;; Just change the subscription level if it is an
+                 ;; unsubscribed group.
+                 (gnus-group-change-level entry
+                                          gnus-level-default-subscribed)
+               ;; If it is a killed group or a zombie, feed it to the
+               ;; mechanism for new group subscription.
+               (gnus-call-subscribe-functions
+                gnus-browse-subscribe-newsgroup-method
+                group)))
            (delete-char 1)
-           (insert ? ))
+           (insert (let ((lvl (gnus-group-level group)))
+                     (cond
+                      ((< lvl gnus-level-unsubscribed) ? )
+                      ((< lvl gnus-level-zombie) ?U)
+                      ((< lvl gnus-level-killed) ?Z)
+                      (t ?K)))))
        (gnus-group-change-level
         group gnus-level-unsubscribed gnus-level-default-subscribed)
        (delete-char 1)
index 6dcc195..be6ecba 100644 (file)
@@ -1,3 +1,10 @@
+2010-09-26  Andreas Seltenreich  <seltenreich@gmx.de>
+
+       * gnus.texi (Browse Foreign Server): New variable
+       gnus-browse-subscribe-newsgroup-method.
+
+       * gnus-news.texi: Mention it.
+
 2010-09-26  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * gnus.texi (NoCeM): Removed.
index 33220c2..bf7a685 100644 (file)
@@ -246,6 +246,16 @@ of the "Whomever writes:" line.  You need to set
 @code{message-insert-formatted-citation-line} as well.
 @end itemize
 
+@item Changes in Browse Server mode
+
+@itemize @bullet
+@item Gnus' sophisticated subscription methods are now available in
+Browse Server buffers as well using the variable
+@code{gnus-browse-subscribe-newsgroup-method}.
+
+@end itemize
+
+
 @item Changes in back ends
 
 @itemize @bullet
index 2acaf55..ff7f8f9 100644 (file)
@@ -3598,8 +3598,12 @@ Enter the current group (@code{gnus-browse-select-group}).
 @item u
 @kindex u (Browse)
 @findex gnus-browse-unsubscribe-current-group
+@vindex gnus-browse-subscribe-newsgroup-method
 Unsubscribe to the current group, or, as will be the case here,
-subscribe to it (@code{gnus-browse-unsubscribe-current-group}).
+subscribe to it (@code{gnus-browse-unsubscribe-current-group}).  You
+can affect the way the new group is entered into the Group buffer
+using the variable @code{gnus-browse-subscribe-newsgroup-method}.  See
+@pxref{Subscription Methods} for available options.
 
 @item l
 @itemx q