Replace nested conditional with guard clauses.
* elmo-archive.el (elmo-folder-rename-internal): Ditto.
2003-02-01 TAKAHASHI Kaoru <kaoru@kaisei.org>
+ * 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.
(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
(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)