From f9459cfe660b3bb270785c4481e26d5617389f2a Mon Sep 17 00:00:00 2001 From: Riyyi Date: Fri, 10 Mar 2023 23:36:30 +0100 Subject: [PATCH] Emacs: Update to use vertico-prescient, update Elpaca bootstrap --- .config/emacs/site-lisp/dot-elpaca.el | 25 ++++++++++++------------ .config/emacs/site-lisp/dot-selection.el | 17 +++++----------- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/.config/emacs/site-lisp/dot-elpaca.el b/.config/emacs/site-lisp/dot-elpaca.el index cefa203..af10a47 100644 --- a/.config/emacs/site-lisp/dot-elpaca.el +++ b/.config/emacs/site-lisp/dot-elpaca.el @@ -9,33 +9,34 @@ ;; ----------------------------------------- ;; Elpaca bootstrap +(defvar elpaca-installer-version 0.2) (defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory)) (defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory)) +(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory)) (defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git" :ref nil + :files (:defaults (:exclude "extensions")) :build (:not elpaca--activate-package))) -(when-let ((repo (expand-file-name "repos/elpaca/" elpaca-directory)) +(when-let ((repo (expand-file-name "elpaca/" elpaca-repos-directory)) (build (expand-file-name "elpaca/" elpaca-builds-directory)) (order (cdr elpaca-order)) ((add-to-list 'load-path (if (file-exists-p build) build repo))) ((not (file-exists-p repo)))) (condition-case-unless-debug err - (if-let ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*")) + (if-let ((buffer (pop-to-buffer-same-window "*elpaca-installer*")) ((zerop (call-process "git" nil buffer t "clone" (plist-get order :repo) repo))) (default-directory repo) ((zerop (call-process "git" nil buffer t "checkout" - (or (plist-get order :ref) "--"))))) - (progn - (byte-recompile-directory repo 0 'force) - (require 'elpaca) - (and (fboundp 'elpaca-generate-autoloads) - (elpaca-generate-autoloads "elpaca" repo)) - (kill-buffer buffer)) + (or (plist-get order :ref) "--")))) + (emacs (concat invocation-directory invocation-name)) + ((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch" + "--eval" "(byte-recompile-directory \".\" 0 'force)")))) + (progn (require 'elpaca) + (elpaca-generate-autoloads "elpaca" repo) + (kill-buffer buffer)) (error "%s" (with-current-buffer buffer (buffer-string)))) - ((error) - (warn "%s" err) - (delete-directory repo 'recursive)))) + ((error) (warn "%s" err) (delete-directory repo 'recursive)))) (require 'elpaca-autoloads) (add-hook 'after-init-hook #'elpaca-process-queues) (elpaca `(,@elpaca-order)) diff --git a/.config/emacs/site-lisp/dot-selection.el b/.config/emacs/site-lisp/dot-selection.el index 9a7be64..4a9d67f 100644 --- a/.config/emacs/site-lisp/dot-selection.el +++ b/.config/emacs/site-lisp/dot-selection.el @@ -10,7 +10,6 @@ (:require prescient) (:when-loaded (setq completion-styles '(prescient basic)) - (setq prescient-completion-enable-sort nil) (setq prescient-filter-method '(literal regexp fuzzy)) (setq prescient-save-file (expand-file-name "prescient-save.el" dot-cache-dir)) (prescient-persist-mode))) @@ -18,17 +17,6 @@ (elpaca-setup (vertico :files (:defaults "extensions/*")) (:load-after prescient) (:when-loaded - (setq vertico-sort-function #'prescient-completion-sort) - (setq vertico-sort-override-function #'prescient-completion-sort) - - (defun dot/vertico-prescient-remember () - "Remember the chosen candidate with Prescient." - (when (>= vertico--index 0) - (prescient-remember - (substring-no-properties - (nth vertico--index vertico--candidates))))) - (advice-add #'vertico-insert :after #'dot/vertico-prescient-remember) - (setq vertico-previous-directory nil) (defun dot/vertico-backspace () "In Vertico file completion, backward kill sexp, delete char otherwise." @@ -57,6 +45,11 @@ (:load-after vertico) (:when-loaded (vertico-mouse-mode)))) +(elpaca-setup vertico-prescient + (:load-after vertico prescient) + (:when-loaded + (vertico-prescient-mode))) + (elpaca-setup marginalia (:load-after vertico) (:when-loaded