mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
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.
This commit is contained in:
@ -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))
|
||||
|
Reference in New Issue
Block a user