commit 39e2faaf5092476156e81fc107e716a6e7845398 parent ac11fc4e82146ec4df82027897225ae05ebf7ee2 Author: Vincent Demeester <vincent@sbr.pm> Date: Tue, 9 Jul 2024 18:18:10 +0200 tools/emacs: add a project-root-or-default-directory function Signed-off-by: Vincent Demeester <vincent@sbr.pm> Diffstat:
M | tools/emacs/lisp/project-func.el | | | 7 | +++++++ |
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/tools/emacs/lisp/project-func.el b/tools/emacs/lisp/project-func.el @@ -10,5 +10,12 @@ (project-root (project-current)) (cdr (project-current)))) +(defun vde-project--project-root-or-default-directory () + "Return path to the project root *or* the default-directory." + (cond + ((and (featurep 'project) (project-current)) + (project-root (project-current))) + (t default-directory))) + (provide 'project-func) ;;; project-func.el ends here