From 5a455ef63d2453cc7baa4a38e9707a5ccba7621c Mon Sep 17 00:00:00 2001 From: teranisi Date: Wed, 1 May 2002 07:54:02 +0000 Subject: [PATCH] * elmo-util.el (elmo-delete-match-files): New function. * elmo-localdir.el (elmo-folder-delete): Use elmo-delete-match-files instead of elmo-delete-directory. --- elmo/ChangeLog | 5 +++++ elmo/elmo-localdir.el | 2 +- elmo/elmo-util.el | 12 ++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 5ec850e..7080578 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,10 @@ 2002-05-01 Yuuichi Teranishi + * elmo-util.el (elmo-delete-match-files): New function. + + * elmo-localdir.el (elmo-folder-delete): Use elmo-delete-match-files + instead of elmo-delete-directory. + * elmo-shimbun.el (elmo-shimbun-get-headers): Bind elmo-hash-minimun-size as 63. diff --git a/elmo/elmo-localdir.el b/elmo/elmo-localdir.el index b85d9c9..2fa24e5 100644 --- a/elmo/elmo-localdir.el +++ b/elmo/elmo-localdir.el @@ -299,7 +299,7 @@ (let ((dir (elmo-localdir-folder-directory-internal folder))) (if (not (file-directory-p dir)) (error "No such directory: %s" dir) - (elmo-delete-directory dir t) + (elmo-delete-match-files dir "[0-9]+" t) t))) (luna-define-method elmo-folder-rename-internal ((folder elmo-localdir-folder) diff --git a/elmo/elmo-util.el b/elmo/elmo-util.el index 90cc8be..34dddcd 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -732,6 +732,18 @@ Return value is a cons cell of (STRUCTURE . REST)" (unless hierarchy (delete-directory path))))) +(defun elmo-delete-match-files (path regexp &optional remove-if-empty) + "Delete directory files specified by PATH. +If optional REMOVE-IF-EMPTY is non-nil, delete directory itself if +the directory becomes empty after deletion." + (when (stringp path) ; nil is not permitted. + (dolist (file (directory-files path t regexp)) + (delete-file file)) + (if remove-if-empty + (ignore-errors + (delete-directory path) ; should be removed if empty. + )))) + (defun elmo-list-filter (l1 l2) "L1 is filter." (if (eq l1 t) -- 1.7.10.4