From 7c676c83bcf70f986aa341b87a8058410460b611 Mon Sep 17 00:00:00 2001 From: Daanturo Date: Thu, 28 Apr 2022 01:31:21 +0700 Subject: [PATCH] tweak(vertico): use setq-default to set completion-in-region-function Corfu makes completion-in-region-function a local variable in buffers where it is enabled, so when this form is evaluated in one of those said buffers (such as opening a file with Emacs before accessing the minibuffer), completion-in-region-function will just be set locally there. --- modules/completion/vertico/config.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/completion/vertico/config.el b/modules/completion/vertico/config.el index 954bc0e51..6f02e61af 100644 --- a/modules/completion/vertico/config.el +++ b/modules/completion/vertico/config.el @@ -27,13 +27,13 @@ overrides `completion-styles' during company completion sessions.") :config (setq vertico-resize nil vertico-count 17 - vertico-cycle t - completion-in-region-function - (lambda (&rest args) - (apply (if vertico-mode - #'consult-completion-in-region - #'completion--in-region) - args))) + vertico-cycle t) + (setq-default completion-in-region-function + (lambda (&rest args) + (apply (if vertico-mode + #'consult-completion-in-region + #'completion--in-region) + args))) ;; Cleans up path when moving directories with shadowed paths syntax, e.g. ;; cleans ~/foo/bar/// to /, and ~/foo/bar/~/ to ~/. (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy)