From 6eaf17979c76b8b6d37b0aa7115e623486bfc61c Mon Sep 17 00:00:00 2001
From: Case Duckworth
Date: Mon, 9 Aug 2021 23:14:01 -0500
Subject: Configure completion framework

---
 init.el | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/init.el b/init.el
index 4c2e610..c850b77 100644
--- a/init.el
+++ b/init.el
@@ -149,7 +149,7 @@
 (setup completion
   (:option completion-ignore-case t
            read-buffer-completion-ignore-case t
-           completion-styles '(partial-completion substring flex)
+           completion-styles '(substring partial-completion)
            completion-category-defaults nil
            completion-category-overrides
            '((file (styles . (partial-completion)))))
@@ -929,9 +929,24 @@ if ripgrep is installed, otherwise `consult-grep'."
 
   ;; Competion-at-point (complete-region)
   (:global "M-/" completion-at-point)
-  (:option completion-in-region-function #'consult-completion-in-region
+  (:option completion-in-region-function
+           (lambda (&rest args)
+             (apply (if vertico-mode
+                        #'consult-completion-in-region
+                      #'completion--in-region)
+                    args))
            completion-cycle-threshold 3
-           tab-always-indent 'complete))
+           tab-always-indent 'complete)
+
+  ;; Completing-read-multple
+  (if (fboundp #'consult-completing-read-multiple)
+      (:advise completing-read-multple
+               :override #'consult-completing-read-multiple)
+
+    (defun crm-indicator (args)
+      (cons (concat "[CRM] " (car args)) (cdr args)))
+    (:advise completing-read-multiple
+             :filter-args #'crm-indicator)))
 
 (setup (:straight crux)
   
@@ -1139,7 +1154,7 @@ if ripgrep is installed, otherwise `consult-grep'."
                    :host github
                    :repo "oantolin/orderless"))
   (require 'orderless)
-  (:option (prepend completion-styles) 'orderless))
+  (:option (append completion-styles) 'orderless))
 
 (setup (:straight org)
   (:straight org-contrib)
@@ -1162,7 +1177,9 @@ if ripgrep is installed, otherwise `consult-grep'."
            org-hide-emphasis-markers t
            org-html-coding-system  'utf-8-unix
            org-imenu-depth 3
+           org-outline-path-complete-in-steps nil
            org-pretty-entities t
+           org-refile-use-outline-path 'file
            org-special-ctrl-a/e t
            org-special-ctrl-k t
            org-src-fontify-natively t
-- 
cgit 1.4.1-21-gabe81