(gnus-summary-refer-thread): Implement a version that uses *-request-thread.
[gnus] / lisp / gnus-srvr.el
index 36c73eb..b532b74 100644 (file)
@@ -1,7 +1,7 @@
 ;;; gnus-srvr.el --- virtual server support for Gnus
 
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-;;   2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+;;   2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
@@ -28,6 +28,7 @@
 (eval-when-compile (require 'cl))
 
 (require 'gnus)
+(require 'gnus-start)
 (require 'gnus-spec)
 (require 'gnus-group)
 (require 'gnus-int)
@@ -177,6 +178,7 @@ If nil, a faster, but more primitive, buffer is used instead."
   :group 'gnus-server-visual)
 ;; backward-compatibility alias
 (put 'gnus-server-agent-face 'face-alias 'gnus-server-agent)
+(put 'gnus-server-agent-face 'obsolete-face "22.1")
 
 (defface gnus-server-opened
   '((((class color) (background light)) (:foreground "Green3" :bold t))
@@ -186,6 +188,7 @@ If nil, a faster, but more primitive, buffer is used instead."
   :group 'gnus-server-visual)
 ;; backward-compatibility alias
 (put 'gnus-server-opened-face 'face-alias 'gnus-server-opened)
+(put 'gnus-server-opened-face 'obsolete-face "22.1")
 
 (defface gnus-server-closed
   '((((class color) (background light)) (:foreground "Steel Blue" :italic t))
@@ -196,6 +199,7 @@ If nil, a faster, but more primitive, buffer is used instead."
   :group 'gnus-server-visual)
 ;; backward-compatibility alias
 (put 'gnus-server-closed-face 'face-alias 'gnus-server-closed)
+(put 'gnus-server-closed-face 'obsolete-face "22.1")
 
 (defface gnus-server-denied
   '((((class color) (background light)) (:foreground "Red" :bold t))
@@ -205,6 +209,7 @@ If nil, a faster, but more primitive, buffer is used instead."
   :group 'gnus-server-visual)
 ;; backward-compatibility alias
 (put 'gnus-server-denied-face 'face-alias 'gnus-server-denied)
+(put 'gnus-server-denied-face 'obsolete-face "22.1")
 
 (defface gnus-server-offline
   '((((class color) (background light)) (:foreground "Orange" :bold t))
@@ -214,6 +219,7 @@ If nil, a faster, but more primitive, buffer is used instead."
   :group 'gnus-server-visual)
 ;; backward-compatibility alias
 (put 'gnus-server-offline-face 'face-alias 'gnus-server-offline)
+(put 'gnus-server-offline-face 'obsolete-face "22.1")
 
 (defvar gnus-server-font-lock-keywords
   '(("(\\(agent\\))" 1 'gnus-server-agent)
@@ -295,9 +301,7 @@ The following commands are available:
   "Initialize the server buffer."
   (unless (get-buffer gnus-server-buffer)
     (with-current-buffer (gnus-get-buffer-create gnus-server-buffer)
-      (gnus-server-mode)
-      (when gnus-carpal
-       (gnus-carpal-setup-buffer 'server)))))
+      (gnus-server-mode))))
 
 (defun gnus-server-prepare ()
   (gnus-set-format 'server-mode)
@@ -542,6 +546,7 @@ The following commands are available:
   (gnus-server-list-servers))
 
 (defun gnus-server-copy-server (from to)
+  "Copy a server definiton to a new name."
   (interactive
    (list
     (or (gnus-server-server-name)
@@ -564,8 +569,9 @@ The following commands are available:
 
 (defun gnus-server-add-server (how where)
   (interactive
-   (list (intern (completing-read "Server method: "
-                                 gnus-valid-select-methods nil t))
+   (list (intern (gnus-completing-read "Server method"
+                                       (mapcar 'car gnus-valid-select-methods)
+                                       t))
         (read-string "Server name: ")))
   (when (assq where gnus-server-alist)
     (error "Server with that name already defined"))
@@ -575,7 +581,7 @@ The following commands are available:
 (defun gnus-server-goto-server (server)
   "Jump to a server line."
   (interactive
-   (list (completing-read "Goto server: " gnus-server-alist nil t)))
+   (list (gnus-completing-read "Goto server" (mapcar 'car gnus-server-alist) t)))
   (let ((to (text-property-any (point-min) (point-max)
                               'gnus-server (intern server))))
     (when to
@@ -638,6 +644,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)
@@ -774,8 +804,6 @@ The following commands are available:
            (funcall gnus-group-prepare-function
                     gnus-level-killed 'ignore 1 'ignore))
        (gnus-get-buffer-create gnus-browse-buffer)
-       (when gnus-carpal
-         (gnus-carpal-setup-buffer 'browse))
        (gnus-configure-windows 'browse)
        (buffer-disable-undo)
        (let ((buffer-read-only nil))
@@ -885,7 +913,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"))
@@ -934,22 +964,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)
@@ -971,7 +1003,7 @@ If NUMBER, fetch this number of articles."
 (defun gnus-browse-describe-briefly ()
   "Give a one line description of the group mode commands."
   (interactive)
-  (gnus-message 6
+  (gnus-message 6 "%s"
                (substitute-command-keys "\\<gnus-browse-mode-map>\\[gnus-group-next-group]:Forward  \\[gnus-group-prev-group]:Backward  \\[gnus-browse-exit]:Exit  \\[gnus-info-find-node]:Run Info  \\[gnus-browse-describe-briefly]:This help")))
 
 (defun gnus-server-regenerate-server ()
@@ -1028,5 +1060,4 @@ Requesting compaction of %s... (this may take a long time)"
 
 (provide 'gnus-srvr)
 
-;; arch-tag: c0117f64-27ca-475d-9406-8da6854c7a25
 ;;; gnus-srvr.el ends here