From db26edaf4d62efb394209497ad02420f0f140128 Mon Sep 17 00:00:00 2001 From: MitchMarq42 Date: Wed, 24 Aug 2022 19:28:10 -0800 Subject: [PATCH] Switch everything to try using elpaca. Will probably break deployments. --- lisp/mitch-packages.el | 261 ++++++++++++++++++----------------------- 1 file changed, 117 insertions(+), 144 deletions(-) diff --git a/lisp/mitch-packages.el b/lisp/mitch-packages.el index b47f456..b4d8a01 100644 --- a/lisp/mitch-packages.el +++ b/lisp/mitch-packages.el @@ -16,17 +16,11 @@ NAME and ARGS are in `use-package'." :ensure nil ,@args))) ;; diminish -(use-package diminish - ;; :straight (:type built-in) - ) +(elpaca-use-package diminish) (use-feature eldoc :straight (:type built-in) :diminish :defer 1 -(use-package tramp - :straight (:type built-in) - :custom (tramp-mode nil)) -(use-package savehist :custom (eldoc-echo-area-use-multiline-p nil) :config ;; eldoc for 日本語 -- taken from https://cce.whatthefuck.computer/japanese-study @@ -35,9 +29,10 @@ NAME and ARGS are in `use-package'." (get-char-code-property (string-to-char (thing-at-point 'char)) 'name))) (add-hook 'eldoc-documentation-functions #'eldoc-jhk)) +(use-feature savehist :straight (:type built-in) :init (savehist-mode)) -(use-package whitespace +(use-feature whitespace :straight (:type built-in) :defer 1 :diminish whitespace-mode @@ -79,7 +74,7 @@ This is taken from a website that I can't remember at the moment." :straight (:type built-in) :commands ibuffer :custom (ibuffer-use-other-window t)) -(use-package image-mode +(use-feature image-mode :straight (:type built-in) :config (turn-off-line-numbers) @@ -92,11 +87,13 @@ This is taken from a website that I can't remember at the moment." :config (global-auto-revert-mode)) ;; Keybinding manager -(use-package general +(use-feature general + :straight t :config (mitch/general-config)) ;; load evil -(use-package evil +(use-feature evil + :straight t :general (general-define-key :states 'normal @@ -123,68 +120,48 @@ This is taken from a website that I can't remember at the moment." (quote undo-fu))) :init (evil-mode t)) -(use-package evil-collection +(use-feature evil-collection + :straight t :after evil :diminish evil-collection-unimpaired-mode :config (evil-collection-init)) -(use-package evil-commentary +(use-feature evil-commentary + :straight t :diminish 'evil-commentary-mode :config (evil-commentary-mode) :hook (prog-mode . evil-commentary-mode)) -(use-package evil-surround +(use-feature evil-surround + :straight t :diminish 'global-evil-surround-mode :hook (prog-mode . evil-surround-mode) :config (global-evil-surround-mode 1)) -(use-package evil-terminal-cursor-changer +(use-feature evil-terminal-cursor-changer + :straight t :after evil :diminish :if (not (display-graphic-p)) :config (evil-terminal-cursor-changer-activate) (xterm-mouse-mode)) -(use-package undo-fu +(use-feature undo-fu :after evil :if (< (string-to-number emacs-version) 28) :diminish) -(use-package all-the-icons) -(use-package dirvish +(use-feature all-the-icons) +(elpaca-use-package dirvish :straight (:files (:defaults "extensions/*.el")) - :commands 'dirvish + :defer 0.5 + :commands dirvish :custom (dirvish-attributes '(all-the-icons collapse)) (dirvish-cache-dir (expand-file-name ".dirvish/" user-emacs-directory)) - :init (dirvish-override-dired-mode) - (defun convert-pdf-to-html (pdf) - "Take PDF and convert it into a html file, which is returned. -Requires `mutool' to be installed and available in $PATH (it comes with MuPDF)." - (let ((html (file-name-with-extension pdf ".html"))) - (shell-command (concat - (format - "mutool convert -F html -O preserve-images -o '%s' " - html) (format "'%s'" pdf))) html)) - (defun view-pdf-in-webkit (pdf) - "View PDF in BUFFER by using `mutool'. This works by converting it to a -html file and viewing that file in `xwidget-webkit'. Requires `mutool' to be -installed and available in $PATH (it comes with MuPDF). Also requires Emacs to -be built with `xwidget' support." - (xwidget-webkit-browse-url - (format "file://%s" (convert-pdf-to-html pdf)))) - (dirvish-define-preview pdf (file ext) - "Use `mupdf' and `xwidget-webkit' to generate pdf preview." - :require ("mutool") - (when (equal ext "pdf") - (if (featurep 'xwidget webkit) - (view-pdf-in-webkit file)))) - (add-to-list 'dirvish-preview-dispatchers 'pdf) - (setq dired-listing-switches "-l --almost-all") - (setq dirvish-side-display-alist - '((window-width . 0.15) - (slot . -1) - (side . left))) - :hook - (dirvish-mode . turn-off-line-numbers) - :general + (dired-listing-switches "-l --almost-all") + (dirvish-side-display-alist '((window-width . 0.15) + (slot . -1) + (side . left))) + :init (dirvish-override-dired-mode t) + :config (general-define-key :states 'normal :keymaps 'dirvish-mode-map @@ -199,35 +176,23 @@ be built with `xwidget' support." "t" 'dirvish-side)) ;; Completion framework... -;; (use-package ivy -;; :diminish -;; :custom -;; (ivy-auto-shrink-minibuffer-alist '((t . t))) -;; :config (ivy-mode t) -;; :general -;; (general-define-key -;; :keymaps 'ivy-minibuffer-map -;; "TAB" 'ivy-alt-done)) -;; (use-package counsel -;; :diminish -;; :config (counsel-mode)) -(use-package vertico +(elpaca-use-package vertico :straight (:files (:defaults "extensions/vertico-mouse.el")) :custom (vertico-resize t) :config (vertico-mode) (add-hook 'minibuffer-setup-hook 'turn-off-line-numbers)) -(use-package vertico-mouse +(use-feature vertico-mouse :straight vertico :after vertico :config (vertico-mouse-mode)) -(use-package consult +(use-feature consult :after vertico) ;; Minibuffer generic stuff -(use-package marginalia +(use-feature marginalia ;; :custom (marginalia-separator " ") :init (marginalia-mode)) -(use-package orderless +(use-feature orderless :custom (completion-styles '(orderless partial-completion basic)) (completion-category-defaults nil) @@ -235,7 +200,7 @@ be built with `xwidget' support." (completion-category-overrides nil)) ;; weird multi-path thing -(use-package embark +(use-feature embark :general (general-define-key :keymap minibuffer-mode-map @@ -256,8 +221,8 @@ targets." (embark--truncate-target (plist-get (car targets) :target)) (if (cdr targets) "…" ""))) (if prefix (pcase (lookup-key keymap prefix 'accept-default) - ((and (pred keymapp) km) km) - (_ (key-binding prefix 'accept-default))) keymap) + ((and (pred keymapp) km) km) + (_ (key-binding prefix 'accept-default))) keymap) nil nil t (lambda (binding) (not (string-suffix-p "-argument" (cdr binding)))))))) (setq embark-indicators @@ -275,11 +240,11 @@ targets." :config (setq enable-recursive-minibuffers t)) ;; Consult users will also want the embark-consult package. -(use-package embark-consult +(use-feature embark-consult :after (embark consult)) ;; SORTA WORKING: Relative line numbers with stuff -(use-package linum-relative +(use-feature linum-relative :diminish :init (require 'cl-lib) @@ -294,7 +259,7 @@ targets." (+ 1 (floor (log symbol 10)))) (defun mitch/linum-get-left-pad (symbol) "Get the number of spaces to add before the current relative line number." - (let* ((symbol-width (mitch/symbol-width line-number))) + (let* ((symbol-width (mitch/symbol-width symbol))) (- display-line-numbers-width symbol-width))) (defun mitch/right-pad (line-number) "Pad the line number to the right." @@ -332,7 +297,7 @@ targets." ;; (setq display-line-numbers-mode 'relative) ;; broken terminal that doesn't compile but at least it's fast when it does -(use-package vterm +(use-feature vterm :custom (vterm-always-compile-module t) (vterm-module-cmake-args "-DUSE_SYSTEM_LIBVTERM=no") @@ -370,7 +335,7 @@ targets." :hook (vterm-mode . mitch/terminal-setup) (vterm-exit-functions . save-buffers-kill-terminal)) -(use-package multi-vterm +(use-feature multi-vterm :commands (multi-vterm multi-vterm-other-window) :config (defun multi-vterm-other-window () @@ -390,7 +355,7 @@ targets." "v" 'multi-vterm-other-window)) ;; Better modeline? Better modeline. -(use-package nyan-mode +(use-feature nyan-mode :after airline :custom (nyan-cat-face [[""]]) @@ -398,13 +363,13 @@ targets." :init (nyan-mode)) ;; (add-to-list 'mode-line-format (nyan-create) t) ;; (string-to-char "") -(use-package powerline +(use-feature powerline :custom (powerline-display-buffer-size nil) (powerline-default-separator 'utf-8) (powerline-utf-8-separator-left (string-to-char "")) (powerline-utf-8-separator-right (string-to-char ""))) -(use-package airline-themes +(use-feature airline-themes :custom (airline-cursor-colors nil) (airline-display-directory t) @@ -444,7 +409,7 @@ targets." ;; Custom Theme. ;; Not to be confused with a color theme, or a color scheme, or a custom scheme. -(use-package autothemer +(use-feature autothemer :custom (window-divider-default-places t) (right-divider-width 5) @@ -466,14 +431,14 @@ targets." ;; :config (global-yascroll-bar-mode 1)) ;; parentheses settingses -(use-package paredit +(use-feature paredit :defer 0.1 :general (general-define-key - :states 'normal - "M-j" 'paredit-forward-slurp-sexp - "M-k" 'paredit-forward-barf-sexp - "M-h" 'paredit-backward-barf-sexp - "M-l" 'paredit-backward-slurp-sexp) + :states 'normal + "M-j" 'paredit-forward-slurp-sexp + "M-k" 'paredit-forward-barf-sexp + "M-h" 'paredit-backward-barf-sexp + "M-l" 'paredit-backward-slurp-sexp) :config (show-paren-mode 1) (electric-pair-mode 1) @@ -482,7 +447,7 @@ targets." (show-paren-style 'parenthesis)) ;; org mode and messy things -(use-package org +(use-feature org :straight (:type built-in) :mode (("\\.org$" . org-mode)) :diminish org-indent-mode @@ -502,13 +467,13 @@ targets." (add-to-list 'org-structure-template-alist '("el" . "src elisp")) (add-to-list 'org-structure-template-alist '("ps1" . "src powershell")) (add-to-list 'org-structure-template-alist '("html" . "src html"))) -(use-package org-variable-pitch +(use-feature org-variable-pitch :if (display-graphic-p) :diminish (buffer-face-mode org-variable-pitch-minor-mode) :config (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-delimiter-face fixed-pitch)) :hook (org-mode . org-variable-pitch-minor-mode)) -(use-package org-contrib +(use-feature org-contrib :after org :config (org-babel-do-load-languages @@ -521,49 +486,49 @@ targets." ;; :after org ;; :custom ;; (org-appear-autolinks t)) -(use-package ob-powershell +(use-feature ob-powershell :after (org powershell) :custom (ob-powershell-powershell-command "pwsh")) -(use-package company-org-block +(use-feature company-org-block :after (org company)) -(use-package ox-hugo +(use-feature ox-hugo :after ox) ;; cheaty key popups -(use-package which-key +(use-feature which-key :diminish :defer 5 :init (which-key-mode t)) ;; parentheses are boring -(use-package rainbow-delimiters +(use-feature rainbow-delimiters :diminish :defer 1 :hook (prog-mode . rainbow-delimiters-mode)) ;; Hex colors -(use-package rainbow-mode +(use-feature rainbow-mode :diminish :defer 10 :hook (prog-mode . rainbow-mode)) ;; Nobody loves a good language -(use-package powershell +(use-feature powershell :mode ("\\.ps1\\'" . powershell-mode)) -(use-package cider +(use-feature cider :defer 1) ;; or a bad language -(use-package haskell-mode +(use-feature haskell-mode :mode "\\.hs\\'" ;; :init ;; (add-hook 'haskell-mode-hook 'haskell-decl-scan-mode) ;; (add-hook 'haskell-mode-hook #'lsp) :bind ( - :map haskell-mode-map - ("C-c h" . hoogle) - ("C-c s" . haskell-mode-stylish-buffer)) + :map haskell-mode-map + ("C-c h" . hoogle) + ("C-c s" . haskell-mode-stylish-buffer)) :config (message "Loaded haskell-mode") (setq haskell-mode-stylish-haskell-path "brittany") (setq haskell-hoogle-url "https://www.stackage.org/lts/hoogle?q=%s")) @@ -571,30 +536,30 @@ targets." ;; c sharp; taken from https://www.reddit.com/r/emacs/comments/k8tnzg/help_setting_up_c_lsp_omnisharproslyn/ ;; '(there is nothing here because I'm not using c sharp...) -(use-package lsp-mode +(use-feature lsp-mode :hook ((powershell-mode . lsp) - (lsp-mode . lsp-enable-which-key-integration) + (lsp-mode . lsp-enable-which-key-integration) (lsp-mode . lsp-ui-mode)) :commands lsp :custom (lsp-completion-provider :none)) ;; optionally -(use-package lsp-ui +(use-feature lsp-ui :after lsp :commands lsp-ui-mode) ;; broken snippets I don't care about... -(use-package yasnippet +(use-feature yasnippet :diminish yas-minor-mode :hook (prog-mode . yas-minor-mode)) ;; Better help-pages. Genuinely pretty great. -(use-package helpful +(use-feature helpful :general (general-define-key - [remap describe-key] 'helpful-key - [remap describe-variable] 'helpful-variable - [remap describe-function] 'helpful-callable) + [remap describe-key] 'helpful-key + [remap describe-variable] 'helpful-variable + [remap describe-function] 'helpful-callable) (general-define-key :keymaps 'help-map "F" 'describe-face @@ -606,32 +571,32 @@ targets." :custom (elisp-refs-verbose nil)) ;; Better lisp highlighting? -(use-package highlight-defined +(use-feature highlight-defined :hook (emacs-lisp-mode . highlight-defined-mode)) ;; Shell linting? -(use-package flycheck +(use-feature flycheck :diminish :hook (prog-mode . flycheck-mode) ;; :config (global-flycheck-mode t) ) ;; Emacs startup profiling -(use-package esup +(use-feature esup :commands esup) ;; Blingy file tree view ;; '(I'm using dirvish instead, so no treemacs config here anymore.) ;; Blingy laggy minimap on the right -(use-package minimap +(use-feature minimap :general (general-define-key - :states 'normal - :prefix-command 'mini-map-prefix - :prefix-map 'mini-map - :prefix "SPC m" - "m" 'minimap-mode - "k" 'minimap-kill) + :states 'normal + :prefix-command 'mini-map-prefix + :prefix-map 'mini-map + :prefix "SPC m" + "m" 'minimap-mode + "k" 'minimap-kill) :custom (minimap-window-location 'right) (minimap-update-delay 0) @@ -661,7 +626,7 @@ targets." ;; (company-fuzzy-history-backends '(company-yasnippet)) ;; (company-fuzzy-trigger-symbols '("." "->" "<" "\"" "'" "@")) ;; (company-fuzzy-passthrough-backends '(company-capf))) -(use-package corfu +(use-feature corfu :custom (completion-cycle-threshold 3) (tab-always-indent 'complete) @@ -702,19 +667,19 @@ targets." ) ) -(use-package popon +(use-feature popon :straight (:type git - :repo "https://codeberg.org/akib/emacs-popon") + :repo "https://codeberg.org/akib/emacs-popon") :if (not (display-graphic-p))) -(use-package corfu-terminal +(use-feature corfu-terminal :straight (:type git - :repo "https://codeberg.org/akib/emacs-corfu-terminal") + :repo "https://codeberg.org/akib/emacs-corfu-terminal") :after popon :init (unless - (display-graphic-p) - (corfu-terminal-mode +1))) + (display-graphic-p) + (corfu-terminal-mode +1))) ;; Visualize whitespace. In a very chill and invisible way. @@ -746,35 +711,35 @@ targets." -(use-package xwidget ;-webkit +(use-feature xwidget ;-webkit :straight (:type built-in) :if (featurep 'xwidget-internal) :commands xwidget-webkit-browse-url :config (add-hook 'xwidget-webkit-mode-hook - #'(lambda () - (turn-off-line-numbers) - (scroll-bar-mode -1) - ))) + #'(lambda () + (turn-off-line-numbers) + (scroll-bar-mode -1) + ))) -(use-package magit +(use-feature magit :commands magit :hook (magit-mode . turn-off-line-numbers)) -(use-package hyperbole +(use-feature hyperbole :diminish ;; :init (hyperbole-mode) :general (general-define-key - :states 'normal - "RET" 'hkey-either)) + :states 'normal + "RET" 'hkey-either)) -(use-package dconf-mode +(use-feature dconf-mode :straight (:type git - :repo "https://git.mitchmarq42.xyz/mitch/dconf-mode.el")) + :repo "https://git.mitchmarq42.xyz/mitch/dconf-mode.el")) -(use-package info-variable-pitch +(use-feature info-variable-pitch :straight (:type git :host github :repo "kisaragi-hiu/info-variable-pitch") @@ -782,8 +747,8 @@ targets." (add-hook 'Info-mode-hook #'info-variable-pitch-mode)) ;; (use-package empv -;; :straight -;; (:type git :host github +;; :straight +;; ;; (:type git :host github ;; :repo "isamert/empv.el")) ;; (use-package exwm @@ -791,11 +756,11 @@ targets." ;; ;; (require 'exwm-config) ;; ;; (exwm-config-example) ;; ) -(use-package ani-el +(use-feature ani-el :straight (:type git :repo "https://git.mitchmarq42.xyz/mitch/ani-el" :files ("ani-el.el" "lib"))) -(use-package slime +(use-feature slime :if (file-exists-p (expand-file-name "~/quicklisp/slime-helper.el")) :custom (inferior-lisp-program "sbcl") :init (load (expand-file-name "~/quicklisp/slime-helper.el"))) @@ -804,15 +769,23 @@ targets." ;; :config (add-hook 'pdf-view-mode-hook 'turn-off-line-numbers)) ;; built in spell checker, for losers -(use-package flyspell +(use-feature flyspell :straight (:type built-in) :custom (flyspell-auto-correct-word t) :hook (org-mode . flyspell-mode)) -(use-package clojure-mode) -(use-package inf-clojure) +;; Java never looked so useful... +(use-feature clojure-mode) +(use-feature inf-clojure) + +;; Let's pretend we're nevoim for a moment +(use-feature tree-sitter + :config + (global-tree-sitter-mode) + (add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode)) +(use-feature tree-sitter-langs) (provide 'mitch-packages) ;;; mitch-packages.el ends here