eglot integration cleaned up a bit, fixed bug with option group

This commit is contained in:
Mike 'Fuzzy' Partin 2024-07-06 14:07:15 -07:00
parent 8e298e0b31
commit 5d034ac3fb
6 changed files with 51 additions and 52 deletions

View File

@ -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. 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. 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. 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 *** Optional packages

View File

@ -3,8 +3,8 @@
;; ;;
;; define the group ;; define the group
(defgroup thwap-config-group nil (defgroup thwap-config nil
"T.H.W.A.P. Emacs configuration group." "T.H.W.A.P. Emacs configuration group."
:group 'convenience :group 'convenience
:prefix "thwap-") :prefix "thwap-")
@ -17,49 +17,49 @@
(defcustom thwap-ui-enable-modus-themes nil (defcustom thwap-ui-enable-modus-themes nil
"Whether or not to install the modus themes." "Whether or not to install the modus themes."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
;; doom themes toggle ;; doom themes toggle
(defcustom thwap-ui-enable-doom-themes nil (defcustom thwap-ui-enable-doom-themes nil
"Whether or not to install the doom themes." "Whether or not to install the doom themes."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
;; sublime themes toggle ;; sublime themes toggle
(defcustom thwap-ui-enable-sublime-themes nil (defcustom thwap-ui-enable-sublime-themes nil
"Whether or not to install the sublime themes." "Whether or not to install the sublime themes."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
;; kaolin themes toggle ;; kaolin themes toggle
(defcustom thwap-ui-enable-kaolin-themes nil (defcustom thwap-ui-enable-kaolin-themes nil
"Whether or not to install the kaolin themes." "Whether or not to install the kaolin themes."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
;; alect themes toggle ;; alect themes toggle
(defcustom thwap-ui-enable-alect-themes nil (defcustom thwap-ui-enable-alect-themes nil
"Whether or not to install the alect themes." "Whether or not to install the alect themes."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
;; theme to load ;; theme to load
(defcustom thwap-ui-theme 'wombat ;; 'modus-vivendi-tinted (defcustom thwap-ui-theme 'wombat ;; 'modus-vivendi-tinted
"Name of the theme to load." "Name of the theme to load."
:type 'string :type 'string
:group 'thwap-config-group) :group 'thwap-config)
;; all-the-icons toggle ;; all-the-icons toggle
(defcustom thwap-ui-enable-all-the-icons nil (defcustom thwap-ui-enable-all-the-icons nil
"Whether or not to enable all-the-icons." "Whether or not to enable all-the-icons."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
;; nerd-icons toggle ;; nerd-icons toggle
(defcustom thwap-ui-enable-nerd-icons nil (defcustom thwap-ui-enable-nerd-icons nil
"Whether or not to enable nerd-icons." "Whether or not to enable nerd-icons."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
;; ;;
@ -70,13 +70,13 @@
(defcustom thwap-fm-enable-treemacs nil (defcustom thwap-fm-enable-treemacs nil
"Whether or not to enable treemacs." "Whether or not to enable treemacs."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
;; neotree toggle ;; neotree toggle
(defcustom thwap-fm-enable-neotree nil (defcustom thwap-fm-enable-neotree nil
"Whether or not to enable neotree." "Whether or not to enable neotree."
:type 'boolean' :type 'boolean'
:group 'thwap-config-group) :group 'thwap-config)
;; ;;
@ -87,13 +87,13 @@
(defcustom thwap-comp-enable-company nil (defcustom thwap-comp-enable-company nil
"Whether or not to enable company." "Whether or not to enable company."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
;; auto-complete toggle ;; auto-complete toggle
(defcustom thwap-comp-enable-auto-complete nil (defcustom thwap-comp-enable-auto-complete nil
"Whether or not to enable auto-complete." "Whether or not to enable auto-complete."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
;; ;;
@ -104,49 +104,55 @@
(defcustom thwap-dev-enable-lsp nil (defcustom thwap-dev-enable-lsp nil
"Whether or not to enable lsp." "Whether or not to enable lsp."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
;; projectile toggle ;; projectile toggle
(defcustom thwap-dev-enable-projectile nil (defcustom thwap-dev-enable-projectile nil
"Whether or not to enable projectile." "Whether or not to enable projectile."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
;; magit toggle ;; magit toggle
(defcustom thwap-dev-enable-magit nil (defcustom thwap-dev-enable-magit nil
"Whether or not to enable magit." "Whether or not to enable magit."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
;; Copilot toggle ;; Copilot toggle
(defcustom thwap-dev-enable-copilot nil (defcustom thwap-dev-enable-copilot nil
"Whether or not to enable copilot." "Whether or not to enable copilot."
:type 'boolean :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 ;; Go toggle
(defcustom thwap-dev-enable-go nil (defcustom thwap-dev-enable-go nil
"Whether or not to setup Go development modes." "Whether or not to setup Go development modes."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
;; Python toggle ;; Python toggle
(defcustom thwap-dev-enable-python nil (defcustom thwap-dev-enable-python nil
"Whether or not to setup Python development modes." "Whether or not to setup Python development modes."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
;; Terraform toggle ;; Terraform toggle
(defcustom thwap-dev-enable-terraform nil (defcustom thwap-dev-enable-terraform nil
"Whether or not to setup Terraform development modes." "Whether or not to setup Terraform development modes."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
;; Yaml toggle ;; Yaml toggle
(defcustom thwap-dev-enable-yaml nil (defcustom thwap-dev-enable-yaml nil
"Whether or not to setup Yaml modes." "Whether or not to setup Yaml modes."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
;; ;;
;; Org mode settings ;; Org mode settings
@ -154,73 +160,62 @@
(defcustom thwap-org-enable-org nil (defcustom thwap-org-enable-org nil
"Whether or not to enable org-mode." "Whether or not to enable org-mode."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
(defcustom thwap-org-enable-org-bullets nil (defcustom thwap-org-enable-org-bullets nil
"Whether or not to enable org-bullets." "Whether or not to enable org-bullets."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
(defcustom thwap-org-enable-org-super-agenda nil (defcustom thwap-org-enable-org-super-agenda nil
"Whether or not to enable org-super-agenda." "Whether or not to enable org-super-agenda."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
(defcustom thwap-org-enable-org-modern nil (defcustom thwap-org-enable-org-modern nil
"Whether or not to enable org-modern." "Whether or not to enable org-modern."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
(defcustom thwap-org-enable-org-timeblock nil (defcustom thwap-org-enable-org-timeblock nil
"Whether or not to enable org-timeblock." "Whether or not to enable org-timeblock."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
(defcustom thwap-org-enable-org-download nil (defcustom thwap-org-enable-org-download nil
"Whether or not to enable org-download." "Whether or not to enable org-download."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
(defcustom thwap-org-enable-org-roam nil (defcustom thwap-org-enable-org-roam nil
"Whether or not to enable org-roam." "Whether or not to enable org-roam."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
(defcustom thwap-org-enable-org-roam-ui nil (defcustom thwap-org-enable-org-roam-ui nil
"Whether or not to enable org-roam-ui." "Whether or not to enable org-roam-ui."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
(defcustom thwap-org-enable-ob-mermaid nil (defcustom thwap-org-enable-ob-mermaid nil
"Whether or not to enable ob-mermaid." "Whether or not to enable ob-mermaid."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
(defcustom thwap-org-enable-org-transclusion nil (defcustom thwap-org-enable-org-transclusion nil
"Whether or not to enable org-transclusion." "Whether or not to enable org-transclusion."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
(defcustom thwap-org-enable-org-ai nil (defcustom thwap-org-enable-org-ai nil
"Whether or not to enable org-ai." "Whether or not to enable org-ai."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config)
(defcustom thwap-org-openai-api-token nil (defcustom thwap-org-openai-api-token nil
"OpenAI API Token for use in org-ai." "OpenAI API Token for use in org-ai."
:type 'string :type 'string
:group 'thwap-config-group) :group 'thwap-config)
;;
;; 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))
;; our provide statement ;; our provide statement

View File

@ -42,7 +42,7 @@
;; Add a command to customize the T.H.W.A.P. group ;; Add a command to customize the T.H.W.A.P. group
(thwap/add-key-binding (thwap/add-key-binding
"C-c" "C-c"
(lambda () (interactive) (customize-group 'thwap-config-group)) (lambda () (interactive) (customize-group 'thwap-config))
"Customize this T.H.W.A.P. Emacs Installation") "Customize this T.H.W.A.P. Emacs Installation")
;; quick commenting/uncommenting of a region is just too useful ;; quick commenting/uncommenting of a region is just too useful

5
lib/thwap-eglot.el Normal file
View File

@ -0,0 +1,5 @@
(when (or thwap -dev-enable-eglot thwap-dev-enable-lsp)
(straight-use-package 'eglot)
(require 'eglot))
(provide 'thwap-eglot)

View File

@ -1,7 +1,6 @@
(when thwap-dev-enable-go (when thwap-dev-enable-go
(straight-use-package 'go-mode) (straight-use-package 'go-mode)
(straight-use-package 'eglot)
(setq lsp-go-analyses '((shadow . t) (setq lsp-go-analyses '((shadow . t)
(simplifycompositelit . :json-false))) (simplifycompositelit . :json-false)))
(when (executable-find "gopls") (when (executable-find "gopls")

View File

@ -6,13 +6,12 @@
(custom-set-variables (custom-set-variables
'(terraform-indent-level 2) '(terraform-indent-level 2)
'(terraform-format-on-save t)) '(terraform-format-on-save t))
(when (executable-find "terraform-ls")
(add-hook 'terraform-mode-hook 'eglot-ensure))
:config :config
(straight-use-package 'eglot)
(require 'eglot)
(add-to-list 'eglot-server-programs (add-to-list 'eglot-server-programs
`(terraform-mode . ("terraform-ls" "serve")))) `(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) (provide 'thwap-tf)