Merge from emacs--devo--0
[gnus] / lisp / nnsoup.el
index 3db41d5..24825e1 100644 (file)
@@ -1,7 +1,7 @@
 ;;; nnsoup.el --- SOUP access for Gnus
 
-;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-;;     Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+;;   2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
@@ -11,7 +11,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -21,8 +21,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
@@ -37,7 +37,7 @@
 
 (nnoo-declare nnsoup)
 
-(defvoo nnsoup-directory "~/SOUP/"
+(defvoo nnsoup-directory (nnheader-concat gnus-home-directory "SOUP/")
   "*SOUP packet directory.")
 
 (defvoo nnsoup-tmp-directory
@@ -58,7 +58,9 @@
 (defvoo nnsoup-active-file (expand-file-name "active" nnsoup-directory)
   "Active file.")
 
-(defvoo nnsoup-packer "tar cf - %s | gzip > $HOME/Soupin%d.tgz"
+(defvoo nnsoup-packer (concat "tar cf - %s | gzip > "
+                             (expand-file-name gnus-home-directory)
+                             "Soupin%d.tgz")
   "Format string command for packing a SOUP packet.
 The SOUP files will be inserted where the %s is in the string.
 This string MUST contain both %s and %d.  The file number will be
@@ -68,14 +70,14 @@ inserted where %d appears.")
   "*Format string command for unpacking a SOUP packet.
 The SOUP packet file name will be inserted at the %s.")
 
-(defvoo nnsoup-packet-directory "~/"
+(defvoo nnsoup-packet-directory gnus-home-directory
   "*Where nnsoup will look for incoming packets.")
 
 (defvoo nnsoup-packet-regexp "Soupout"
   "*Regular expression matching SOUP packets in `nnsoup-packet-directory'.")
 
 (defvoo nnsoup-always-save t
-  "If non nil commit the reply buffer on each message send.
+  "If non-nil commit the reply buffer on each message send.
 This is necessary if using message mode outside Gnus with nnsoup as a
 backend for the messages.")
 
@@ -369,9 +371,7 @@ backend for the messages.")
            entry e min max)
        (while (setq e (cdr (setq entry (pop alist))))
          (setq min (caaar e))
-         (while (cdr e)
-           (setq e (cdr e)))
-         (setq max (cdar (car e)))
+         (setq max (cdar (car (last e))))
          (setcdr entry (cons (cons min max) (cdr entry)))))
       (setq nnsoup-group-alist-touched t))
     nnsoup-group-alist))
@@ -751,9 +751,9 @@ backend for the messages.")
   (let ((files (sort (directory-files nnsoup-directory t "IDX$")
                     (lambda (f1 f2)
                       (< (progn (string-match "/\\([0-9]+\\)\\." f1)
-                                (string-to-int (match-string 1 f1)))
+                                (string-to-number (match-string 1 f1)))
                          (progn (string-match "/\\([0-9]+\\)\\." f2)
-                                (string-to-int (match-string 1 f2)))))))
+                                (string-to-number (match-string 1 f2)))))))
        active group lines ident elem min)
     (set-buffer (get-buffer-create " *nnsoup work*"))
     (dolist (file files)