Prevent error if there's no project open

This commit is contained in:
David Morgan 2021-09-02 16:37:04 +01:00
parent 8f8d172d4c
commit ceafcdc42d
1 changed files with 9 additions and 9 deletions

View File

@ -276,15 +276,15 @@
(setq consult--source-project-file
(plist-put consult--source-project-file
:items '(lambda ()
(let* ((root (consult--project-root))
(len (length root))
(inv-root (propertize root 'invisible t)))
(mapcar (lambda (x)
(concat inv-root (substring x len)))
(split-string
(shell-command-to-string
(format "fd --color never -t f -0 . %s" root))
"\0" t))))))
(when-let (root (consult--project-root))
(let ((len (length root))
(inv-root (propertize root 'invisible t)))
(mapcar (lambda (x)
(concat inv-root (substring x len)))
(split-string
(shell-command-to-string
(format "fd --color never -t f -0 . %s" root))
"\0" t)))))))
(defvar consult--source-perspective-buffer
`(:name "Perspective Buffer"