Cleanup setting up eglot/flymake mode configs

Remove some packages not being used anymore

Switch python-flymake back-end to use flake8 instead of pyflakes
This commit is contained in:
Evie Litherland-Smith 2024-04-26 13:54:21 +01:00
parent 21598193e4
commit 22aa67ccfb

58
init.el
View file

@ -911,21 +911,16 @@ Try `magit-clone-default-directory' if available, fall back to
("C-c c e" . eglot) ("C-c c e" . eglot)
("C-c c a" . eglot-code-actions) ("C-c c a" . eglot-code-actions)
("C-c c r" . eglot-rename)) ("C-c c r" . eglot-rename))
:hook (((nix-mode :hook (((nix-mode python-base-mode fortran-mode f90-mode) . eglot-ensure)
lua-mode (eglot-managed-mode . (lambda () (add-hook 'flymake-diagnostic-functions
python-base-mode 'eglot-flymake-backend nil t))))
rust-ts-mode
fortran-mode
f90-mode
js-ts-mode)
. eglot-ensure)
(eglot-managed-mode . (lambda () (add-to-list 'flymake-diagnostic-functions #'eglot-flymake-backend t))))
:custom :custom
(eglot-extend-to-xref t) (eglot-extend-to-xref t)
(eglot-autoshutdown t) (eglot-autoshutdown t)
(eglot-autoreconnect nil) (eglot-autoreconnect nil)
:config :init
(setq eglot-stay-out-of '(flymake)) (setq eglot-stay-out-of '(flymake))
:config
(setq-default eglot-workspace-configuration (setq-default eglot-workspace-configuration
'( :pylsp ( :plugins '( :pylsp ( :plugins
( :autopep8 (:enabled nil) ( :autopep8 (:enabled nil)
@ -974,7 +969,7 @@ Try `magit-clone-default-directory' if available, fall back to
(use-package flymake (use-package flymake
:bind (("C-c C-." . flymake-goto-next-error) :bind (("C-c C-." . flymake-goto-next-error)
("C-c C-," . flymake-goto-prev-error)) ("C-c C-," . flymake-goto-prev-error))
:hook (prog-mode . flymake-mode) :hook (prog-mode . (lambda () (flymake-mode +1)))
:config (require 'flymake-collection)) :config (require 'flymake-collection))
(use-package flymake-popon (use-package flymake-popon
@ -983,7 +978,6 @@ Try `magit-clone-default-directory' if available, fall back to
(global-flymake-popon-mode +1)) (global-flymake-popon-mode +1))
(use-package flymake-collection (use-package flymake-collection
:defer
:after flymake :after flymake
:custom :custom
;; Extra mypy config ;; Extra mypy config
@ -998,18 +992,6 @@ Try `magit-clone-default-directory' if available, fall back to
:after flymake :after flymake
:hook (sh-mode . flymake-shellcheck-load)) :hook (sh-mode . flymake-shellcheck-load))
(use-package flymake-clippy
:after flymake
:hook ((rust-mode rust-ts-mode) . flymake-clippy-setup-backend))
(use-package flymake-eslint
:after flymake
:hook (js-ts-mode . flymake-eslint-enable))
(use-package flymake-ruff
:after flymake
:hook (python-base-mode . flymake-ruff-load))
(setq project-switch-use-entire-map t (setq project-switch-use-entire-map t
project-switch-commands '((project-find-file "Find file") project-switch-commands '((project-find-file "Find file")
(project-find-regexp "Find regexp") (project-find-regexp "Find regexp")
@ -1056,31 +1038,27 @@ Try `magit-clone-default-directory' if available, fall back to
(require 'nix-store) (require 'nix-store)
(nix-prettify-global-mode +1)) (nix-prettify-global-mode +1))
(use-package nushell-ts-mode
:defer t
:mode "\\.nu\\'")
(use-package lua-mode
:defer t)
(defun my/enable-fill-column (col) (defun my/enable-fill-column (col)
"Set and enable fill column to `COL'." "Set and enable fill column to `COL'."
(set-fill-column col) (set-fill-column col)
(display-fill-column-indicator-mode +1)) (display-fill-column-indicator-mode +1))
(use-package python (use-package python
:defer t :hook ((python-base-mode . (lambda () (my/enable-fill-column 88)))
(python-base-mode . (lambda () (add-hook 'flymake-diagnostic-functions
'flymake-collection-mypy nil t))))
:custom :custom
(python-check-command (cond ((executable-find "ruff") "ruff check --output-format=pylint") (python-flymake-command
((executable-find "pyflakes") "pyflakes") (cond ((executable-find "flake8") '("flake8" "-"))
((executable-find "epylint") "epylint") (t ("pyflakes"))))
(t "pyflakes"))) (python-check-command
(cond ((executable-find "flake8") "flake8")
(t "pyflakes")))
:config :config
(setq python-ts-mode-hook python-mode-hook) (setq python-ts-mode-hook python-mode-hook))
(add-hook 'python-base-mode-hook (lambda () (my/enable-fill-column 88))))
(use-package cargo (use-package python-docstring
:hook (rust-ts-mode . cargo-minor-mode)) :hook python-base-mode)
(use-package tramp (use-package tramp
:defer t :defer t