Is there any way to get the current projectile root path in elisp.
Something similar to the command eproject-root
in eproject.
Thanks
Is there any way to get the current projectile root path in elisp.
Something similar to the command eproject-root
in eproject.
Thanks
There is! The function is called projectile-project-root
. You can see an example use here in my virtualenvwrapper.el project.
There is no single way to do this, as the definition of a project root is not built into emacs.
You can call:
ffip-project-root
for users of find-file-in-project.projectile-project-root
for users of projectile.Without depending on 3rd party packages you can use vc
directly (assuming projects use version control).
(defun my-vc-root-path-or-default (filepath &optional default)
"Return the version control directory from FILEPATH or DEFAULT."
(let ((vc-base-path default))
(condition-case err
(let ((vc-backend (ignore-errors (vc-responsible-backend filepath))))
(when vc-backend
(setq vc-base-path (vc-call-backend vc-backend 'root filepath))))
(error (message "Error creating vc-backend root name: %s" err)))
vc-base-path))
© 2022 - 2024 — McMap. All rights reserved.