Trailing whitepace deleted.
[bpt/emacs.git] / lisp / gnus / gnus-agent.el
index 39f1dde..77e3043 100644 (file)
@@ -2,7 +2,6 @@
 ;; Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
-;; Maintainer: bugs@gnus.org
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
@@ -83,12 +82,14 @@ If nil, only read articles will be expired."
 
 (defcustom gnus-agent-confirmation-function 'y-or-n-p
   "Function to confirm when error happens."
+  :version "21.1"
   :group 'gnus-agent
   :type 'function)
 
 (defcustom gnus-agent-synchronize-flags 'ask
   "Indicate if flags are synchronized when you plug in.
 If this is `ask' the hook will query the user."
+  :version "21.1"
   :type '(choice (const :tag "Always" t)
                 (const :tag "Never" nil)
                 (const :tag "Ask" ask))
@@ -165,13 +166,15 @@ If this is `ask' the hook will query the user."
            (cadr gnus-command-method))))
 
 (defsubst gnus-agent-directory ()
-  "Path of the Gnus agent directory."
+  "The name of the Gnus agent directory."
   (nnheader-concat gnus-agent-directory
                   (nnheader-translate-file-chars (gnus-agent-method)) "/"))
 
 (defun gnus-agent-lib-file (file)
-  "The full path of the Gnus agent library FILE."
-  (concat (gnus-agent-directory) "agent.lib/" file))
+  "The full name of the Gnus agent library FILE."
+  (expand-file-name file
+                   (file-name-as-directory
+                    (expand-file-name "agent.lib" (gnus-agent-directory)))))
 
 ;;; Fetching setup functions.
 
@@ -390,10 +393,10 @@ be a select method."
   (save-restriction
     (message-narrow-to-headers)
     (let* ((gcc (mail-fetch-field "gcc" nil t))
-          (methods (and gcc 
+          (methods (and gcc
                         (mapcar 'gnus-inews-group-method
                                 (message-unquote-tokens
-                                 (message-tokenize-header 
+                                 (message-tokenize-header
                                   gcc " ,")))))
           covered)
       (while (and (not covered) methods)
@@ -510,7 +513,7 @@ be a select method."
   (when (or (and gnus-agent-synchronize-flags
                 (not (eq gnus-agent-synchronize-flags 'ask)))
            (and (eq gnus-agent-synchronize-flags 'ask)
-                (gnus-y-or-n-p (format "Synchronize flags on server `%s'? " 
+                (gnus-y-or-n-p (format "Synchronize flags on server `%s'? "
                                        (cadr method)))))
     (gnus-agent-synchronize-flags-server method)))
 
@@ -699,7 +702,7 @@ the actual number of articles toggled is returned."
       (gnus-make-directory (file-name-directory file))
       (with-temp-file file
        ;; Emacs got problem to match non-ASCII group in multibyte buffer.
-       (mm-disable-multibyte) 
+       (mm-disable-multibyte)
        (when (file-exists-p file)
          (nnheader-insert-file-contents file))
        (goto-char (point-min))
@@ -721,13 +724,13 @@ the actual number of articles toggled is returned."
          (delete-char 1))))))
 
 (defun gnus-agent-group-path (group)
-  "Translate GROUP into a path."
+  "Translate GROUP into a file name."
   (if nnmail-use-long-file-names
       (gnus-group-real-name group)
     (nnheader-translate-file-chars
      (nnheader-replace-chars-in-string
       (nnheader-replace-duplicate-chars-in-string
-       (nnheader-replace-chars-in-string 
+       (nnheader-replace-chars-in-string
        (gnus-group-real-name group)
        ?/ ?_)
        ?. ?_)
@@ -844,8 +847,8 @@ the actual number of articles toggled is returned."
          (with-temp-buffer
            (let (article)
              (while (setq article (pop articles))
-               (when (or 
-                      (gnus-backlog-request-article group article 
+               (when (or
+                      (gnus-backlog-request-article group article
                                                     nntp-server-buffer)
                       (gnus-request-article article group))
                  (goto-char (point-max))
@@ -1043,14 +1046,14 @@ the actual number of articles toggled is returned."
   (setq gnus-agent-article-alist
        (gnus-agent-read-file
         (if dir
-            (concat dir ".agentview")
+            (expand-file-name ".agentview" dir)
           (gnus-agent-article-name ".agentview" group)))))
 
 (defun gnus-agent-save-alist (group &optional articles state dir)
   "Save the article-state alist for GROUP."
   (let ((file-name-coding-system nnmail-pathname-coding-system))
       (with-temp-file (if dir
-                         (concat dir ".agentview")
+                         (expand-file-name ".agentview" dir)
                        (gnus-agent-article-name ".agentview" group))
        (princ (setq gnus-agent-article-alist
                     (nconc gnus-agent-article-alist
@@ -1060,8 +1063,10 @@ the actual number of articles toggled is returned."
        (insert "\n"))))
 
 (defun gnus-agent-article-name (article group)
-  (concat (gnus-agent-directory) (gnus-agent-group-path group) "/"
-         (if (stringp article) article (string-to-number article))))
+  (expand-file-name (if (stringp article) article (string-to-number article))
+                   (file-name-as-directory
+                    (expand-file-name (gnus-agent-group-path group)
+                                      (gnus-agent-directory)))))
 
 (defun gnus-agent-batch-confirmation (msg)
   "Show error message and return t."
@@ -1098,11 +1103,11 @@ the actual number of articles toggled is returned."
                  (while (setq group (pop groups))
                    (when (<= (gnus-group-level group) gnus-agent-handle-level)
                      (gnus-agent-fetch-group-1 group gnus-command-method))))))
-         (error 
+         (error
           (unless (funcall gnus-agent-confirmation-function
                            (format "Error (%s).  Continue? " err))
-            (error "Cannot fetch articles into the Gnus agent.")))
-         (quit 
+            (error "Cannot fetch articles into the Gnus agent")))
+         (quit
           (unless (funcall gnus-agent-confirmation-function
                            (format "Quit (%s).  Continue? " err))
             (signal 'quit "Cannot fetch articles into the Gnus agent."))))
@@ -1133,7 +1138,7 @@ the actual number of articles toggled is returned."
                 (setq gnus-newsgroup-dependencies
                       (make-vector (length articles) 0))
                 (setq gnus-newsgroup-headers
-                      (gnus-get-newsgroup-headers-xover articles nil nil 
+                      (gnus-get-newsgroup-headers-xover articles nil nil
                                                         group))
                 ;; `gnus-agent-overview-buffer' may be killed for
                 ;; timeout reason.  If so, recreate it.
@@ -1527,7 +1532,7 @@ The following commands are available:
        (when (file-exists-p (gnus-agent-lib-file "active"))
          (with-temp-buffer
            (nnheader-insert-file-contents (gnus-agent-lib-file "active"))
-           (gnus-active-to-gnus-format 
+           (gnus-active-to-gnus-format
             gnus-command-method
             (setq orig (gnus-make-hashtable
                         (count-lines (point-min) (point-max))))))
@@ -1593,7 +1598,7 @@ The following commands are available:
                                 (or (not (numberp
                                           (setq art (read (current-buffer)))))
                                     (< art article)))
-                      (if (and (numberp art) 
+                      (if (and (numberp art)
                                (file-exists-p
                                 (gnus-agent-article-name
                                  (number-to-string art) group)))