Fix "groups" Agent format
authorWolfgang Jenkner <wjenkner@inode.at>
Sun, 13 May 2012 19:17:19 +0000 (21:17 +0200)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Sun, 13 May 2012 19:17:19 +0000 (21:17 +0200)
* gnus-agent.el (gnus-agent-save-active): Deal with the "groups"
format.  In particular, add an optional argument and a docstring.

* gnus-start.el (gnus-groups-to-gnus-format): Use it.

* nntp.el (nntp-finish-retrieve-group-infos): Make `nntp-server-buffer'
current before calling `gnus-groups-to-gnus-format'.
Note that this was already the case for `gnus-active-to-gnus-format'.

lisp/ChangeLog
lisp/gnus-agent.el
lisp/gnus-start.el
lisp/nntp.el

index 23e4235..71fdb99 100644 (file)
@@ -1,3 +1,14 @@
+2011-12-02  Wolfgang Jenkner  <wjenkner@inode.at>
+
+       * gnus-agent.el (gnus-agent-save-active): Deal with the "groups"
+       format.  In particular, add an optional argument and a docstring.
+
+       * gnus-start.el (gnus-groups-to-gnus-format): Use it.
+
+       * nntp.el (nntp-finish-retrieve-group-infos): Make `nntp-server-buffer'
+       current before calling `gnus-groups-to-gnus-format'.
+       Note that this was already the case for `gnus-active-to-gnus-format'.
+
 2012-05-04  Paul Eggert  <eggert@cs.ucla.edu>
 
        Fix minor Y10k bug.
index 4e4f6cb..540a97b 100644 (file)
@@ -1299,12 +1299,18 @@ This can be added to `gnus-select-article-hook' or
             (gnus-group-update-group group t)))
     nil))
 
-(defun gnus-agent-save-active (method)
+(defun gnus-agent-save-active (method &optional groups-p)
+  "Sync the agent's active file with the current buffer.
+Pass non-nil for GROUPS-P if the buffer starts out in groups format.
+Regardless, both the file and the buffer end up in active format
+if METHOD is agentized; otherwise the function is a no-op."
   (when (gnus-agent-method-p method)
     (let* ((gnus-command-method method)
           (new (gnus-make-hashtable (count-lines (point-min) (point-max))))
           (file (gnus-agent-lib-file "active")))
-      (gnus-active-to-gnus-format nil new)
+      (if groups-p
+         (gnus-groups-to-gnus-format nil new)
+       (gnus-active-to-gnus-format nil new))
       (gnus-agent-write-active file new)
       (erase-buffer)
       (let ((nnheader-file-coding-system gnus-agent-file-coding-system))
index 4a833e0..fc32e18 100644 (file)
@@ -2221,7 +2221,7 @@ backend check whether the group actually exists."
             (gnus-online method)
             (gnus-agent-method-p method))
        (progn
-         (gnus-agent-save-active method)
+         (gnus-agent-save-active method t)
          (gnus-active-to-gnus-format method hashtb nil real-active))
 
       (goto-char (point-min))
index d2c7654..592b446 100644 (file)
@@ -809,7 +809,8 @@ command whose response triggered the error."
              (progn
                (nntp-copy-to-buffer nntp-server-buffer
                                     (point-min) (point-max))
-               (gnus-groups-to-gnus-format method gnus-active-hashtb t))
+               (with-current-buffer nntp-server-buffer
+                 (gnus-groups-to-gnus-format method gnus-active-hashtb t)))
            ;; We have read active entries, so we just delete the
            ;; superfluous gunk.
            (goto-char (point-min))