This commit is contained in:
Evie Litherland-Smith 2024-07-30 07:36:46 +01:00
commit b8cafe0698
2 changed files with 30 additions and 36 deletions

61
init.el
View file

@ -62,7 +62,7 @@
completions-detailed t completions-detailed t
kill-do-not-save-duplicates t kill-do-not-save-duplicates t
initial-frame-alist nil initial-frame-alist nil
default-frame-alist '((width . 96) (height . 32))) default-frame-alist nil)
(setq-default truncate-lines t (setq-default truncate-lines t
truncate-partial-width-windows nil) truncate-partial-width-windows nil)
@ -333,7 +333,7 @@
(add-hook 'magit-pre-refresh-hook #'diff-hl-magit-pre-refresh) (add-hook 'magit-pre-refresh-hook #'diff-hl-magit-pre-refresh)
(add-hook 'magit-post-refresh-hook #'diff-hl-magit-post-refresh) (add-hook 'magit-post-refresh-hook #'diff-hl-magit-post-refresh)
:custom :custom
(diff-hl-disable-on-remote t) (diff-hl-disable-on-remote nil)
(diff-hl-draw-borders t) (diff-hl-draw-borders t)
:config :config
(global-diff-hl-mode)) (global-diff-hl-mode))
@ -563,7 +563,7 @@
(org-agenda-include-deadlines t) (org-agenda-include-deadlines t)
(org-agenda-todo-ignore-scheduled 'future) (org-agenda-todo-ignore-scheduled 'future)
(org-agenda-todo-ignore-deadlines 'far) (org-agenda-todo-ignore-deadlines 'far)
(org-agenda-clockreport-parameter-plist '(:link t :maxlevel 4)) (org-agenda-clockreport-parameter-plist '(:link t :maxlevel 6 :emphasize t :stepskip0 t :fileskip0 t :filetitle t :properties ("WON")))
(org-agenda-start-with-clockreport-mode t) (org-agenda-start-with-clockreport-mode t)
(org-agenda-start-with-log-mode t) (org-agenda-start-with-log-mode t)
(org-agenda-prefix-format '((agenda . " %-12:c%?-12t% s") (org-agenda-prefix-format '((agenda . " %-12:c%?-12t% s")
@ -867,21 +867,17 @@
("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 ((eglot-managed-mode . (lambda () (add-hook 'flymake-diagnostic-functions 'eglot-flymake-backend nil t))) :hook ((eglot-managed-mode . (lambda () (add-hook 'flymake-diagnostic-functions 'eglot-flymake-backend nil t)))
(nix-mode . (lambda () (if (and (project-current nil) (nix-mode . (lambda () (if (and (project-current nil) (executable-find "nil" t))
(executable-find "nil" t))
(eglot-ensure)))) (eglot-ensure))))
(python-base-mode . (lambda () (if (and (project-current nil) (python-base-mode . (lambda () (if (and (project-current nil)
(or (executable-find "pyright" t) (or (executable-find "pyright" t)
(executable-find "pylsp" t))) (executable-find "pylsp" t)))
(eglot-ensure)))) (eglot-ensure))))
(lua-mode . (lambda () (if (and (project-current nil) (lua-mode . (lambda () (if (and (project-current nil) (executable-find "lua-language-server" t))
(executable-find "lua-language-server" t))
(eglot-ensure)))) (eglot-ensure))))
((rust-ts-mode rust-mode) . (lambda () (if (and (project-current nil) ((rust-ts-mode rust-mode) . (lambda () (if (and (project-current nil) (executable-find "rust-analyzer" t))
(executable-find "rust-analyzer" t))
(eglot-ensure)))) (eglot-ensure))))
((js-base-mode typescript-ts-base-mode) . (lambda () (if (and (project-current nil) ((js-base-mode typescript-ts-base-mode) . (lambda () (if (and (project-current nil) (executable-find "typescript-language-server" t))
(executable-find "typescript-language-server" t))
(eglot-ensure)))) (eglot-ensure))))
) )
:custom :custom
@ -904,7 +900,12 @@
(setq eglot-stay-out-of '(flymake)) (setq eglot-stay-out-of '(flymake))
:config :config
(setq-default eglot-workspace-configuration (setq-default eglot-workspace-configuration
'( :pylsp ( :plugins '( :nil ( :nix
( :maxMemoryMB nil
:flake
( :autoArchive t
:nixpkgsInputName "nixpkgs")))
:pylsp ( :plugins
( :autopep8 (:enabled nil) ( :autopep8 (:enabled nil)
:flake8 (:enabled nil) :flake8 (:enabled nil)
:jedi_completion ( :enabled t :jedi_completion ( :enabled t
@ -923,17 +924,7 @@
:rope_autoimport ( :completions (:enabled t) :rope_autoimport ( :completions (:enabled t)
:code_actions (:enabled t)) :code_actions (:enabled t))
:rope_completion (:enabled t) :rope_completion (:enabled t)
:yapf (:enabled nil))) :yapf (:enabled nil)))))
:pyright (:python
(:analysis
( :autoSearchPaths t
:diagnosticMode "openFilesOnly"
:useLibraryCodeForTypes t)))
:nil ( :nix
( :maxMemoryMB nil
:flake
( :autoArchive t
:nixpkgsInputName "nixpkgs")))))
) )
(use-package apheleia (use-package apheleia
@ -945,11 +936,10 @@
:custom (apheleia-remote-algorithm 'cancel) :custom (apheleia-remote-algorithm 'cancel)
:config :config
(add-to-list 'apheleia-formatters '(alejandra . ("alejandra"))) (add-to-list 'apheleia-formatters '(alejandra . ("alejandra")))
(add-to-list 'apheleia-formatters '(isort . ("isort" "--profile" "black" "-")))
(add-to-list 'apheleia-mode-alist '(nix-mode . alejandra)) (add-to-list 'apheleia-mode-alist '(nix-mode . alejandra))
(add-to-list 'apheleia-mode-alist '(python-base-mode . (black isort))) (add-to-list 'apheleia-mode-alist '(python-base-mode . (ruff ruff-isort)))
(add-to-list 'apheleia-mode-alist '(python-mode . (black isort))) (add-to-list 'apheleia-mode-alist '(python-mode . (ruff ruff-isort)))
(add-to-list 'apheleia-mode-alist '(python-ts-mode . (black isort)))) (add-to-list 'apheleia-mode-alist '(python-ts-mode . (ruff ruff-isort))))
(use-package flymake (use-package flymake
:bind (("C-c C-." . flymake-goto-next-error) :bind (("C-c C-." . flymake-goto-next-error)
@ -1053,16 +1043,19 @@ Calls `project-remember-projects-under' for ~/Projects/"
(display-fill-column-indicator-mode +1)) (display-fill-column-indicator-mode +1))
(use-package python (use-package python
:hook ((python-base-mode . (lambda () (my/enable-fill-column 88)))) :hook ((python-base-mode . (lambda () (my/enable-fill-column 88)))
(python-base-mode . (lambda () (setq-local
python-check-command (cond
((executable-find "mypy" t) "mypy --check-untyped-defs --warn-unreachable --show-error-codes --ignore-missing-imports")
(t "pyflakes"))
python-flymake-command (cond
((executable-find "ruff" t) '("ruff" "check" "--output-format=concise" "--stdin-filename=stdin" "-"))
((executable-find "flake8" t) '("flake8" "--max-line-length" "88" "-"))
(t '("pyflakes")))))))
:custom :custom
(python-shell-interpreter "python3") (python-shell-interpreter "python3")
(python-shell-dedicated 'project) (python-shell-dedicated nil)
(python-indent-def-block-scale 1) (python-indent-def-block-scale 1)
(python-check-command "mypy --check-untyped-defs --warn-unreachable --show-error-codes --ignore-missing-imports")
(python-flymake-command
(cond ((executable-find "ruff") '("ruff" "check" "--output-format=concise" "--stdin-filename=stdin" "-"))
((executable-find "flake8") '("flake8" "--max-line-length" "88" "-"))
(t '("pyflakes"))))
:config :config
(setq python-ts-mode-hook python-mode-hook)) (setq python-ts-mode-hook python-mode-hook))

View file

@ -207,10 +207,11 @@ envrc-file-mode
(python "CC=\"$(nix build nixpkgs#stdenv.cc.cc.lib --print-out-paths --no-link)\"" n (python "CC=\"$(nix build nixpkgs#stdenv.cc.cc.lib --print-out-paths --no-link)\"" n
"ZLIB=\"$(nix build nixpkgs#zlib --print-out-paths --no-link)\"" n "ZLIB=\"$(nix build nixpkgs#zlib --print-out-paths --no-link)\"" n
"PYTHON=\"$(nix build " (p "nixpkgs#python3Full") " --print-out-paths --no-link)/bin/python3\"" n
"VENV_DIR=" (p ".venv") n
"export LD_LIBRARY_PATH=\"$CC/lib\":\"$ZLIB/lib\"" n "export LD_LIBRARY_PATH=\"$CC/lib\":\"$ZLIB/lib\"" n
"VENV_DIR=.venv/" n
"if [ ! -f $VENV_DIR/bin/python3 ]; then" n "if [ ! -f $VENV_DIR/bin/python3 ]; then" n
> "python3 -m venv $VENV_DIR" n > "$PYTHON -m venv $VENV_DIR" n
"fi" n "fi" n
"source $VENV_DIR/bin/activate") "source $VENV_DIR/bin/activate")