From 84254bbdf069f0386f188d0e2bc5be795a9272bb Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 7 Mar 2014 16:00:34 +0100 Subject: [PATCH] * gnus-agent.el (gnus-agent-update-files-total-fetched-for): Don't bug out if the directory doesn't exist. --- lisp/gnus/ChangeLog | 5 +++++ lisp/gnus/gnus-agent.el | 44 +++++++++++++++++++++++--------------------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 76c358c38d4..dd66afc34c4 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,8 @@ +2014-03-07 Lars Ingebrigtsen + + * gnus-agent.el (gnus-agent-update-files-total-fetched-for): Don't bug + out if the directory doesn't exist. + 2014-03-05 Lars Ingebrigtsen * gnus-group.el (gnus-group-make-group): Clarify prompt. diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el index 432aabbc4ad..67525ee0c1b 100644 --- a/lisp/gnus/gnus-agent.el +++ b/lisp/gnus/gnus-agent.el @@ -4121,8 +4121,8 @@ CLEAN is obsolete and ignored." (defun gnus-agent-group-covered-p (group) (gnus-agent-method-p (gnus-group-method group))) -(defun gnus-agent-update-files-total-fetched-for - (group delta &optional method path) +(defun gnus-agent-update-files-total-fetched-for (group delta + &optional method path) "Update, or set, the total disk space used by the articles that the agent has fetched." (when gnus-agent-total-fetched-hashtb @@ -4135,27 +4135,29 @@ agent has fetched." (gnus-sethash path (make-list 3 0) gnus-agent-total-fetched-hashtb))) (file-name-coding-system nnmail-pathname-coding-system)) - (when (listp delta) - (if delta - (let ((sum 0.0) + (when (file-exists-p path) + (when (listp delta) + (if delta + (let ((sum 0.0) + file) + (while (setq file (pop delta)) + (incf sum (float (or (nth 7 (file-attributes + (nnheader-concat + path + (if (numberp file) + (number-to-string file) + file)))) 0)))) + (setq delta sum)) + (let ((sum (- (nth 2 entry))) + (info (directory-files-and-attributes + path nil "^-?[0-9]+$" t)) file) - (while (setq file (pop delta)) - (incf sum (float (or (nth 7 (file-attributes - (nnheader-concat - path - (if (numberp file) - (number-to-string file) - file)))) 0)))) - (setq delta sum)) - (let ((sum (- (nth 2 entry))) - (info (directory-files-and-attributes path nil "^-?[0-9]+$" t)) - file) - (while (setq file (pop info)) - (incf sum (float (or (nth 8 file) 0)))) - (setq delta sum)))) + (while (setq file (pop info)) + (incf sum (float (or (nth 8 file) 0)))) + (setq delta sum)))) - (setq gnus-agent-need-update-total-fetched-for t) - (incf (nth 2 entry) delta))))) + (setq gnus-agent-need-update-total-fetched-for t) + (incf (nth 2 entry) delta)))))) (defun gnus-agent-update-view-total-fetched-for (group agent-over &optional method path) -- 2.11.4.GIT