Skip to content

Commit dd9c342

Browse files
committed
Avoiding repetition
Used mapcar in order to avoid the repetition
1 parent 4aa26aa commit dd9c342

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

clj-refactor.el

+11-9
Original file line numberDiff line numberDiff line change
@@ -760,16 +760,18 @@ A new record is created to define this constructor."
760760

761761
;; ------ file -----------
762762

763+
(defun cljr--locate-project-file (file)
764+
(ignore-errors
765+
(file-truename
766+
(locate-dominating-file default-directory file))))
767+
763768
(defun cljr--project-dir ()
764-
(or (ignore-errors
765-
(file-truename
766-
(locate-dominating-file default-directory "project.clj")))
767-
(ignore-errors
768-
(file-truename
769-
(locate-dominating-file default-directory "build.boot")))
770-
(ignore-errors (file-truename
771-
(locate-dominating-file default-directory "pom.xml")))
772-
""))
769+
(or
770+
(thread-last '("project.clj" "build.boot" "pom.xml")
771+
(mapcar 'cljr--locate-project-file)
772+
(delete '"")
773+
car)
774+
""))
773775

774776
(defun cljr--project-file ()
775777
(let ((project-dir (cljr--project-dir)))

0 commit comments

Comments
 (0)