X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/a1506d2977a8c2eb982ad0b59416009cdfaa6f51..a457417ee5ba797ab1c91d35ee957bb7a7f8d4b6:/lisp/gnus/nnsoup.el diff --git a/lisp/gnus/nnsoup.el b/lisp/gnus/nnsoup.el index eaa56aa934..1053ecc413 100644 --- a/lisp/gnus/nnsoup.el +++ b/lisp/gnus/nnsoup.el @@ -1,17 +1,17 @@ ;;; nnsoup.el --- SOUP access for Gnus -;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2002 -;; Free Software Foundation, Inc. +;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, +;; 2004, 2005, 2006, 2007 Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen -;; Masanobu UMEDA +;; Masanobu UMEDA ;; Keywords: news, mail ;; This file is part of GNU Emacs. ;; 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.") @@ -337,7 +339,7 @@ backend for the messages.") (delete-file (nnsoup-file prefix t))) t) (setcdr (cdr total-infolist) (delq info (cddr total-infolist))) - (setq articles (gnus-sorted-complement articles range-list)))) + (setq articles (gnus-sorted-difference articles range-list)))) (when (not mod-time) (setcdr (cdr total-infolist) (delq info (cddr total-infolist))))) (if (cddr total-infolist) @@ -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)) @@ -556,9 +556,8 @@ backend for the messages.") (defun nnsoup-unpack-packets () "Unpack all packets in `nnsoup-packet-directory'." (let ((packets (directory-files - nnsoup-packet-directory t nnsoup-packet-regexp)) - packet) - (while (setq packet (pop packets)) + nnsoup-packet-directory t nnsoup-packet-regexp))) + (dolist (packet packets) (nnheader-message 5 "nnsoup: unpacking %s..." packet) (if (not (gnus-soup-unpack-packet nnsoup-tmp-directory nnsoup-unpacker packet)) @@ -656,20 +655,20 @@ backend for the messages.") (and areas (car areas)))) (defvar nnsoup-old-functions - (list message-send-mail-function message-send-news-function)) + (list message-send-mail-real-function message-send-news-function)) ;;;###autoload (defun nnsoup-set-variables () "Use the SOUP methods for posting news and mailing mail." (interactive) (setq message-send-news-function 'nnsoup-request-post) - (setq message-send-mail-function 'nnsoup-request-mail)) + (setq message-send-mail-real-function 'nnsoup-request-mail)) ;;;###autoload (defun nnsoup-revert-variables () "Revert posting and mailing methods to the standard Emacs methods." (interactive) - (setq message-send-mail-function (car nnsoup-old-functions)) + (setq message-send-mail-real-function (car nnsoup-old-functions)) (setq message-send-news-function (cadr nnsoup-old-functions))) (defun nnsoup-store-reply (kind) @@ -752,25 +751,23 @@ 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*")) - (while files - (nnheader-message 5 "Doing %s..." (car files)) + (dolist (file files) + (nnheader-message 5 "Doing %s..." file) (erase-buffer) - (nnheader-insert-file-contents (car files)) + (nnheader-insert-file-contents file) (goto-char (point-min)) (if (not (re-search-forward "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t *\\(Xref: \\)? *[^ ]* \\([^ ]+\\):[0-9]" nil t)) (setq group "unknown") (setq group (match-string 2))) (setq lines (count-lines (point-min) (point-max))) (setq ident (progn (string-match - "/\\([0-9]+\\)\\." (car files)) - (substring - (car files) (match-beginning 1) - (match-end 1)))) + "/\\([0-9]+\\)\\." file) + (match-string 1 file))) (if (not (setq elem (assoc group active))) (push (list group (cons 1 lines) (list (cons 1 lines) @@ -781,8 +778,7 @@ backend for the messages.") (list (cons (1+ (setq min (cdadr elem))) (+ min lines)) (vector ident group "ucm" "" lines)))) - (setcdr (cadr elem) (+ min lines))) - (setq files (cdr files))) + (setcdr (cadr elem) (+ min lines)))) (nnheader-message 5 "") (setq nnsoup-group-alist active) (nnsoup-write-active-file t))) @@ -799,9 +795,9 @@ backend for the messages.") nnsoup-group-alist))) (regexp "\\.MSG$\\|\\.IDX$") (files (directory-files nnsoup-directory nil regexp)) - non-files file) + non-files) ;; Find all files that aren't known by nnsoup. - (while (setq file (pop files)) + (dolist (file files) (string-match regexp file) (unless (member (substring file 0 (match-beginning 0)) known) (push file non-files))) @@ -814,4 +810,5 @@ backend for the messages.") (provide 'nnsoup) +;;; arch-tag: b0451389-5703-4450-9425-f66f6b38c828 ;;; nnsoup.el ends here