From 56146522133dc618336a5a16fd9e390fb84164d5 Mon Sep 17 00:00:00 2001 From: yoichi Date: Sun, 30 Mar 2003 09:28:19 +0000 Subject: [PATCH] * wl/wl-fldmgr.el (wl-fldmgr-delete): Move confirmation to elmo side, cut visible folder when elmo-folder-delete returns non-nil value. * elmo/elmo.el (elmo-folder-delete): Confirm deletion here, return t if the folder has been deleted successfully. * elmo/elmo-imap4.el (elmo-folder-delete): Ditto. * elmo/elmo-archive.el (elmo-folder-delete): Ditto. * elmo/elmo-localdir.el (elmo-folder-delete): Ditto. * elmo/elmo-maildir.el (elmo-folder-delete): Ditto. --- elmo/ChangeLog | 9 +++++++++ elmo/elmo-archive.el | 20 ++++++++++++++------ elmo/elmo-imap4.el | 31 +++++++++++++++++++------------ elmo/elmo-localdir.el | 18 +++++++++++++----- elmo/elmo-maildir.el | 40 ++++++++++++++++++++++++---------------- elmo/elmo.el | 5 ++++- wl/ChangeLog | 5 +++++ wl/wl-fldmgr.el | 11 ++--------- 8 files changed, 90 insertions(+), 49 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 24bba10..2203b05 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,12 @@ +2003-03-30 Yoichi NAKAYAMA + + * elmo.el (elmo-folder-delete): Confirm deletion here, return t if + the folder has been deleted successfully. + * elmo-imap4.el (elmo-folder-delete): Ditto. + * elmo-archive.el (elmo-folder-delete): Ditto. + * elmo-localdir.el (elmo-folder-delete): Ditto. + * elmo-maildir.el (elmo-folder-delete): Ditto. + 2003-03-27 Tetsurou Okazaki * elmo-util.el (elmo-string-member-ignore-case): New function. diff --git a/elmo/elmo-archive.el b/elmo/elmo-archive.el index 62dc48a..f76d026 100644 --- a/elmo/elmo-archive.el +++ b/elmo/elmo-archive.el @@ -447,12 +447,20 @@ TYPE specifies the archiver's symbol." (delete-file dummy))) )))) -(luna-define-method elmo-folder-delete :before ((folder elmo-archive-folder)) - (let ((arc (elmo-archive-get-archive-name folder))) - (if (not (file-exists-p arc)) - (error "No such file: %s" arc) - (delete-file arc) - t))) +(luna-define-method elmo-folder-delete ((folder elmo-archive-folder)) + (let ((msgs (and (elmo-folder-exists-p folder) + (elmo-folder-list-messages folder)))) + (when (yes-or-no-p (format "%sDelete msgdb and substance of \"%s\"? " + (if (> (length msgs) 0) + (format "%d msg(s) exists. " (length msgs)) + "") + (elmo-folder-name-internal folder))) + (let ((arc (elmo-archive-get-archive-name folder))) + (if (not (file-exists-p arc)) + (error "No such file: %s" arc) + (delete-file arc)) + (elmo-msgdb-delete-path folder) + t)))) (luna-define-method elmo-folder-rename-internal ((folder elmo-archive-folder) new-folder) diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 70e5041..a33a241 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -1973,18 +1973,25 @@ Return nil if no complete line has arrived." (luna-define-method elmo-folder-writable-p ((folder elmo-imap4-folder)) t) -(luna-define-method elmo-folder-delete :before ((folder elmo-imap4-folder)) - (let ((session (elmo-imap4-get-session folder)) - msgs) - (when (elmo-imap4-folder-mailbox-internal folder) - (when (setq msgs (elmo-folder-list-messages folder)) - (elmo-folder-delete-messages folder msgs)) - (elmo-imap4-send-command-wait session "close") - (elmo-imap4-send-command-wait - session - (list "delete " - (elmo-imap4-mailbox - (elmo-imap4-folder-mailbox-internal folder))))))) +(luna-define-method elmo-folder-delete ((folder elmo-imap4-folder)) + (let ((msgs (and (elmo-folder-exists-p folder) + (elmo-folder-list-messages folder)))) + (when (yes-or-no-p (format "%sDelete msgdb and substance of \"%s\"? " + (if (> (length msgs) 0) + (format "%d msg(s) exists. " (length msgs)) + "") + (elmo-folder-name-internal folder))) + (let ((session (elmo-imap4-get-session folder))) + (when (elmo-imap4-folder-mailbox-internal folder) + (when msgs (elmo-folder-delete-messages folder msgs)) + (elmo-imap4-send-command-wait session "close") + (elmo-imap4-send-command-wait + session + (list "delete " + (elmo-imap4-mailbox + (elmo-imap4-folder-mailbox-internal folder)))))) + (elmo-msgdb-delete-path folder) + t))) (luna-define-method elmo-folder-rename-internal ((folder elmo-imap4-folder) new-folder) diff --git a/elmo/elmo-localdir.el b/elmo/elmo-localdir.el index f030437..176b4ef 100644 --- a/elmo/elmo-localdir.el +++ b/elmo/elmo-localdir.el @@ -299,11 +299,19 @@ (elmo-make-directory dir)) t))) -(luna-define-method elmo-folder-delete :before ((folder elmo-localdir-folder)) - (let ((dir (elmo-localdir-folder-directory-internal folder))) - (if (not (file-directory-p dir)) - (error "No such directory: %s" dir) - (elmo-delete-match-files dir "[0-9]+" t) +(luna-define-method elmo-folder-delete ((folder elmo-localdir-folder)) + (let ((msgs (and (elmo-folder-exists-p folder) + (elmo-folder-list-messages folder)))) + (when (yes-or-no-p (format "%sDelete msgdb and substance of \"%s\"? " + (if (> (length msgs) 0) + (format "%d msg(s) exists. " (length msgs)) + "") + (elmo-folder-name-internal folder))) + (let ((dir (elmo-localdir-folder-directory-internal folder))) + (if (not (file-directory-p dir)) + (error "No such directory: %s" dir) + (elmo-delete-match-files dir "[0-9]+" t))) + (elmo-msgdb-delete-path folder) t))) (luna-define-method elmo-folder-rename-internal ((folder elmo-localdir-folder) diff --git a/elmo/elmo-maildir.el b/elmo/elmo-maildir.el index 0cf693c..286c274 100644 --- a/elmo/elmo-maildir.el +++ b/elmo/elmo-maildir.el @@ -465,22 +465,30 @@ file name for maildir directories." t) (error)))) -(luna-define-method elmo-folder-delete :before ((folder elmo-maildir-folder)) - (let ((basedir (elmo-maildir-folder-directory-internal folder))) - (condition-case nil - (let ((tmp-files (directory-files - (expand-file-name "tmp" basedir) - t "[^.].*"))) - ;; Delete files in tmp. - (dolist (file tmp-files) - (delete-file file)) - (dolist (dir '("new" "cur" "tmp" ".")) - (setq dir (expand-file-name dir basedir)) - (if (not (file-directory-p dir)) - (error nil) - (elmo-delete-directory dir t))) - t) - (error nil)))) +(luna-define-method elmo-folder-delete ((folder elmo-maildir-folder)) + (let ((msgs (and (elmo-folder-exists-p folder) + (elmo-folder-list-messages folder)))) + (when (yes-or-no-p (format "%sDelete msgdb and substance of \"%s\"? " + (if (> (length msgs) 0) + (format "%d msg(s) exists. " (length msgs)) + "") + (elmo-folder-name-internal folder))) + (let ((basedir (elmo-maildir-folder-directory-internal folder))) + (condition-case nil + (let ((tmp-files (directory-files + (expand-file-name "tmp" basedir) + t "[^.].*"))) + ;; Delete files in tmp. + (dolist (file tmp-files) + (delete-file file)) + (dolist (dir '("new" "cur" "tmp" ".")) + (setq dir (expand-file-name dir basedir)) + (if (not (file-directory-p dir)) + (error nil) + (elmo-delete-directory dir t)))) + (error nil))) + (elmo-msgdb-delete-path folder) + t))) (luna-define-method elmo-folder-rename-internal ((folder elmo-maildir-folder) new-folder) diff --git a/elmo/elmo.el b/elmo/elmo.el index e2f691a..3dcec71 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -698,7 +698,10 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") nil) ; default is not writable. (luna-define-method elmo-folder-delete ((folder elmo-folder)) - (elmo-msgdb-delete-path folder)) + (when (yes-or-no-p (format "Delete msgdb of \"%s\"? " + (elmo-folder-name-internal folder))) + (elmo-msgdb-delete-path folder) + t)) (luna-define-method elmo-folder-rename ((folder elmo-folder) new-name) (let* ((new-folder (elmo-make-folder new-name))) diff --git a/wl/ChangeLog b/wl/ChangeLog index cf53d05..c19fa71 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,5 +1,10 @@ 2003-03-30 Yoichi NAKAYAMA + * wl-fldmgr.el (wl-fldmgr-delete): Move confirmation to elmo side, + cut visible folder when elmo-folder-delete returns non-nil value. + +2003-03-30 Yoichi NAKAYAMA + * wl-draft.el (wl-draft-send-confirm): Display more info (advised by Kenichi OKADA ). diff --git a/wl/wl-fldmgr.el b/wl/wl-fldmgr.el index 7da121f..4e38b40 100644 --- a/wl/wl-fldmgr.el +++ b/wl/wl-fldmgr.el @@ -850,15 +850,8 @@ return value is diffs '(-new -unread -all)." (let* ((inhibit-read-only t) (tmp (wl-fldmgr-get-path-from-buffer)) (entity (elmo-string (nth 4 tmp))) - (folder (wl-folder-get-elmo-folder entity)) - (msgs (and (elmo-folder-exists-p folder) - (elmo-folder-list-messages folder)))) - (when (yes-or-no-p (format "%sDo you really want to delete \"%s\"? " - (if (> (length msgs) 0) - (format "%d msg(s) exists. " (length msgs)) - "") - entity)) - (elmo-folder-delete folder) + (folder (wl-folder-get-elmo-folder entity))) + (when (elmo-folder-delete folder) (wl-fldmgr-cut tmp nil t))))) (defun wl-fldmgr-rename () -- 1.7.10.4