From 8085a55bcbb2976a861361e7084205a3908f16fd Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 31 Oct 2018 14:45:51 -0400 Subject: [PATCH] ui/neotree: fix open/find-this-file commands #992 A not-so-recent update to projectile caused doom-project-root's signature to change (it can now return nil, if not in a project). This fixes +neotree/open and +neotree/find-this-file to account for this new behavior, by resorting to default-directory in the absence of a project. --- modules/ui/neotree/autoload.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/ui/neotree/autoload.el b/modules/ui/neotree/autoload.el index 0855c807a..cf53d5ac5 100644 --- a/modules/ui/neotree/autoload.el +++ b/modules/ui/neotree/autoload.el @@ -8,18 +8,19 @@ (defun +neotree/open () "Open the neotree window in the current project." (interactive) - (let ((project-root (doom-project-root))) - (require 'neotree) - (if (neo-global--window-exists-p) - (neotree-hide) - (neotree-dir project-root)))) + (require 'neotree) + (if (neo-global--window-exists-p) + (neotree-hide) + (neotree-dir (or (doom-project-root) + default-directory)))) ;;;###autoload (defun +neotree/find-this-file () "Open the neotree window in the current project, and find the current file." (interactive) (let ((path buffer-file-name) - (project-root (doom-project-root))) + (project-root (or (doom-project-root) + default-directory))) (require 'neotree) (cond ((and (neo-global--window-exists-p) (get-buffer-window neo-buffer-name t))