From 2497d58e9a8da7387334dd6168459bcbaa77793d Mon Sep 17 00:00:00 2001 From: Liam Hupfer Date: Tue, 26 Sep 2023 20:58:38 -0500 Subject: [PATCH] fix(vertico): ensure recentf-mode for consult-buffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `consult-buffer` uses `recentf` to populate file candidates. It is not uncommon to use `consult-buffer` as a single entry point to buffers, bookmarks and recent files, effectively replacing `recentf` and `consult-recent-file`. To improve startup performance, Doom enables `recentf-mode` after the first file is opened (0e851ace9ba4). When executing `consult-buffer` at startup, `recentf-mode` won’t be enabled yet. Add it to the `consult-recent-file` advice to ensure that can’t happen. Unlike `consult-recent-file`, `consult-buffer` does have significant functionality without `recentf-mode`, but for the tiny fraction of Doom users that disable `recentf-mode`, this is easy enough to `advice-remove`. Fix: https://github.com/doomemacs/doomemacs/issues/7461 --- modules/completion/vertico/config.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/completion/vertico/config.el b/modules/completion/vertico/config.el index 3d84d9f79..a4efa7c4e 100644 --- a/modules/completion/vertico/config.el +++ b/modules/completion/vertico/config.el @@ -136,9 +136,10 @@ orderless." [remap yank-pop] #'consult-yank-pop [remap persp-switch-to-buffer] #'+vertico/switch-workspace-buffer) :config - (defadvice! +vertico--consult-recent-file-a (&rest _args) - "`consult-recent-file' needs to have `recentf-mode' on to work correctly" - :before #'consult-recent-file + (defadvice! +vertico--consult-recentf-a (&rest _args) + "`consult-recent-file' needs to have `recentf-mode' on to work correctly. +`consult-buffer' needs `recentf-mode' to show file candidates." + :before (list #'consult-recent-file #'consult-buffer) (recentf-mode +1)) (setq consult-project-root-function #'doom-project-root