From ceafcdc42d84c10ec6070537fb1d5d465bc29bdb Mon Sep 17 00:00:00 2001 From: David Morgan Date: Thu, 2 Sep 2021 16:37:04 +0100 Subject: Prevent error if there's no project open --- .emacs.d/lisp/init-minibuffer.el | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to '.emacs.d/lisp') diff --git a/.emacs.d/lisp/init-minibuffer.el b/.emacs.d/lisp/init-minibuffer.el index f1d81a4..75be3cc 100644 --- a/.emacs.d/lisp/init-minibuffer.el +++ b/.emacs.d/lisp/init-minibuffer.el @@ -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" -- cgit 1.4.1-2-gfad0