From 760a92e95204482d0df47aa6a402e44adc3ff3d5 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 2 Apr 2025 04:13:50 -0400 Subject: [PATCH] fix(ivy): counsel-projectile-switch-project: empty list on first run This is due to `counsel-projectile-switch-project` not initializing the known projects list before consulting the `projectile-known-projects` variable (or at the very least, calling the function of the same name, rather than referencing the variable directly). By changing counsel-projectile-remove-current-project, it now does. --- modules/completion/ivy/config.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/completion/ivy/config.el b/modules/completion/ivy/config.el index a3d453d6f..bef0746f6 100644 --- a/modules/completion/ivy/config.el +++ b/modules/completion/ivy/config.el @@ -326,6 +326,14 @@ workable results ripgrep produces, despite the error." (setf (alist-get 'projectile-find-file counsel-projectile-key-bindings) #'+ivy/projectile-find-file) + ;; HACK: Force `counsel-projectile-switch-project' to call + ;; `projectile-relevant-known-projects' and initialize the known projects + ;; list, because otherwise it's trying to read from the + ;; `projectile-known-projects' variable directly instead of calling the + ;; function of the same name. + ;; REVIEW: This should be fixed upstream. + (setq counsel-projectile-remove-current-project t) + ;; no highlighting visited files; slows down the filtering (ivy-set-display-transformer #'counsel-projectile-find-file nil)