From: kaoru Date: Wed, 18 Jun 2003 17:56:19 +0000 (+0000) Subject: * elmo-archive.el (elmo-folder-rename-internal): Create directory X-Git-Tag: wl-2_10_1pre~9 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d12d3c2685198a90afdcecdb39393a836724424;p=elisp%2Fwanderlust.git * elmo-archive.el (elmo-folder-rename-internal): Create directory apropriately, mimic localdir's one. Based on the patch from KAMO Tomoyuki . * 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. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 72ae421..0e35366 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,16 @@ +2003-06-18 TAKAHASHI Kaoru + + * elmo-archive.el (elmo-folder-rename-internal): Create directory + apropriately, mimic localdir's one. + Based on the patch from KAMO Tomoyuki . + + * 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-06-15 TAKAHASHI Kaoru * elmo-maildir.el (elmo-folder-rename-internal): New method, @@ -13,7 +26,7 @@ (elmo-nntp-search-primitive): Do nothing when body search is invoked (although it is not used by the change above). (elmo-nntp-get-folders-info): Don't use replace-regexp. - + * elmo-multi.el (elmo-folder-search): Don't ignore error anymore. * elmo-localdir.el (elmo-folder-pack-numbers): onum, a member of diff --git a/elmo/elmo-archive.el b/elmo/elmo-archive.el index 2428b51..f76d026 100644 --- a/elmo/elmo-archive.el +++ b/elmo/elmo-archive.el @@ -1,4 +1,4 @@ -;;; elmo-archive.el --- Archive folder of ELMO. +;;; elmo-archive.el --- Archive folder of ELMO. -*- coding: euc-japan -*- ;; Copyright (C) 1998,1999,2000 OKUNISHI Fujikazu ;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi @@ -447,17 +447,29 @@ 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) (let* ((old-arc (elmo-archive-get-archive-name folder)) - (new-arc (elmo-archive-get-archive-name new-folder))) + (new-arc (elmo-archive-get-archive-name new-folder)) + (new-dir (directory-file-name + (elmo-archive-get-archive-directory new-folder)))) + (if elmo-archive-treat-file + (setq new-dir (directory-file-name (file-name-directory new-dir)))) (unless (and (eq (elmo-archive-folder-archive-type-internal folder) (elmo-archive-folder-archive-type-internal new-folder)) (equal (elmo-archive-folder-archive-prefix-internal @@ -469,6 +481,8 @@ TYPE specifies the archiver's symbol." (error "No such file: %s" old-arc)) (when (file-exists-p new-arc) (error "Already exists: %s" new-arc)) + (unless (file-directory-p new-dir) + (elmo-make-directory new-dir)) (rename-file old-arc new-arc) t)) diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 4524cbd..47b4668 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -1974,18 +1974,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)))