diff options
| author | Ravi R Kiran <aine.marina@gmail.com> | 2022-04-03 03:01:04 (GMT) |
|---|---|---|
| committer | Ravi R Kiran <aine.marina@gmail.com> | 2022-04-03 03:01:04 (GMT) |
| commit | 04736a774879eeacf5a4e712d3fc8654f50223fc (patch) | |
| tree | 70406d854826f01af43b9d1eda5aca3055215515 /lisp/ravi-init-completion.el | |
| parent | 5965037037e8ea97d4036aede6bf9dd5ff612f07 (diff) | |
| download | dotemacs-04736a774879eeacf5a4e712d3fc8654f50223fc.zip dotemacs-04736a774879eeacf5a4e712d3fc8654f50223fc.tar.gz dotemacs-04736a774879eeacf5a4e712d3fc8654f50223fc.tar.bz2 | |
Clean up misuse of use-package keyword :after
Diffstat (limited to 'lisp/ravi-init-completion.el')
| -rw-r--r-- | lisp/ravi-init-completion.el | 59 |
1 files changed, 35 insertions, 24 deletions
diff --git a/lisp/ravi-init-completion.el b/lisp/ravi-init-completion.el index b6987d0..402a598 100644 --- a/lisp/ravi-init-completion.el +++ b/lisp/ravi-init-completion.el @@ -27,8 +27,10 @@ ;; Use selectrum as completion UI with orderless for filtering and ;; prescient for frecency sorting -(use-package vlf) -(use-package sudo-edit) +(use-package vlf + :commands (vlf)) +(use-package sudo-edit + :commands (sudo-edit)) (use-package orderless :if (member ravi/use-selection-system '(selectrum vertico)) @@ -76,10 +78,11 @@ (use-package marginalia :if (member ravi/use-selection-system '(selectrum vertico)) + :after (:any selectrum vertico) :config (marginalia-mode)) + (use-package embark :if (member ravi/use-selection-system '(selectrum vertico)) - :after (sudo-edit vlf avy ace-window) :commands (embark-act) :bind (("H-t" . embark-act) :map @@ -91,6 +94,18 @@ ;; Optionally replace the key help with a completing-read interface (setq prefix-help-command #'embark-prefix-help-command) (ravi/bind-key-selection-system-map "C-t" #'embark-act) + + ;; Integrate embark with avy, by adding to avy dispatch list + (with-eval-after-load 'avy + (defun avy-action-embark (pt) + (unwind-protect + (save-excursion + (goto-char pt) + (embark-act)) + (select-window (cdr (ring-ref avy-ring 0)))) + t) + (setf (alist-get ?E avy-dispatch-alist) 'avy-action-embark)) + :config (defun embark-magit-status (file) "Run `magit-status` on repo containing the embark target." @@ -129,9 +144,10 @@ (defmacro ravi/make-embark-ace-actions-all-macro (keymap-func-list) `(progn ,@(mapcar #'ravi/make-embark-ace-actions keymap-func-list)))) - (ravi/make-embark-ace-actions-all-macro ((embark-file-map find-file) - (embark-buffer-map switch-to-buffer) - (embark-bookmark-map bookmark-jump))) + (with-eval-after-load 'ace-window + (ravi/make-embark-ace-actions-all-macro ((embark-file-map find-file) + (embark-buffer-map switch-to-buffer) + (embark-bookmark-map bookmark-jump)))) ;; For debugging below: ;; (pp (macroexpand '(ravi/make-embark-ace-actions-all-macro ;; ((embark-file-map find-file))))) @@ -140,21 +156,10 @@ (add-to-list 'display-buffer-alist '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" nil - (window-parameters (mode-line-format . none)))) - - ;; Integrate embark with avy - (defun avy-action-embark (pt) - (unwind-protect - (save-excursion - (goto-char pt) - (embark-act)) - (select-window (cdr (ring-ref avy-ring 0)))) - t) - (setf (alist-get ?E avy-dispatch-alist) 'avy-action-embark)) + (window-parameters (mode-line-format . none))))) (use-package consult :if (member ravi/use-selection-system '(selectrum vertico)) - :after (which-key) :bind (;; C-c bindings (mode-specific-map) ("C-c h" . consult-history) ("C-c m" . consult-mode-command) @@ -281,6 +286,7 @@ :default nil) ;; Replace by embark-prefix-help-command? + (require 'which-key) (defun immediate-which-key-for-narrow (fun &rest args) (let* ((refresh t) (timer (and consult-narrow-key @@ -334,20 +340,25 @@ (use-package dash-docs :if (member ravi/use-selection-system '(selectrum vertico)) - :after (avy) + :defer t) +(use-package consult-dash :commands (consult-dash) :bind (("M-s d" . consult-dash-at-point)) - :config - (use-package consult-dash - :config + :init + (with-eval-after-load 'avy (defun avy-action-dash-at-point (pt) (save-excursion (goto-char pt) (consult-dash-at-point)) (select-window (cdr (ring-ref avy-ring 0))) t) - (setf (alist-get ?D avy-dispatch-alist) 'avy-action-dash-at-point) - :ensure nil)) + (setf (alist-get ?D avy-dispatch-alist) 'avy-action-dash-at-point)) + + :config + ;; Ensure that niceties are loaded too + (require 'embark) + (require 'marginalia) + :ensure nil) (use-package consult-dir :commands (consult-dir) |
