comparison lisp/gnus/gnus-start.el @ 57617:7fdc1df35f39

Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628 Merge from gnus--rel--5.10 Patches applied: * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-55 Update from CVS 2004-10-19 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/gnus-sum.el (gnus-update-summary-mark-positions): Search for dummy marks in the right way. 2004-10-18 Kevin Greiner <kgreiner@compsol.cc> * lisp/gnus/nnagent.el (nnagent-request-type): Bind gnus-agent to nil to avoid infinite recursion via gnus-get-function. 2004-10-18 Kevin Greiner <kgreiner@compsol.cc> * lisp/gnus/gnus-agent.el (gnus-agent-synchronize-group-flags): When necessary, pass full group name to gnus-request-set-marks. (gnus-agent-synchronize-group-flags): Added support for sync'ing tick marks. (gnus-agent-synchronize-flags-server): Be silent when writing file. 2004-10-18 Kevin Greiner <kgreiner@compsol.cc> * lisp/gnus/gnus-agent.el (gnus-agent-synchronize-group-flags): Replaced gnus-request-update-info with explicit code to sync the in-memory info read flags with the marks being sync'd to the backend. 2004-10-18 Kevin Greiner <kgreiner@compsol.cc> * lisp/gnus/gnus-agent.el (gnus-agent-possibly-synchronize-flags): Ignore servers that are offline. Avoids having gnus-agent-toggle-plugged first ask if you want to open a server and then, even when you responded with no, asking if you want to synchronize the server's flags. (gnus-agent-synchronize-flags-server): Rewrote read loop to handle multi-line expressions. (gnus-agent-synchronize-group-flags): New internal function. Updates marks in memory (in the info structure) AND in the backend. (gnus-agent-check-overview-buffer): Fixed range of deletion to remove entire duplicate line. Fixes merged article number bug. * lisp/gnus/gnus-util.el (gnus-remassoc): Fixed typo in documentation. * lisp/gnus/nnagent.el (nnagent-request-set-mark): Use gnus-agent-synchronize-group-flags, not backend's request-set-mark method, to ensure that synchronization updates marks in the backend and in the info (in memory) structure. 2004-10-18 Kevin Greiner <kgreiner@compsol.cc> * lisp/gnus/gnus-agent.el (gnus-agent-synchronize-flags-server): Do nothing unless plugged. Disable the agent so that an open failure causes an error. 2004-10-18 Kevin Greiner <kevin.greiner@compsol.cc> for Reiner Steib <Reiner.Steib@gmx.de> * lisp/gnus/gnus-agent.el (gnus-agent-fetched-hook): Add :version. (gnus-agent-go-online): Change :version. (gnus-agent-expire-unagentized-dirs) (gnus-agent-auto-agentize-methods): Add :version. 2004-10-18 Kevin Greiner <kgreiner@compsol.cc> * lisp/gnus/legacy-gnus-agent.el (gnus-agent-convert-to-compressed-agentview-prompt): New function. Used internally to only display 'gnus converting files' message when actually necessary. * lisp/gnus/gnus-sum.el (): Removed (require 'gnus-agent) as required methods now autoloaded. * lisp/gnus/gnus-int.el (gnus-request-move-article): Use gnus-agent-unfetch-articles in place of gnus-agent-expire to improve performance. 2004-10-18 Kevin Greiner <kgreiner@compsol.cc> * lisp/gnus/gnus-agent.el (gnus-agent-cat-groups): rewrote avoiding defsetf to avoid run-time CL dependencies. (gnus-agent-unfetch-articles): New function. (gnus-agent-fetch-headers): Use gnus-agent-braid-nov to validate article numbers even when local .overview file is missing. (gnus-agent-read-article-number): New function. Only accepts 27-bit article numbers. (gnus-agent-copy-nov-line, gnus-agent-uncached-articles): Use gnus-agent-read-article-number. (gnus-agent-braid-nov): Rewrote to validate article numbers coming from backend while recognizing that article numbers in .overview must be valid. * lisp/gnus/gnus-start.el (gnus-convert-old-newsrc): Changed message text as some users confused by references to .newsrc when they only have a .newsrc.eld file. (gnus-convert-mark-converter-prompt, gnus-convert-converter-needs-prompt): Fixed use of property list. 2004-10-18 Kevin Greiner <kevin.greiner@compsol.cc> for Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/gnus-agent.el (gnus-agent-restore-gcc): Use ^ and regexp-quote. 2004-10-18 Kevin Greiner <kevin.greiner@compsol.cc> for Lars Magne Ingebrigtsen <larsi@gnus.org> * lisp/gnus/gnus-start.el (gnus-get-unread-articles-in-group): Don't do stuff for non-living groups. 2004-10-18 Kevin Greiner <kevin.greiner@compsol.cc> for Lars Magne Ingebrigtsen <larsi@gnus.org> * lisp/gnus/gnus-agent.el (gnus-agent-synchronize-flags): Default to nil. (gnus-agent-regenerate-group): Using nil messages aren't valid. 2004-10-18 Kevin Greiner <kevin.greiner@compsol.cc> for Lars Magne Ingebrigtsen <larsi@gnus.org> * lisp/gnus/gnus-agent.el (gnus-agent-read-agentview): Inline gnus-uncompress-range. 2004-10-18 Kevin Greiner <kgreiner@xpediantsolutions.com> * lisp/gnus/legacy-gnus-agent.el (gnus-agent-convert-to-compressed-agentview): Fixed typos with help from Florian Weimer <fw@deneb.enyo.de> * lisp/gnus/gnus-agent.el (gnus-agentize): gnus-agent-send-mail-real-function no longer set to current value of message-send-mail-function but rather a lambda that calls message-send-mail-function. The change makes the agent real-time responsive to user changes to message-send-mail-function. 2004-10-18 Kevin Greiner <kevin.greiner@compsol.cc> for Reiner Steib <Reiner.Steib@gmx.de> * lisp/gnus/gnus-start.el (gnus-get-unread-articles): Fix last commit. 2004-10-18 Kevin Greiner <kgreiner@xpediantsolutions.com> * lisp/gnus/gnus-cache.el (gnus-cache-rename-group): New function. (gnus-cache-delete-group): New function. * lisp/gnus/gnus-agent.el (gnus-agent-rename-group): New function. (gnus-agent-delete-group): New function. (gnus-agent-save-group-info): Use gnus-command-method when `method' parameter is nil. Don't write nil entries into the active file. (gnus-agent-get-group-info): New function. (gnus-agent-get-local): Added optional parameters to avoid calling gnus-group-real-name and gnus-find-method-for-group. (gnus-agent-set-local): Delete stored entry if either min, or max, are nil. (gnus-agent-fetch-session): Reworded error/quit messages. On quit, use gnus-agent-regenerate-group to record existance of any articles fetched to disk before the quit occurred. * lisp/gnus/gnus-int.el (gnus-request-delete-group): Use gnus-cache-delete-group and gnus-agent-delete-group to keep the local disk in sync with the server. (gnus-request-rename-group): Use gnus-cache-rename-group and gnus-agent-rename-group to keep the local disk in sync with the server. * lisp/gnus/gnus-start.el (gnus-get-unread-articles): Cosmetic simplification to logic. * lisp/gnus/gnus-group.el (): (gnus-group-delete-group): No longer update gnus-cache-active-altered as gnus-request-delete-group now keeps the cache in sync. (gnus-group-list-active): Let the agent store a server's active list if currently plugged. * lisp/gnus/gnus-util.el (gnus-rename-file): New function. 2004-10-18 Kevin Greiner <kevin.greiner@compsol.cc> for Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/gnus-agent.el (gnus-agent-regenerate-group): Activate the group when the group's active is not available. 2004-10-18 Kevin Greiner <kevin.greiner@compsol.cc> for Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/gnus-agent.el (gnus-agent-read-agentview): Add a missing arg to error. 2004-10-18 Kevin Greiner <kevin.greiner@compsol.cc> * lisp/gnus/gnus-start.el (gnus-convert-old-newsrc): Only write the conversion message to newsrc-dribble when an actual conversion is performed. 2004-10-18 Kevin Greiner <kevin.greiner@compsol.cc> * lisp/gnus/gnus-agent.el (gnus-agent-read-local): Bind nnheader-file-coding-system to gnus-agent-file-coding-system to avoid the implicit assumption that they will always be equal. (gnus-agent-save-local): Bind buffer-file-coding-system, not coding-system-for-write, as the with-temp-file macro first prints to a buffer then saves the buffer. 2004-10-18 Kevin Greiner <kgreiner@xpediantsolutions.com> * lisp/gnus/legacy-gnus-agent.el (): New. Provides converters that are only loaded when gnus-convert-old-newsrc needs to call them. * lisp/gnus/gnus-agent.el (gnus-agent-read-agentview): Removed support for old file versions. (gnus-group-prepare-hook): Removed function that converted list form of gnus-agent-expire-days to group properties. * lisp/gnus/gnus-start.el (gnus-convert-old-newsrc): Registered new converters to handle old agent file formats. Added logic for a "backup before upgrading warning". (gnus-convert-mark-converter-prompt): Developers can mark functions as needing (default), or not needing, gnus-convert-old-newsrc's "backup before upgrading warning". (gnus-convert-converter-needs-prompt): Tests whether the user should be protected from potentially irreversable changes by the function. 2004-10-18 Kevin Greiner <kgreiner@xpediantsolutions.com> * lisp/gnus/gnus-int.el (gnus-request-accept-article): Inform the agent that articles are being added to a group. (gnus-request-replace-article): Inform the agent that articles need to be uncached as the cached contents are no longer valid. * lisp/gnus/gnus-agent.el (gnus-agent-file-header-cache): Removed. (gnus-agent-possibly-alter-active): Avoid null in numeric comparison. (gnus-agent-set-local): Refuse to save null in local object table. (gnus-agent-regenerate-group): The REREAD parameter can now be a list of articles that will be marked as unread. 2004-10-18 Kevin Greiner <kevin.greiner@compsol.cc> * lisp/gnus/gnus-range.el (gnus-sorted-range-intersection): Now accepts single-interval range of the form (min . max). Previously the range had to look like ((min . max)). Likewise, return (min . max) rather than ((min . max)). (gnus-range-map): Use gnus-range-normalize to accept single-interval range. * lisp/gnus/gnus-sum.el (gnus-summary-highlight-line): Articles stored in the cache, but not the agent, now appear with their usual face. 2004-10-18 Kevin Greiner <kevin.greiner@compsol.cc> * lisp/gnus/gnus-sum.el (gnus-adjust-marks): Now correctly handles a list of marks consisting of a single range {for example, (3 . 5)} rather than a list of a single range { ((3 . 5)) }. 2004-10-18 Kevin Greiner <kevin.greiner@compsol.cc> * lisp/gnus/gnus-sum.el (gnus-adjust-marks): Avoid splicing null INTO the uncompressed list. 2004-10-18 Kevin Greiner <kevin.greiner@compsol.cc> * lisp/gnus/gnus-draft.el (gnus-group-send-queue): Pass the group name "nndraft:queue" along to gnus-draft-send. Use gnus-agent-prompt-send-queue. (gnus-draft-send): Rebind gnus-agent-queue-mail to nil when group is "nndraft:queue". Suggested by Gaute Strokkenes <gs234@srcf.ucam.org> * lisp/gnus/gnus-group.el (gnus-group-catchup): Use new gnus-sequence-of-unread-articles, not gnus-list-of-unread-articles, to avoid exhausting memory with huge numbers of articles. Use gnus-range-map to avoid having to uncompress the unread list. (gnus-group-archive-directory, gnus-group-recent-archive-directory): Fixed invalid ange-ftp reference. * lisp/gnus/gnus-range.el (gnus-range-map): Iterate over list or sequence. (gnus-sorted-range-intersection): Intersection of two ranges without requiring that they first be uncompressed. * lisp/gnus/gnus-start.el (gnus-activate-group): Unless blocked by the caller, possibly expand the active range to include both cached and agentized articles. (gnus-convert-old-newsrc): Rewrote in anticipation of having multiple version-dependent converters. (gnus-groups-to-gnus-format): Replaced gnus-agent-save-groups with gnus-agent-save-active. (gnus-save-newsrc-file): Save dirty agent range limits. * lisp/gnus/gnus-sum.el (gnus-select-newgroup): Replaced inline code with gnus-agent-possibly-alter-active. (gnus-adjust-marked-articles): Faster handling of simple lists 2004-10-18 David Edmondson <dme@dme.org> * lisp/gnus/mm-view.el (mm-w3m-cid-retrieve-1): Don't use recursive call excessively.
author Miles Bader <miles@gnu.org>
date Tue, 19 Oct 2004 22:38:28 +0000
parents 645f020dcc8a
children c660fc46d193
comparison
equal deleted inserted replaced
57616:9b79e93065fc 57617:7fdc1df35f39
1 ;;; gnus-start.el --- startup functions for Gnus 1 ;;; gnus-start.el --- startup functions for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
3 ;; Free Software Foundation, Inc. 3 ;; Free Software Foundation, Inc.
4 4
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> 5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;; Keywords: news 6 ;; Keywords: news
7 7
32 (require 'gnus-spec) 32 (require 'gnus-spec)
33 (require 'gnus-range) 33 (require 'gnus-range)
34 (require 'gnus-util) 34 (require 'gnus-util)
35 (autoload 'message-make-date "message") 35 (autoload 'message-make-date "message")
36 (autoload 'gnus-agent-read-servers-validate "gnus-agent") 36 (autoload 'gnus-agent-read-servers-validate "gnus-agent")
37 (autoload 'gnus-agent-save-local "gnus-agent")
37 (autoload 'gnus-agent-possibly-alter-active "gnus-agent") 38 (autoload 'gnus-agent-possibly-alter-active "gnus-agent")
38 (eval-when-compile (require 'cl)) 39
40 (eval-when-compile
41 (require 'cl)
42
43 (defvar gnus-agent-covered-methods nil)
44 (defvar gnus-agent-file-loading-local nil)
45 (defvar gnus-agent-file-loading-cache nil))
39 46
40 (defcustom gnus-startup-file (nnheader-concat gnus-home-directory ".newsrc") 47 (defcustom gnus-startup-file (nnheader-concat gnus-home-directory ".newsrc")
41 "Your `.newsrc' file. 48 "Your `.newsrc' file.
42 `.newsrc-SERVER' will be used instead if that exists." 49 `.newsrc-SERVER' will be used instead if that exists."
43 :group 'gnus-start 50 :group 'gnus-start
661 (setq variables (cdr variables)))) 668 (setq variables (cdr variables))))
662 ;; Clear other internal variables. 669 ;; Clear other internal variables.
663 (setq gnus-list-of-killed-groups nil 670 (setq gnus-list-of-killed-groups nil
664 gnus-have-read-active-file nil 671 gnus-have-read-active-file nil
665 gnus-agent-covered-methods nil 672 gnus-agent-covered-methods nil
673 gnus-agent-file-loading-local nil
674 gnus-agent-file-loading-cache nil
666 gnus-server-method-cache nil 675 gnus-server-method-cache nil
667 gnus-newsrc-alist nil 676 gnus-newsrc-alist nil
668 gnus-newsrc-hashtb nil 677 gnus-newsrc-hashtb nil
669 gnus-killed-list nil 678 gnus-killed-list nil
670 gnus-zombie-list nil 679 gnus-zombie-list nil
1509 (if (and (zerop (car active)) 1518 (if (and (zerop (car active))
1510 (zerop (cdr active)) 1519 (zerop (cdr active))
1511 (gnus-active group)) 1520 (gnus-active group))
1512 (gnus-active group) 1521 (gnus-active group)
1513 1522
1523 ;; If a cache is present, we may have to alter the active info.
1524 (when gnus-use-cache
1525 (inline (gnus-cache-possibly-alter-active
1526 group active)))
1527
1528 ;; If the agent is enabled, we may have to alter the active info.
1529 (when gnus-agent
1530 (gnus-agent-possibly-alter-active group active))
1531
1514 (gnus-set-active group active) 1532 (gnus-set-active group active)
1515 ;; Return the new active info. 1533 ;; Return the new active info.
1516 active))))) 1534 active)))))
1517 1535
1518 (defun gnus-get-unread-articles-in-group (info active &optional update) 1536 (defun gnus-get-unread-articles-in-group (info active &optional update)
1519 (when active 1537 (when (and info active)
1520 ;; Allow the backend to update the info in the group. 1538 ;; Allow the backend to update the info in the group.
1521 (when (and update 1539 (when (and update
1522 (gnus-request-update-info 1540 (gnus-request-update-info
1523 info (inline (gnus-find-method-for-group 1541 info (inline (gnus-find-method-for-group
1524 (gnus-info-group info))))) 1542 (gnus-info-group info)))))
1525 (gnus-activate-group (gnus-info-group info) nil t)) 1543 (gnus-activate-group (gnus-info-group info) nil t))
1526 1544
1527 (let* ((range (gnus-info-read info)) 1545 (let* ((range (gnus-info-read info))
1528 (num 0)) 1546 (num 0))
1547
1548 ;; These checks are present in gnus-activate-group but skipped
1549 ;; due to setting dont-check in the preceeding call.
1550
1529 ;; If a cache is present, we may have to alter the active info. 1551 ;; If a cache is present, we may have to alter the active info.
1530 (when (and gnus-use-cache info) 1552 (when (and gnus-use-cache info)
1531 (inline (gnus-cache-possibly-alter-active 1553 (inline (gnus-cache-possibly-alter-active
1532 (gnus-info-group info) active))) 1554 (gnus-info-group info) active)))
1533 1555
1534 ;; If the agent is enabled, we may have to alter the active info. 1556 ;; If the agent is enabled, we may have to alter the active info.
1535 (when (and gnus-agent info) 1557 (when (and gnus-agent info)
1536 (gnus-agent-possibly-alter-active 1558 (gnus-agent-possibly-alter-active (gnus-info-group info) active info))
1537 (gnus-info-group info) active))
1538 1559
1539 ;; Modify the list of read articles according to what articles 1560 ;; Modify the list of read articles according to what articles
1540 ;; are available; then tally the unread articles and add the 1561 ;; are available; then tally the unread articles and add the
1541 ;; number to the group hash table entry. 1562 ;; number to the group hash table entry.
1542 (cond 1563 (cond
1628 method-type) 1649 method-type)
1629 (gnus-message 6 "Checking new news...") 1650 (gnus-message 6 "Checking new news...")
1630 1651
1631 (while newsrc 1652 (while newsrc
1632 (setq active (gnus-active (setq group (gnus-info-group 1653 (setq active (gnus-active (setq group (gnus-info-group
1633 (setq info (pop newsrc)))))) 1654 (setq info (pop newsrc))))))
1634 1655
1635 ;; Check newsgroups. If the user doesn't want to check them, or 1656 ;; Check newsgroups. If the user doesn't want to check them, or
1636 ;; they can't be checked (for instance, if the news server can't 1657 ;; they can't be checked (for instance, if the news server can't
1637 ;; be reached) we just set the number of unread articles in this 1658 ;; be reached) we just set the number of unread articles in this
1638 ;; newsgroup to t. This means that Gnus thinks that there are 1659 ;; newsgroup to t. This means that Gnus thinks that there are
1651 (push (cons method cmethod) methods-cache) 1672 (push (cons method cmethod) methods-cache)
1652 (setq method cmethod))) 1673 (setq method cmethod)))
1653 (when (and method 1674 (when (and method
1654 (not (setq method-type (cdr (assoc method type-cache))))) 1675 (not (setq method-type (cdr (assoc method type-cache)))))
1655 (setq method-type 1676 (setq method-type
1656 (cond 1677 (cond
1657 ((gnus-secondary-method-p method) 1678 ((gnus-secondary-method-p method)
1658 'secondary) 1679 'secondary)
1659 ((inline (gnus-server-equal gnus-select-method method)) 1680 ((inline (gnus-server-equal gnus-select-method method))
1660 'primary) 1681 'primary)
1661 (t 1682 (t
1662 'foreign))) 1683 'foreign)))
1663 (push (cons method method-type) type-cache)) 1684 (push (cons method method-type) type-cache))
1664 (if (and method 1685
1665 (eq method-type 'foreign)) 1686 (cond ((and method (eq method-type 'foreign))
1666 ;; These groups are foreign. Check the level. 1687 ;; These groups are foreign. Check the level.
1667 (when (and (<= (gnus-info-level info) foreign-level) 1688 (when (and (<= (gnus-info-level info) foreign-level)
1668 (setq active (gnus-activate-group group 'scan))) 1689 (setq active (gnus-activate-group group 'scan)))
1669 ;; Let the Gnus agent save the active file. 1690 ;; Let the Gnus agent save the active file.
1670 (when (and gnus-agent active (gnus-online method)) 1691 (when (and gnus-agent active (gnus-online method))
1671 (gnus-agent-save-group-info 1692 (gnus-agent-save-group-info
1672 method (gnus-group-real-name group) active)) 1693 method (gnus-group-real-name group) active))
1673 (unless (inline (gnus-virtual-group-p group)) 1694 (unless (inline (gnus-virtual-group-p group))
1674 (inline (gnus-close-group group))) 1695 (inline (gnus-close-group group)))
1675 (when (fboundp (intern (concat (symbol-name (car method)) 1696 (when (fboundp (intern (concat (symbol-name (car method))
1676 "-request-update-info"))) 1697 "-request-update-info")))
1677 (inline (gnus-request-update-info info method)))) 1698 (inline (gnus-request-update-info info method)))))
1678 ;; These groups are native or secondary. 1699 ;; These groups are native or secondary.
1679 (cond 1700 ((> (gnus-info-level info) level)
1680 ;; We don't want these groups. 1701 ;; We don't want these groups.
1681 ((> (gnus-info-level info) level) 1702 (setq active 'ignore))
1682 (setq active 'ignore)) 1703 ;; Activate groups.
1683 ;; Activate groups. 1704 ((not gnus-read-active-file)
1684 ((not gnus-read-active-file) 1705 (if (gnus-check-backend-function 'retrieve-groups group)
1685 (if (gnus-check-backend-function 'retrieve-groups group) 1706 ;; if server support gnus-retrieve-groups we push
1686 ;; if server support gnus-retrieve-groups we push 1707 ;; the group onto retrievegroups for later checking
1687 ;; the group onto retrievegroups for later checking 1708 (if (assoc method retrieve-groups)
1688 (if (assoc method retrieve-groups) 1709 (setcdr (assoc method retrieve-groups)
1689 (setcdr (assoc method retrieve-groups) 1710 (cons group (cdr (assoc method retrieve-groups))))
1690 (cons group (cdr (assoc method retrieve-groups)))) 1711 (push (list method group) retrieve-groups))
1691 (push (list method group) retrieve-groups)) 1712 ;; hack: `nnmail-get-new-mail' changes the mail-source depending
1692 ;; hack: `nnmail-get-new-mail' changes the mail-source depending 1713 ;; on the group, so we must perform a scan for every group
1693 ;; on the group, so we must perform a scan for every group 1714 ;; if the users has any directory mail sources.
1694 ;; if the users has any directory mail sources. 1715 ;; hack: if `nnmail-scan-directory-mail-source-once' is non-nil,
1695 ;; hack: if `nnmail-scan-directory-mail-source-once' is non-nil, 1716 ;; for it scan all spool files even when the groups are
1696 ;; for it scan all spool files even when the groups are 1717 ;; not required.
1697 ;; not required. 1718 (if (and
1698 (if (and 1719 (or nnmail-scan-directory-mail-source-once
1699 (or nnmail-scan-directory-mail-source-once 1720 (null (assq 'directory
1700 (null (assq 'directory 1721 (or mail-sources
1701 (or mail-sources 1722 (if (listp nnmail-spool-file)
1702 (if (listp nnmail-spool-file) 1723 nnmail-spool-file
1703 nnmail-spool-file 1724 (list nnmail-spool-file))))))
1704 (list nnmail-spool-file)))))) 1725 (member method scanned-methods))
1705 (member method scanned-methods)) 1726 (setq active (gnus-activate-group group))
1706 (setq active (gnus-activate-group group)) 1727 (setq active (gnus-activate-group group 'scan))
1707 (setq active (gnus-activate-group group 'scan)) 1728 (push method scanned-methods))
1708 (push method scanned-methods)) 1729 (when active
1709 (when active 1730 (gnus-close-group group)))))
1710 (gnus-close-group group))))))
1711 1731
1712 ;; Get the number of unread articles in the group. 1732 ;; Get the number of unread articles in the group.
1713 (cond 1733 (cond
1714 ((eq active 'ignore) 1734 ((eq active 'ignore)
1715 ;; Don't do anything. 1735 ;; Don't do anything.
1732 (when (gnus-check-server method) 1752 (when (gnus-check-server method)
1733 ;; Request that the backend scan its incoming messages. 1753 ;; Request that the backend scan its incoming messages.
1734 (when (gnus-check-backend-function 'request-scan (car method)) 1754 (when (gnus-check-backend-function 'request-scan (car method))
1735 (gnus-request-scan nil method)) 1755 (gnus-request-scan nil method))
1736 (gnus-read-active-file-2 1756 (gnus-read-active-file-2
1737 (mapcar (lambda (group) (gnus-group-real-name group)) groups) 1757 (mapcar (lambda (group) (gnus-group-real-name group)) groups)
1738 method) 1758 method)
1739 (dolist (group groups) 1759 (dolist (group groups)
1740 (cond 1760 (cond
1741 ((setq active (gnus-active (gnus-info-group 1761 ((setq active (gnus-active (gnus-info-group
1742 (setq info (gnus-get-info group))))) 1762 (setq info (gnus-get-info group)))))
1743 (inline (gnus-get-unread-articles-in-group info active t))) 1763 (inline (gnus-get-unread-articles-in-group info active t)))
1978 (gmethod (gnus-server-get-method nil method)) 1998 (gmethod (gnus-server-get-method nil method))
1979 groups info) 1999 groups info)
1980 (while (setq info (pop newsrc)) 2000 (while (setq info (pop newsrc))
1981 (when (inline 2001 (when (inline
1982 (gnus-server-equal 2002 (gnus-server-equal
1983 (inline 2003 (inline
1984 (gnus-find-method-for-group 2004 (gnus-find-method-for-group
1985 (gnus-info-group info) info)) 2005 (gnus-info-group info) info))
1986 gmethod)) 2006 gmethod))
1987 (push (gnus-group-real-name (gnus-info-group info)) 2007 (push (gnus-group-real-name (gnus-info-group info))
1988 groups))) 2008 groups)))
1989 (gnus-read-active-file-2 groups method))) 2009 (gnus-read-active-file-2 groups method)))
1990 ((null method) 2010 ((null method)
1991 t) 2011 t)
2125 (if (and gnus-agent 2145 (if (and gnus-agent
2126 real-active 2146 real-active
2127 (gnus-online method) 2147 (gnus-online method)
2128 (gnus-agent-method-p method)) 2148 (gnus-agent-method-p method))
2129 (progn 2149 (progn
2130 (gnus-agent-save-groups method) 2150 (gnus-agent-save-active method)
2131 (gnus-active-to-gnus-format method hashtb nil real-active)) 2151 (gnus-active-to-gnus-format method hashtb nil real-active))
2132 2152
2133 (goto-char (point-min)) 2153 (goto-char (point-min))
2134 ;; We split this into to separate loops, one with the prefix 2154 ;; We split this into to separate loops, one with the prefix
2135 ;; and one without to speed the reading up somewhat. 2155 ;; and one without to speed the reading up somewhat.
2201 2221
2202 ;; Convert old to new. 2222 ;; Convert old to new.
2203 (gnus-convert-old-newsrc)))) 2223 (gnus-convert-old-newsrc))))
2204 2224
2205 (defun gnus-convert-old-newsrc () 2225 (defun gnus-convert-old-newsrc ()
2206 "Convert old newsrc into the new format, if needed." 2226 "Convert old newsrc formats into the current format, if needed."
2207 (let ((fcv (and gnus-newsrc-file-version 2227 (let ((fcv (and gnus-newsrc-file-version
2208 (gnus-continuum-version gnus-newsrc-file-version)))) 2228 (gnus-continuum-version gnus-newsrc-file-version))))
2209 (cond 2229 (when fcv
2210 ;; No .newsrc.eld file was loaded. 2230 ;; A newsrc file was loaded.
2211 ((null fcv) nil) 2231 (let (prompt-displayed
2212 ;; Gnus 5 .newsrc.eld was loaded. 2232 (converters
2213 ((< fcv (gnus-continuum-version "September Gnus v0.1")) 2233 (sort
2214 (gnus-convert-old-ticks))))) 2234 (mapcar (lambda (date-func)
2215 2235 (cons (gnus-continuum-version (car date-func))
2216 (defun gnus-convert-old-ticks () 2236 date-func))
2237 ;; This is a list of converters that must be run
2238 ;; to bring the newsrc file up to the current
2239 ;; version. If you create an incompatibility
2240 ;; with older versions, you should create an
2241 ;; entry here. The entry should consist of the
2242 ;; current gnus version (hardcoded so that it
2243 ;; doesn't change with each release) and the
2244 ;; function that must be applied to convert the
2245 ;; previous version into the current version.
2246 '(("September Gnus v0.1" nil
2247 gnus-convert-old-ticks)
2248 ("Oort Gnus v0.08" "legacy-gnus-agent"
2249 gnus-agent-convert-to-compressed-agentview)
2250 ("No Gnus v0.2" "legacy-gnus-agent"
2251 gnus-agent-unlist-expire-days)
2252 ("No Gnus v0.2" "legacy-gnus-agent"
2253 gnus-agent-unhook-expire-days)))
2254 #'car-less-than-car)))
2255 ;; Skip converters older than the file version
2256 (while (and converters (>= fcv (caar converters)))
2257 (pop converters))
2258
2259 ;; Perform converters to bring older version up to date.
2260 (when (and converters (< fcv (caar converters)))
2261 (while (and converters (< fcv (caar converters)))
2262 (let* ((converter-spec (pop converters))
2263 (convert-to (nth 1 converter-spec))
2264 (load-from (nth 2 converter-spec))
2265 (func (nth 3 converter-spec)))
2266 (when (and load-from
2267 (not (fboundp func)))
2268 (load load-from t))
2269
2270 (or prompt-displayed
2271 (not (gnus-convert-converter-needs-prompt func))
2272 (while (let (c
2273 (cursor-in-echo-area t)
2274 (echo-keystrokes 0))
2275 (message "Convert gnus from version '%s' to '%s'? (n/y/?)"
2276 gnus-newsrc-file-version gnus-version)
2277 (setq c (read-char-exclusive))
2278
2279 (cond ((or (eq c ?n) (eq c ?N))
2280 (error "Can not start gnus without converting"))
2281 ((or (eq c ?y) (eq c ?Y))
2282 (setq prompt-displayed t)
2283 nil)
2284 ((eq c ?\?)
2285 (message "This conversion is irreversible. \
2286 To be safe, you should backup your files before proceeding.")
2287 (sit-for 5)
2288 t)
2289 (t
2290 (gnus-message 3 "Ignoring unexpected input")
2291 (sit-for 3)
2292 t)))))
2293
2294 (funcall func convert-to)))
2295 (gnus-dribble-enter
2296 (format ";Converted gnus from version '%s' to '%s'."
2297 gnus-newsrc-file-version gnus-version)))))))
2298
2299 (defun gnus-convert-mark-converter-prompt (converter no-prompt)
2300 "Indicate whether CONVERTER requires gnus-convert-old-newsrc to
2301 display the conversion prompt. NO-PROMPT may be nil (prompt),
2302 t (no prompt), or any form that can be called as a function.
2303 The form should return either t or nil."
2304 (put converter 'gnus-convert-no-prompt no-prompt))
2305
2306 (defun gnus-convert-converter-needs-prompt (converter)
2307 (let ((no-prompt (get converter 'gnus-convert-no-prompt)))
2308 (not (if (memq no-prompt '(t nil))
2309 no-prompt
2310 (funcall no-prompt)))))
2311
2312 (defun gnus-convert-old-ticks (converting-to)
2217 (let ((newsrc (cdr gnus-newsrc-alist)) 2313 (let ((newsrc (cdr gnus-newsrc-alist))
2218 marks info dormant ticked) 2314 marks info dormant ticked)
2219 (while (setq info (pop newsrc)) 2315 (while (setq info (pop newsrc))
2220 (when (setq marks (gnus-info-marks info)) 2316 (when (setq marks (gnus-info-marks info))
2221 (setq dormant (cdr (assq 'dormant marks)) 2317 (setq dormant (cdr (assq 'dormant marks))
2591 "Save .newsrc file." 2687 "Save .newsrc file."
2592 ;; Note: We cannot save .newsrc file if all newsgroups are removed 2688 ;; Note: We cannot save .newsrc file if all newsgroups are removed
2593 ;; from the variable gnus-newsrc-alist. 2689 ;; from the variable gnus-newsrc-alist.
2594 (when (and (or gnus-newsrc-alist gnus-killed-list) 2690 (when (and (or gnus-newsrc-alist gnus-killed-list)
2595 gnus-current-startup-file) 2691 gnus-current-startup-file)
2692 ;; Save agent range limits for the currently active method.
2693 (when gnus-agent
2694 (gnus-agent-save-local force))
2695
2596 (save-excursion 2696 (save-excursion
2597 (if (and (or gnus-use-dribble-file gnus-slave) 2697 (if (and (or gnus-use-dribble-file gnus-slave)
2598 (not force) 2698 (not force)
2599 (or (not gnus-dribble-buffer) 2699 (or (not gnus-dribble-buffer)
2600 (not (buffer-name gnus-dribble-buffer)) 2700 (not (buffer-name gnus-dribble-buffer))
2608 ;; Save .newsrc. 2708 ;; Save .newsrc.
2609 (when gnus-save-newsrc-file 2709 (when gnus-save-newsrc-file
2610 (gnus-message 8 "Saving %s..." gnus-current-startup-file) 2710 (gnus-message 8 "Saving %s..." gnus-current-startup-file)
2611 (gnus-gnus-to-newsrc-format) 2711 (gnus-gnus-to-newsrc-format)
2612 (gnus-message 8 "Saving %s...done" gnus-current-startup-file)) 2712 (gnus-message 8 "Saving %s...done" gnus-current-startup-file))
2713
2613 ;; Save .newsrc.eld. 2714 ;; Save .newsrc.eld.
2614 (set-buffer (gnus-get-buffer-create " *Gnus-newsrc*")) 2715 (set-buffer (gnus-get-buffer-create " *Gnus-newsrc*"))
2615 (make-local-variable 'version-control) 2716 (make-local-variable 'version-control)
2616 (setq version-control gnus-backup-startup-file) 2717 (setq version-control gnus-backup-startup-file)
2617 (setq buffer-file-name 2718 (setq buffer-file-name