diff --git a/ext/doom/autoload/eglot-booster.el b/ext/doom/autoload/eglot-booster.el deleted file mode 100644 index ec4d0b8..0000000 --- a/ext/doom/autoload/eglot-booster.el +++ /dev/null @@ -1,124 +0,0 @@ -;;; eglot-booster.el --- Boost eglot using lsp-booster -*- lexical-binding: t; -*- -;; Copyright (C) 2024 J.D. Smith - -;; Author: J.D. Smith -;; Homepage: https://github.com/jdtsmith/eglot-booster -;; Package-Requires: ((emacs "29.1") (jsonrpc "1.0") (eglot "1.0") (seq "2.24")) -;; Version: 0.0.1 -;; Keywords: convenience, programming -;; Prefix: eglot-booster -;; Separator: - - -;; eglot-booster is free software: you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation, either version 3 of the -;; License, or (at your option) any later version. - -;; eglot-booster is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; This small minor mode boosts eglot with emacs-lsp-booster. -;; Using it is simple: -;; -;; 1. Download/build a recent emacs-lsp-booster from -;; https://github.com/blahgeek/emacs-lsp-booster using the -;; instructions there. -;; 2. Enable eglot-booster-mode either in your init or, interactively, -;; use M-x eglot-booster-mode. -;; 3. Use eglot like normal. -;; -;; You can disable boosting by turning the minor mode off; any boosted -;; eglot servers will need to be restarted. Note: boosting works only -;; with local lsp servers programs which communicate via standard -;; input/output, not remote or network-port LSP servers. - -;;; Code: -(require 'eglot) -(require 'jsonrpc) - -(defcustom eglot-booster-no-remote-boost nil - "If non-nil, do not boost remote hosts." - :group 'eglot - :type 'boolean) - -(defun eglot-booster-plain-command (com) - "Test if command COM is a plain eglot server command." - (and (consp com) - (not (integerp (cadr com))) - (not (memq :autoport com)))) - -(defvar-local eglot-booster-boosted nil) -(defun eglot-booster--jsonrpc--json-read (orig-func) - "Read JSON or bytecode, wrapping the ORIG-FUNC JSON reader." - (if eglot-booster-boosted ; local to process-buffer - (or (and (= (following-char) ?#) - (let ((bytecode (read (current-buffer)))) - (when (byte-code-function-p bytecode) - (funcall bytecode)))) - (funcall orig-func)) - ;; Not in a boosted process, fallback - (funcall orig-func))) - -(defun eglot-booster--init (server) - "Register eglot SERVER as boosted if it is." - (when-let ((server) - (proc (jsonrpc--process server)) - (com (process-command proc)) - (buf (process-buffer proc))) - (unless (and (file-remote-p default-directory) eglot-booster-no-remote-boost) - (if (file-remote-p default-directory) ; com will likely be /bin/sh -i or so - (when (seq-find (apply-partially #'string-search "emacs-lsp-booster") - (process-get proc 'remote-command)) ; tramp applies this - (with-current-buffer buf (setq eglot-booster-boosted t))) - (when (string-search "emacs-lsp-booster" (car-safe com)) - (with-current-buffer buf (setq eglot-booster-boosted t))))))) - -(defvar eglot-booster--boost - '("emacs-lsp-booster" "--json-false-value" ":json-false" "--")) - -(defun eglot-booster--wrap-contact (args) - "Wrap contact within ARGS if possible." - (let ((contact (nth 3 args))) - (cond - ((and eglot-booster-no-remote-boost (file-remote-p default-directory))) - ((functionp contact) - (setf (nth 3 args) - (lambda (&optional interactive) - (let ((res (funcall contact interactive))) - (if (eglot-booster-plain-command res) - (append eglot-booster--boost res) - res))))) - ((eglot-booster-plain-command contact) - (setf (nth 3 args) (append eglot-booster--boost contact)))) - args)) - -;;;###autoload -(define-minor-mode eglot-booster-mode - "Minor mode which boosts plain eglot server programs with emacs-lsp-booster. -The emacs-lsp-booster program must be compiled and available on -variable `exec-path'. Only local stdin/out-based lsp servers can -be boosted." - :global t - :group 'eglot - (cond - (eglot-booster-mode - (unless (executable-find "emacs-lsp-booster") - (setq eglot-booster-mode nil) - (user-error "The emacs-lsp-booster program is not installed")) - (advice-add 'jsonrpc--json-read :around #'eglot-booster--jsonrpc--json-read) - (advice-add 'eglot--connect :filter-args #'eglot-booster--wrap-contact) - (add-hook 'eglot-server-initialized-hook #'eglot-booster--init)) - (t - (advice-remove 'jsonrpc--json-read #'eglot-booster--jsonrpc--json-read) - (advice-remove 'eglot--connect #'eglot-booster--wrap-contact) - (remove-hook 'eglot-server-initialized-hook #'eglot-booster--init)))) - -(provide 'eglot-booster) -;;; eglot-booster.el ends here diff --git a/ext/doom/config.el b/ext/doom/config.el index 2d17837..e93a02c 100644 --- a/ext/doom/config.el +++ b/ext/doom/config.el @@ -25,7 +25,7 @@ (setq nerd-icons-font-names '("SymbolsNerdFontMono-Regular.ttf")) (setq doom-font (font-spec :family "Iosevka Nerd Font Mono" :size 16) - doom-variable-pitch-font (font-spec :family "Iosevka Nerd Font Propo" :size 16) + doom-variable-pitch-font (font-spec :family "Iosevka Nerd Font Mono" :size 16) ;; doom-symbol-font (font-spec :family "all-the-icons" :size 13) doom-big-font (font-spec :family "Iosevka Nerd Font Mono" :size 20 :weight 'demibold)) @@ -137,7 +137,7 @@ :after lsp) -(use-package eglot-booster +(use-package! eglot-booster :after eglot :config (eglot-booster-mode)) diff --git a/ext/doom/init.el b/ext/doom/init.el index e6e098d..833aaf5 100644 --- a/ext/doom/init.el +++ b/ext/doom/init.el @@ -45,7 +45,7 @@ ophints ; highlight the region an operation acts on (popup +defaults) ; tame sudden yet inevitable temporary windows ;; tabs ; a tab bar for Emacs - (treemacs +lsp) ; a project drawer, like neotree but cooler + treemacs ; a project drawer, like neotree but cooler ;;unicode ; extended unicode support for various languages (vc-gutter +diff-hl @@ -60,7 +60,8 @@ (evil +everywhere) ; come to the dark side, we have cookies file-templates ; auto-snippets for empty files fold ; (nigh) universal code folding - (format +onsave) ; automated prettiness + (format +onsave + +lsp) ; automated prettiness ;;god ; run Emacs commands without modifier keys ;;lispy ; vim for lisp, for people who don't like vim ;;multiple-cursors ; editing in many places at once @@ -97,7 +98,7 @@ ;;collab ; buffers with friends ;;debugger ; FIXME stepping through code, to help you add bugs direnv - (docker +lsp) + docker ;;editorconfig ; let someone else argue about tabs vs spaces ;;ein ; tame Jupyter notebooks with emacs (eval +overlay) ; run code, run (also, repls) @@ -105,7 +106,7 @@ (lookup +docsets +dictionary) ; navigate your code and its documentation - lsp ; M-x vscode + (lsp +eglot) ; M-x vscode magit ; a git porcelain for Emacs ;;make ; run make tasks from Emacs ;;pass ; password manager for nerds @@ -125,8 +126,9 @@ :lang ;;agda ; types of types of types of types... ;;beancount ; mind the GAAP - (cc +lsp - +tree-sitter) ; C > C++ == 1 + (cc + +lsp ;;;; supports eglot + +tree-sitter) ; C > C++ == 1 ;;clojure ; java with a lisp ;;common-lisp ; if you've seen one lisp, you've seen them all ;;coq ; proofs-as-programs @@ -139,23 +141,22 @@ ;;elm ; care for a cup of TEA? emacs-lisp ; drown in parentheses ;;erlang ; an elegant language for a more civilized age - (ess +lsp) ; emacs speaks statistics + ess ; emacs speaks statistics ;;factor ;;faust ; dsp, but you get to keep your soul ;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER) ;;fsharp ; ML stands for Microsoft's Language ;;fstar ; (dependent) types and (monadic) effects and Z3 ;;gdscript ; the language you waited for - ;;(go +lsp) ; the hipster dialect - (graphql +lsp) ; Give queries a REST - ;;(haskell +lsp) ; a language that's lazier than I am + ;;go ; the hipster dialect + graphql ; Give queries a REST + ;;haskell ; a language that's lazier than I am ;;hy ; readability of scheme w/ speed of python ;;idris ; a language you can depend on (json - +tree-sitter) ; At least it ain't XML - ;;(java +lsp) ; the poster child for carpal tunnel syndrome + +tree-sitter) ; At least it ain't XML + ;;java ; the poster child for carpal tunnel syndrome (javascript - +lsp +tree-sitter) ; all(hope(abandon(ye(who(enter(here)))))) ;;julia ; a better, faster MATLAB ;;kotlin ; a better, slicker Java(Script) @@ -165,8 +166,7 @@ ;;lua ; one-based indices? one-based indices markdown ; writing docs for people to ignore ;;nim ; python + lisp at the speed of c - (nix +lsp - +tree-sitter) ; I hereby declare "nix geht mehr!" + (nix +tree-sitter) ; I hereby declare "nix geht mehr!" ;;ocaml ; an objective camel (org ; organize your plain life in plain text +jupyter @@ -187,13 +187,12 @@ rest ; Emacs as a REST client ;;rst ; ReST in peace ;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} - (rust +lsp + (rust +lsp ;;;; supports eglot +tree-sitter) ; Fe2O3.unwrap().unwrap().unwrap().unwrap() ;;scala ; java, but good ;;(scheme +guile) ; a fully conniving family of lisps (sh +fish - +lsp +tree-sitter) ; she sells {ba,z,fi}sh shells on the C xor ;;sml ;;solidity ; do you need a blockchain? No. @@ -201,11 +200,9 @@ ;;terra ; Earth and Moon in alignment for performance. (web +css - +lsp +tree-sitter) ; the tubes (yaml - +tree-sitter - +lsp) ; JSON, but readable + +tree-sitter) ; JSON, but readable ;;zig ; C, but simpler :email diff --git a/ext/doom/packages.el b/ext/doom/packages.el index 13ab12e..5e14139 100644 --- a/ext/doom/packages.el +++ b/ext/doom/packages.el @@ -39,6 +39,8 @@ ;; Use `:pin' to specify a particular commit to install. +(package! eglot-booster :recipe (:type git :host nil :repo "https://github.com/jdtsmith/eglot-booster.git" :branch "main")) + ;; tabs (package! centaur-tabs)