Slowly replace use-package with with-eval-after-load

This commit is contained in:
Maciej 2024-10-23 11:06:19 +03:00
parent c7b0c1c6c2
commit 1fe168ccc6
Signed by: maciej
GPG key ID: 41D62D42D3B0D765
10 changed files with 360 additions and 377 deletions

View file

@ -5,55 +5,54 @@
(require 'icejam-keys-mode)
(use-package vertico :ensure t :defer t
:init
(vertico-mode)
:custom
(vertico-scroll-margin 0) ;; Different scroll margin
(vertico-count 15) ;; Show more candidates
(vertico-resize t) ;; Grow and shrink the Vertico minibuffer
(vertico-cycle t) ;; Enable cycling for `vertico-next/previous')
)
;; Preparations for using Vertico/Orderless
(setq
;; Support opening new minibuffers from inside existing minibuffers.
enable-recursive-minibuffers t
;; Hide commands in M-x which do not work in the current mode. Vertico
;; commands are hidden in normal buffers. This setting is useful beyond
;; Vertico.
read-extended-command-predicate #'command-completion-default-include-p
;; Do not allow the cursor in the minibuffer prompt
minibuffer-prompt-properties '(read-only t cursor-intangible t face minibuffer-prompt))
;; A few more useful configurations...
(use-package emacs
:custom
;; Support opening new minibuffers from inside existing minibuffers.
(enable-recursive-minibuffers t)
;; Hide commands in M-x which do not work in the current mode. Vertico
;; commands are hidden in normal buffers. This setting is useful beyond
;; Vertico.
(read-extended-command-predicate #'command-completion-default-include-p)
:init
;; Add prompt indicator to `completing-read-multiple'.
;; We display [CRM<separator>], e.g., [CRM,] if the separator is a comma.
(defun crm-indicator (args)
(cons (format "[CRM%s] %s"
(replace-regexp-in-string
"\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
crm-separator)
(car args))
(cdr args)))
(advice-add #'completing-read-multiple :filter-args #'crm-indicator)
(defun crm-indicator (args)
(cons (format "[CRM%s] %s"
(replace-regexp-in-string
"\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
crm-separator)
(car args))
(cdr args)))
(advice-add #'completing-read-multiple :filter-args #'crm-indicator)
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
;; Do not allow the cursor in the minibuffer prompt
(setq minibuffer-prompt-properties
'(read-only t cursor-intangible t face minibuffer-prompt))
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode))
;; Actual orderless
(use-package vertico :ensure t)
(use-package orderless :ensure t)
(use-package marginalia :ensure t)
(use-package consult :ensure t)
(use-package helpful :ensure t)
;; Optionally use the `orderless' completion style.
(use-package orderless :ensure t :defer t
:custom
;; Configure a custom style dispatcher (see the Consult wiki)
;; (orderless-style-dispatchers '(+orderless-consult-dispatch orderless-affix-dispatch))
;; (orderless-component-separator #'orderless-escapable-split-on-space)
(completion-styles '(orderless basic))
(completion-category-defaults nil)
(completion-category-overrides '((file (styles partial-completion)))))
(with-eval-after-load 'vertico
(setq
vertico-scroll-margin 0 ;; Different scroll margin
vertico-count 15 ;; Show more candidates
vertico-resize t ;; Grow and shrink the Vertico minibuffer
vertico-cycle t ;; Enable cycling for `vertico-next/previous'
)
(vertico-mode))
(use-package marginalia :ensure t :defer t :init (marginalia-mode))
(use-package consult :ensure t :defer t)
(use-package helpful :ensure t :defer t)
(with-eval-after-load 'orderless
(setq
;; Configure a custom style dispatcher (see the Consult wiki)
;; (orderless-style-dispatchers '(+orderless-consult-dispatch orderless-affix-dispatch))
;; (orderless-component-separator #'orderless-escapable-split-on-space)
completion-styles '(orderless basic) ;; Fallback to basic
completion-category-defaults nil
completion-category-overrides '((file (styles partial-completion)))))
(with-eval-after-load 'marginalia
(marginalia-mode t))
(with-eval-after-load 'consult
(define-key icejam-keys-mode-map (kbd "C-c a") 'consult-ripgrep)