From 8708aceaab8ee9029d0b3e8c8b09f59aea925e86 Mon Sep 17 00:00:00 2001 From: kaoru Date: Sat, 1 Feb 2003 00:48:12 +0000 Subject: [PATCH] * elmo-localdir.el (elmo-folder-rename-internal): Referctoring; Replace nested conditional with guard clauses. * elmo-archive.el (elmo-folder-rename-internal): Ditto. --- elmo/ChangeLog | 4 ++++ elmo/elmo-archive.el | 14 ++++++++------ elmo/elmo-localdir.el | 16 ++++++++-------- 3 files changed, 20 insertions(+), 14 deletions(-) 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) -- 1.7.10.4