From: kaoru Date: Sat, 1 Feb 2003 00:48:12 +0000 (+0000) Subject: * elmo-localdir.el (elmo-folder-rename-internal): Referctoring; X-Git-Tag: wl-2_10_1pre~34 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8708aceaab8ee9029d0b3e8c8b09f59aea925e86;p=elisp%2Fwanderlust.git * elmo-localdir.el (elmo-folder-rename-internal): Referctoring; Replace nested conditional with guard clauses. * elmo-archive.el (elmo-folder-rename-internal): Ditto. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 79aadea..98d3ff1 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,9 @@ 2003-02-01 TAKAHASHI Kaoru + * elmo-localdir.el (elmo-folder-rename-internal): Referctoring; + Replace nested conditional with guard clauses. + * elmo-archive.el (elmo-folder-rename-internal): Ditto. + * elmo-imap4.el: Remove Nemacs hack, replace `elmo-read' with `read'. * elmo-util.el: Ditto. diff --git a/elmo/elmo-archive.el b/elmo/elmo-archive.el index ce97bb6..c903302 100644 --- a/elmo/elmo-archive.el +++ b/elmo/elmo-archive.el @@ -465,12 +465,14 @@ TYPE specifies the archiver's symbol." (elmo-archive-folder-archive-prefix-internal new-folder))) (error "Not same archive type and prefix")) - (if (not (file-exists-p old-arc)) - (error "No such file: %s" old-arc) - (if (file-exists-p new-arc) - (error "Already exists: %s" new-arc) - (rename-file old-arc new-arc) - t)))) + (unless (file-exists-p old-arc) + (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)) (defun elmo-archive-folder-list-subfolders (folder one-level) (if elmo-archive-treat-file diff --git a/elmo/elmo-localdir.el b/elmo/elmo-localdir.el index 7b7f114..3ab93a0 100644 --- a/elmo/elmo-localdir.el +++ b/elmo/elmo-localdir.el @@ -311,14 +311,14 @@ (let* ((old (elmo-localdir-folder-directory-internal folder)) (new (elmo-localdir-folder-directory-internal new-folder)) (new-dir (directory-file-name (file-name-directory new)))) - (if (not (file-directory-p old)) - (error "No such directory: %s" old) - (if (file-exists-p new) - (error "Already exists directory: %s" new) - (if (not (file-exists-p new-dir)) - (elmo-make-directory new-dir)) - (rename-file old new) - t)))) + (unless (file-directory-p old) + (error "No such directory: %s" old)) + (when (file-exists-p new) + (error "Already exists directory: %s" new)) + (unless (file-directory-p new-dir) + (elmo-make-directory new-dir)) + (rename-file old new) + t)) (defsubst elmo-localdir-field-condition-match (folder condition number number-list)