From e5b1a59cb3ad2d74e747379e4e3c7bb28b63cf7d Mon Sep 17 00:00:00 2001 From: David Florness Date: Sun, 26 Jul 2026 20:54:04 -0400 Subject: [PATCH] ivy: replace counsel-projectile with ivy-mode and counsel-ag counsel-projectile builds its ag/rg/grep exclusion flags from projectile-ignored-files-rel and projectile-ignored-directories-rel. Projectile deleted both in fa2d9366, which unified ignore handling onto a single list of gitignore-style patterns and dropped the whole absolute-path helper family with no deprecation aliases. C-p s a has been dying with "Symbol's function definition is void: projectile-ignored-files-rel" ever since that landed. counsel-projectile has had no upstream commit since March 2022, so this will not be fixed there; projectile meanwhile cut four releases in two weeks and is still moving. Enable ivy-mode. The config ran counsel-mode but never ivy-mode, and those are not the same thing: counsel-mode only remaps a fixed list of built-ins, so everything reading through completing-read -- all of projectile's commands -- was falling back to default minibuffer completion. counsel-projectile was the only thing hiding that. With ivy-mode on, projectile's own commands get an ivy UI directly and the package is no longer load-bearing. Set projectile-switch-project-action to projectile-vc, replacing the setcar/--find-index hack that reordered counsel-projectile's action list to make vc the default. This also removes the config's last use of dash. Bind C-p s a to counsel-ag. projectile-ag hands off to ag.el's compilation buffer, whereas counsel-ag narrows in the minibuffer without creating one -- the behaviour counsel-projectile-ag provided. No wrapper is needed for this: counsel-ag resolves the git root itself, and ag honours .gitignore itself, so nothing here reaches into projectile internals that the ongoing 3.x churn could break again. Two things are given up. Project file lists are no longer frecency ranked, because projectile exposes that ordering through completing-read's display-sort-function metadata and ivy sorts via ivy-sort-functions-alist instead. C-p SPC, counsel-projectile's combined buffer/file list, is gone; projectile-dispatch on C-p m is the nearest native equivalent. Co-Authored-By: Claude Opus 5 --- lisp/dev.el | 9 +++++++-- lisp/ivy.el | 16 ++++++++-------- straight/versions/default.el | 1 - 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/lisp/dev.el b/lisp/dev.el index 6d17782..8dc2c2d 100644 --- a/lisp/dev.el +++ b/lisp/dev.el @@ -62,8 +62,13 @@ ;; sequence back into C-p -- breaking `C-p C-p' and spilling the rest into ;; the buffer. Drop the ESC binding so the sequence decodes normally. (define-key projectile-command-map (kbd "ESC") nil) - ;; Alternative to - (projectile-known-projects)) + ;; Force the known-projects list to load eagerly rather than on first use. + (projectile-known-projects) + + (setq projectile-switch-project-action #'projectile-vc) + ;; counsel-ag narrows in the minibuffer rather than popping ag.el's + ;; compilation buffer; it finds the git root and honors .gitignore itself. + (define-key projectile-command-map (kbd "s a") #'counsel-ag)) (use-package lsp-mode :defer t diff --git a/lisp/ivy.el b/lisp/ivy.el index dc3d38b..8dea458 100644 --- a/lisp/ivy.el +++ b/lisp/ivy.el @@ -1,7 +1,14 @@ (use-package ivy + :demand :bind (:map evil-normal-state-map - ("C-k" . ivy-resume))) + ("C-k" . ivy-resume)) + :config + ;; Route `completing-read' through ivy. Without this only the commands + ;; counsel remaps get an ivy UI; everything reading with `completing-read' + ;; -- all of projectile's commands, in particular -- falls back to the + ;; default minibuffer completion. + (ivy-mode 1)) (use-package counsel :demand @@ -10,13 +17,6 @@ :config (counsel-mode)) -(use-package counsel-projectile - :config - (counsel-projectile-mode) - (require 'dash) - (setcar counsel-projectile-switch-project-action - (1+ (--find-index (eq (cadr it) #'counsel-projectile-switch-project-action-vc) (cdr counsel-projectile-switch-project-action))))) - (use-package swiper :bind (("C-s" . swiper) diff --git a/straight/versions/default.el b/straight/versions/default.el index bfb27a6..dfae216 100644 --- a/straight/versions/default.el +++ b/straight/versions/default.el @@ -20,7 +20,6 @@ ("company-quickhelp" . "5bda859577582cc42d16fc0eaf5f7c8bedfd9e69") ("compat" . "d3be8ee1b12809d6171c4384139a531de71343a5") ("cond-let" . "c48600dfab6372670225f046cace263700c78eab") - ("counsel-projectile" . "40d1e1d4bb70acb00fddd6f4df9778bf2c52734b") ("dap-mode" . "7372c429031ad37adb88b42e4a2f4cfff246ce55") ("dash.el" . "d3a84021dbe48dba63b52ef7665651e0cf02e915") ("dockerfile-mode" . "97733ce074b1252c1270fd5e8a53d178b66668ed") -- 2.38.4