From 5d034ac3fbaeabcc41b3a233e72a28bac2b48d02 Mon Sep 17 00:00:00 2001 From: Mike 'Fuzzy' Partin Date: Sat, 6 Jul 2024 14:07:15 -0700 Subject: [PATCH] eglot integration cleaned up a bit, fixed bug with option group --- README.org | 1 + lib/thwap-config.el | 85 ++++++++++++++++++++----------------------- lib/thwap-defaults.el | 2 +- lib/thwap-eglot.el | 5 +++ lib/thwap-go.el | 1 - lib/thwap-tf.el | 9 ++--- 6 files changed, 51 insertions(+), 52 deletions(-) create mode 100644 lib/thwap-eglot.el diff --git a/README.org b/README.org index e389b8c..4c87e66 100644 --- a/README.org +++ b/README.org @@ -53,6 +53,7 @@ advantage of the configuration interface. 3. [[https://github.com/roman/golden-ratio.el][golden-ratio.el]] - Window size management for split buffers. Quite handy. 4. [[https://github.com/emacs-dashboard/emacs-dashboard][emacs-dashboard]] - A nice handy startup screen, filled with fun facts and stuff. 5. [[https://github.com/joaotavora/yasnippet][yasnippet]] - A handy snippet/macro system for commonly used bits. +6. [[https://github.com/joaotavora/eglot][eglot]] - Emacs Polyglot LSP library (seems like everything uses this). *** Optional packages diff --git a/lib/thwap-config.el b/lib/thwap-config.el index a229ecc..937b9a0 100644 --- a/lib/thwap-config.el +++ b/lib/thwap-config.el @@ -3,8 +3,8 @@ ;; ;; define the group -(defgroup thwap-config-group nil - "T.H.W.A.P. Emacs configuration group." +(defgroup thwap-config nil + "T.H.W.A.P. Emacs configuration group." :group 'convenience :prefix "thwap-") @@ -17,49 +17,49 @@ (defcustom thwap-ui-enable-modus-themes nil "Whether or not to install the modus themes." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) ;; doom themes toggle (defcustom thwap-ui-enable-doom-themes nil "Whether or not to install the doom themes." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) ;; sublime themes toggle (defcustom thwap-ui-enable-sublime-themes nil "Whether or not to install the sublime themes." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) ;; kaolin themes toggle (defcustom thwap-ui-enable-kaolin-themes nil "Whether or not to install the kaolin themes." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) ;; alect themes toggle (defcustom thwap-ui-enable-alect-themes nil "Whether or not to install the alect themes." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) ;; theme to load (defcustom thwap-ui-theme 'wombat ;; 'modus-vivendi-tinted "Name of the theme to load." :type 'string - :group 'thwap-config-group) + :group 'thwap-config) ;; all-the-icons toggle (defcustom thwap-ui-enable-all-the-icons nil "Whether or not to enable all-the-icons." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) ;; nerd-icons toggle (defcustom thwap-ui-enable-nerd-icons nil "Whether or not to enable nerd-icons." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) ;; @@ -70,13 +70,13 @@ (defcustom thwap-fm-enable-treemacs nil "Whether or not to enable treemacs." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) ;; neotree toggle (defcustom thwap-fm-enable-neotree nil "Whether or not to enable neotree." :type 'boolean' - :group 'thwap-config-group) + :group 'thwap-config) ;; @@ -87,13 +87,13 @@ (defcustom thwap-comp-enable-company nil "Whether or not to enable company." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) ;; auto-complete toggle (defcustom thwap-comp-enable-auto-complete nil "Whether or not to enable auto-complete." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) ;; @@ -104,49 +104,55 @@ (defcustom thwap-dev-enable-lsp nil "Whether or not to enable lsp." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) ;; projectile toggle (defcustom thwap-dev-enable-projectile nil "Whether or not to enable projectile." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) ;; magit toggle (defcustom thwap-dev-enable-magit nil "Whether or not to enable magit." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) ;; Copilot toggle (defcustom thwap-dev-enable-copilot nil "Whether or not to enable copilot." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) + +;; Eglot toggle +(defcustom thwap-dev-enable-eglot t + "Whether or not to setup Eglot." + :type 'boolean + :group 'thwap-config) ;; Go toggle (defcustom thwap-dev-enable-go nil "Whether or not to setup Go development modes." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) ;; Python toggle (defcustom thwap-dev-enable-python nil "Whether or not to setup Python development modes." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) ;; Terraform toggle (defcustom thwap-dev-enable-terraform nil "Whether or not to setup Terraform development modes." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) ;; Yaml toggle (defcustom thwap-dev-enable-yaml nil "Whether or not to setup Yaml modes." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) ;; ;; Org mode settings @@ -154,73 +160,62 @@ (defcustom thwap-org-enable-org nil "Whether or not to enable org-mode." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) (defcustom thwap-org-enable-org-bullets nil "Whether or not to enable org-bullets." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) (defcustom thwap-org-enable-org-super-agenda nil "Whether or not to enable org-super-agenda." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) (defcustom thwap-org-enable-org-modern nil "Whether or not to enable org-modern." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) (defcustom thwap-org-enable-org-timeblock nil "Whether or not to enable org-timeblock." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) (defcustom thwap-org-enable-org-download nil "Whether or not to enable org-download." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) (defcustom thwap-org-enable-org-roam nil "Whether or not to enable org-roam." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) (defcustom thwap-org-enable-org-roam-ui nil "Whether or not to enable org-roam-ui." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) (defcustom thwap-org-enable-ob-mermaid nil "Whether or not to enable ob-mermaid." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) (defcustom thwap-org-enable-org-transclusion nil "Whether or not to enable org-transclusion." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) (defcustom thwap-org-enable-org-ai nil "Whether or not to enable org-ai." :type 'boolean - :group 'thwap-config-group) + :group 'thwap-config) (defcustom thwap-org-openai-api-token nil "OpenAI API Token for use in org-ai." :type 'string - :group 'thwap-config-group) - -;; -;; Example usage -;; - -;; Example usage -(defun my-custom-function () - "Function that uses the custom variables." - (message "Custom variable 1: %s" thwap-config-enable-modus-themes) - (message "Custom variable 2: %s" thwap-config-theme) - (message "Custom variable 3: %s" thwap-config-enable-alltheicons)) + :group 'thwap-config) ;; our provide statement diff --git a/lib/thwap-defaults.el b/lib/thwap-defaults.el index c5266f6..9f52f0c 100644 --- a/lib/thwap-defaults.el +++ b/lib/thwap-defaults.el @@ -42,7 +42,7 @@ ;; Add a command to customize the T.H.W.A.P. group (thwap/add-key-binding "C-c" - (lambda () (interactive) (customize-group 'thwap-config-group)) + (lambda () (interactive) (customize-group 'thwap-config)) "Customize this T.H.W.A.P. Emacs Installation") ;; quick commenting/uncommenting of a region is just too useful diff --git a/lib/thwap-eglot.el b/lib/thwap-eglot.el new file mode 100644 index 0000000..c93a810 --- /dev/null +++ b/lib/thwap-eglot.el @@ -0,0 +1,5 @@ +(when (or thwap -dev-enable-eglot thwap-dev-enable-lsp) + (straight-use-package 'eglot) + (require 'eglot)) + +(provide 'thwap-eglot) diff --git a/lib/thwap-go.el b/lib/thwap-go.el index cf9738f..095ca08 100644 --- a/lib/thwap-go.el +++ b/lib/thwap-go.el @@ -1,7 +1,6 @@ (when thwap-dev-enable-go (straight-use-package 'go-mode) - (straight-use-package 'eglot) (setq lsp-go-analyses '((shadow . t) (simplifycompositelit . :json-false))) (when (executable-find "gopls") diff --git a/lib/thwap-tf.el b/lib/thwap-tf.el index 7ddf065..c63b589 100644 --- a/lib/thwap-tf.el +++ b/lib/thwap-tf.el @@ -6,13 +6,12 @@ (custom-set-variables '(terraform-indent-level 2) '(terraform-format-on-save t)) - (when (executable-find "terraform-ls") - (add-hook 'terraform-mode-hook 'eglot-ensure)) :config - (straight-use-package 'eglot) - (require 'eglot) (add-to-list 'eglot-server-programs `(terraform-mode . ("terraform-ls" "serve")))) - (add-hook 'terraform-mode-hook #'lsp-deferred)) + (when thwap-dev-enable-lsp + (when (executable-find "terraform-ls") + (add-hook 'terraform-mode-hook 'eglot-ensure)) + (add-hook 'terraform-mode-hook #'lsp-deferred))) (provide 'thwap-tf)