Clean up
This commit is contained in:
parent
a4fd3f3be5
commit
b78d210ace
11 changed files with 71 additions and 82 deletions
|
@ -4,24 +4,8 @@
|
|||
(defun narf/project-root (&optional strict-p)
|
||||
"Get the path to the root of your project. Uses `narf-project-root-files' to
|
||||
determine if a directory is a project."
|
||||
(let (projectile-require-project-root strict-p) (projectile-project-root))
|
||||
;; (let ((home (file-truename "~"))
|
||||
;; (path default-directory))
|
||||
;; (unless (file-name-absolute-p path)
|
||||
;; (setq path (expand-file-name path)))
|
||||
;; (catch 'found
|
||||
;; (ignore-errors
|
||||
;; (f-traverse-upwards
|
||||
;; (lambda (path)
|
||||
;; (let ((path (file-truename path)))
|
||||
;; (if (file-equal-p home path)
|
||||
;; (throw 'found (if strict-p nil default-directory))
|
||||
;; (dolist (file narf-project-root-files)
|
||||
;; (when (file-exists-p (expand-file-name file path))
|
||||
;; (throw 'found path))))))
|
||||
;; path))
|
||||
;; default-directory))
|
||||
)
|
||||
(let (projectile-require-project-root strict-p)
|
||||
(projectile-project-root)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/project-has-files (files &optional root)
|
||||
|
@ -29,22 +13,19 @@ determine if a directory is a project."
|
|||
(let ((root (or root (narf/project-root)))
|
||||
(files (if (listp files) files (list files)))
|
||||
(found-p (if files t)))
|
||||
(while found-p
|
||||
(setq found-p (file-exists-p (narf/project-path-to (pop files) root))))
|
||||
(while (and found-p files)
|
||||
(let ((file (expand-file-name (pop files) root)))
|
||||
(setq found-p (if (string-suffix-p "/" file)
|
||||
(file-directory-p file)
|
||||
(file-exists-p file)))))
|
||||
found-p))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/project-path-to (file &optional root)
|
||||
(let ((root (or root (narf/project-root))))
|
||||
(expand-file-name file root)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/project-name (&optional root)
|
||||
(file-name-nondirectory (directory-file-name (or root (narf/project-root)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/project-p ()
|
||||
(not (null (narf/project-root t))))
|
||||
(defalias 'narf/project-p 'projectile-project-p)
|
||||
|
||||
(provide 'defuns-project)
|
||||
;;; defuns-project.el ends here
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue