From 54749d04e63cc69f84756ff90aa66e57210b2f54 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 19 Oct 2018 23:27:58 -0400 Subject: [PATCH] Have :P modifier throw error when not in a project If it returns nil, it will throw a stringp error otherwise. --- modules/feature/evil/autoload/advice.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/feature/evil/autoload/advice.el b/modules/feature/evil/autoload/advice.el index 1ee8a4f3a..c56b87518 100644 --- a/modules/feature/evil/autoload/advice.el +++ b/modules/feature/evil/autoload/advice.el @@ -133,8 +133,11 @@ more information on modifiers." (unless global 1)))) path)) ("P" - (let ((default-directory (file-name-directory (expand-file-name path)))) - (abbreviate-file-name (doom-project-root)))) + (let* ((default-directory (file-name-directory (expand-file-name path))) + (project-root (doom-project-root))) + (unless project-root + (user-error "Not in a project")) + (abbreviate-file-name project-root))) (_ path)) ""))) ;; strip trailing slash, if applicable