Skip to content

Commit

Permalink
Avoiding repetition
Browse files Browse the repository at this point in the history
Used mapcar in order to avoid the repetition
  • Loading branch information
dotemacs committed May 2, 2017
1 parent c02c15f commit c33fc5f
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions clj-refactor.el
Original file line number Diff line number Diff line change
Expand Up @@ -760,16 +760,18 @@ A new record is created to define this constructor."

;; ------ file -----------

(defun cljr--locate-project-file (file)
(ignore-errors
(file-truename
(locate-dominating-file default-directory file))))

(defun cljr--project-dir ()
(or (ignore-errors
(file-truename
(locate-dominating-file default-directory "project.clj")))
(ignore-errors
(file-truename
(locate-dominating-file default-directory "build.boot")))
(ignore-errors (file-truename
(locate-dominating-file default-directory "pom.xml")))
""))
(or
(thread-last '("project.clj" "build.boot" "pom.xml")
(mapcar 'cljr--locate-project-file)
(delete 'nil)
car)
""))

(defun cljr--project-file ()
(let ((project-dir (cljr--project-dir)))
Expand Down

0 comments on commit c33fc5f

Please sign in to comment.