The Complete Computing Environment

Completing Read Replacement and Extension


high-chaos organization here… replacing Ivy and Counsel and Ivy Posframe with the new hotness, this constellation of packages:

Selectrum, Prescient, and Orderless

(use-package vertico
  (setq completion-in-region-function
        (lambda (&rest args)
          (apply (if vertico-mode
  ("C-x C-z" . 'vertico-repeat))

(use-package prescient
  :after (vertico)
  (prescient-persist-mode +1)
  (defun vertico-prescient-remember ()
    "Remember the chosen candidate with Prescient."
    (when (>= vertico--index 0)
        (nth vertico--index vertico--candidates)))))
  (advice-add #'vertico-insert :after #'vertico-prescient-remember)
  (vertico-sort-function #'prescient-completion-sort))

(use-package orderless
  :after (prescient)
  (completion-styles '(prescient orderless)))


Consult contains a bunch of nice builtin-replacements which utilize these other libraries to their fullest extent. consult-buffer in particular is quite nice, for example.

(use-package consult
  (setq xref-show-xrefs-function #'consult-xref
        xref-show-definitions-function #'consult-xref)
  (setq consult-narrow-key "<")
  (autoload 'projectile-project-root "projectile")
  (setq consult-project-root-function #'projectile-project-root)
  (unless (s-contains? "--glob" consult-ripgrep-args)
    (setq consult-ripgrep-args (s-concat consult-ripgrep-args
                                         " --glob \"!*~\" .")))
  ("C-x b" . consult-buffer)
  ("C-x 4 b" . consult-buffer-other-window)
  ("C-x 5 b" . consult-buffer-other-frame)
  ("C-c h" . consult-history)
  ("C-c k" . consult-kmacro)
  (:map evil-leader--default-map
        ("b" . consult-buffer)
        ("<SPC>" . execute-extended-command))
  (:map evil-normal-state-map
        ("M-y" . consult-yank-pop) 
        ("/" . consult-line)))

(use-package consult-flycheck
  :bind (:map flycheck-command-map
              ("!" . consult-flycheck)))

Consult Buffer shouldn't preview EXWM buffers

via consult wiki, to prevent Consult Buffer from always popping exwm buffers and moving things around, I apply this monkeypatch which filters them out of consideration for preview.

(defun consult-buffer-state-no-x ()
  "Buffer state function that doesn't preview X buffers."
  (lexical-let ((orig-state (consult--buffer-state))
        (filter (lambda (action cand)
                  (if (or (not cand)
                          (eq action 'return)
                          (let ((buffer (get-buffer cand)))
                            (and buffer
                                 (not (eq 'exwm-mode (buffer-local-value 'major-mode buffer))))))
    (lambda (action cand)
      (funcall orig-state action (funcall filter action cand)))))

(with-eval-after-load 'consult
  (setq consult--source-buffer
        (plist-put consult--source-buffer :state #'consult-buffer-state-no-x)))

Embark and Marginalia

(use-package marginalia
  :config (marginalia-mode)
  (("M-A" . marginalia-cycle)
   :map minibuffer-local-map
   ("M-A" . marginalia-cycle)))

(use-package embark
  (("C-S-a" . embark-act)       ;; pick some comfortable binding
   ("C-h b" . embark-bindings)) ;; alternative for `describe-bindings'

  :init (setq prefix-help-command #'embark-prefix-help-command)

  ;; Hide the mode line of the Embark live/completions buffers
  (add-to-list 'display-buffer-alist
               '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
                 (window-parameters (mode-line-format . none)))))

;; Consult users will also want the embark-consult package.
(use-package embark-consult
  :after (embark consult)
  :demand t)

Mini Frame

this is disabled because it doesn't work well with xmonad.

The only interesting things here is that i set parent-frame to nil similar to how i have to configure Ivy Posframe – this is for EXWM windowing support. I also disable the mini-frame in a bunch of spots.

(use-package mini-frame
  (mini-frame-mode +1)
  (setq resize-mini-frames t)
  (setq mini-frame-show-parameters
        '((parent-frame . nil)
          (top . 25)
          (height . 1)
          (width . 0.7)
          (left . 0.5)))
  (dolist (cmd '(calcDigit-start
    (add-to-list 'mini-frame-ignore-commands cmd)))