diff options
author | David Morgan <djm_uk@protonmail.com> | 2021-09-02 16:37:04 +0100 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2021-09-02 16:37:04 +0100 |
commit | ceafcdc42d84c10ec6070537fb1d5d465bc29bdb (patch) | |
tree | f522ad1e008ec07ac87f30e001791d84da73cec8 | |
parent | 8f8d172d4c924742d0b7fbdcc2098440d2a77552 (diff) | |
download | dotfiles-ceafcdc42d84c10ec6070537fb1d5d465bc29bdb.tar.gz |
Prevent error if there's no project open
-rw-r--r-- | .emacs.d/lisp/init-minibuffer.el | 18 |
1 files changed, 9 insertions, 9 deletions
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" |