From: yamaoka Date: Fri, 17 Dec 2004 10:28:20 +0000 (+0000) Subject: Synch to No Gnus 200412171027. X-Git-Tag: t-gnus-6_17_4-quimby-~629 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4bcd16b887f6cc77798fa83d85cb7bfa9633b7fb;p=elisp%2Fgnus.git- Synch to No Gnus 200412171027. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f34f9a9..d5f9646 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2004-12-17 Katsumi Yamaoka + + * gnus-util.el (gnus-delete-directory): New function. + + * gnus-agent.el (gnus-agent-delete-group): Use it. + + * gnus-cache.el (gnus-cache-delete-group): Use it. + 2004-12-16 Katsumi Yamaoka * gnus-group.el (gnus-group-make-rss-group): Unify non-ASCII group diff --git a/lisp/gnus-agent.el b/lisp/gnus-agent.el index b018bb6..e169ff0 100644 --- a/lisp/gnus-agent.el +++ b/lisp/gnus-agent.el @@ -917,7 +917,7 @@ next enabled. Depends upon the caller to determine whether group deletion is sup (path (directory-file-name (let (gnus-command-method command-method) (gnus-agent-group-pathname group))))) - (gnus-delete-file path) + (gnus-delete-directory path) (let* ((real-group (gnus-group-real-name group))) (gnus-agent-save-group-info command-method real-group nil) diff --git a/lisp/gnus-cache.el b/lisp/gnus-cache.el index 68dc1b1..f5a957a 100644 --- a/lisp/gnus-cache.el +++ b/lisp/gnus-cache.el @@ -761,7 +761,7 @@ next enabled. Depends upon the caller to determine whether group renaming is sup disabled, as the old cache files would corrupt gnus when the cache was next enabled. Depends upon the caller to determine whether group deletion is supported." (let ((dir (gnus-cache-file-name group ""))) - (gnus-delete-file dir)) + (gnus-delete-directory dir)) (gnus-cache-delete-group-total-fetched-for group) diff --git a/lisp/gnus-util.el b/lisp/gnus-util.el index beaf6f7..c58fa16 100644 --- a/lisp/gnus-util.el +++ b/lisp/gnus-util.el @@ -724,6 +724,23 @@ Bind `print-quoted' and `print-readably' to t, and `print-length' and (when (file-exists-p file) (delete-file file))) +(defun gnus-delete-directory (directory) + "Delete files in DIRECTORY. Subdirectories remain. +If there's no subdirectory, delete DIRECTORY as well." + (when (file-directory-p directory) + (let ((files (directory-files + directory t "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")) + file dir) + (while files + (setq file (pop files)) + (if (eq t (car (file-attributes file))) + ;; `file' is a subdirectory. + (setq dir t) + ;; `file' is a file or a symlink. + (delete-file file))) + (unless dir + (delete-directory directory))))) + (defun gnus-strip-whitespace (string) "Return STRING stripped of all whitespace." (while (string-match "[\r\n\t ]+" string)