From b8d1ff5f0d8edcbb2a29bb1e3322deb2ad169666 Mon Sep 17 00:00:00 2001 From: iamtoaster Date: Wed, 24 Dec 2025 09:22:33 +0900 Subject: [PATCH] Updates to rust lsp, remove org-fc --- .config.d/07-org.el | 14 ---------- .config.d/15-lsp.el | 65 ++++++++++++++++++++++++++++++++------------- custom.el | 2 +- 3 files changed, 47 insertions(+), 34 deletions(-) diff --git a/.config.d/07-org.el b/.config.d/07-org.el index da7167f..66bf77d 100644 --- a/.config.d/07-org.el +++ b/.config.d/07-org.el @@ -78,18 +78,4 @@ "~/data2/Notes/inbox.org" "Words") #'tatoeba-get-capture-template))) -;; This package adds flashcard functionality to org files. -(use-package org-fc - :straight (org-fc - :type git - :host nil - :repo "https://git.sr.ht/~l3kn/org-fc" - :branch "main" - :files (:defaults "awk" "demo.org")) - :after org - :ensure t - :defer nil - :custom - (org-fc-directories '("~/data2/Notes/"))) - ;;; 07-org.el ends here diff --git a/.config.d/15-lsp.el b/.config.d/15-lsp.el index 5772b8f..4df90eb 100644 --- a/.config.d/15-lsp.el +++ b/.config.d/15-lsp.el @@ -7,6 +7,23 @@ ;;; Code: +;; This package provides syntax highlighting and some utilities for +;; working with rust code. +(use-package rust-mode + :ensure t + :defer t + :commands (rust-mode)) + +(add-hook 'rust-mode-hook #'eglot-ensure) + +;; Clippy backend for flymake so we get propa error reporting in Rust +(use-package flymake-clippy + :hook (rust-mode . flymake-clippy-setup-backend)) + +(defun manually-activate-flymake () + (add-hook 'flymake-diagnostic-functions #'eglot-flymake-backend nil t) + (flymake-mode 1)) + ;; Eglot is the built-in LSP client. (use-package eglot :ensure nil @@ -17,15 +34,21 @@ eglot-rename eglot-format-buffer) + :hook ((eglot-managed-mode . manually-activate-flymake)) + :custom - (eglot-report-progress nil) ; Prevent minibuffer spam + (eglot-report-progress nil) ; Prevent minibuffer spam :config - (add-to-list 'eglot-server-programs '((rust-mode) . ("rust-analyzer"))) + (add-to-list 'eglot-server-programs '((rust-mode) . ("rust-analyzer" :initializationOptions + ( :procMacro (:enable t) + :cargo ( :buildScripts (:enable t) ))))) (add-to-list 'eglot-server-programs '(nix-mode . ("nil"))) + (add-to-list 'eglot-stay-out-of 'flymake) ;; Optimizations (fset #'jsonrpc--log-event #'ignore) - (setq jsonrpc-event-hook nil)) + (setq jsonrpc-event-hook nil) + ) ;; This function raises the window to the front using KDE KWin. (defun my/raise-window () @@ -44,28 +67,19 @@ (add-hook 'gdscript-mode-hook #'eglot-ensure) -;; This package provides syntax highlighting and some utilities for -;; working with rust code. -(use-package rust-mode - :ensure t - :defer t - :commands (rust-mode)) - -(add-hook 'rust-mode-hook #'eglot-ensure) - ;; This package provides integration with Prolog (SWI). (use-package sweeprolog :straight (sweeprolog :type git - :host nil - :repo "https://git.sr.ht/~eshel/sweep" - :branch "main" - :files ("*.el" "sweep.pl" "sweep.texi")) ; Custom recipe because - ; the normal one did not - ; build properly. + :host nil + :repo "https://git.sr.ht/~eshel/sweep" + :branch "main" + :files ("*.el" "sweep.pl" "sweep.texi")) ; Custom recipe because + ; the normal one did not + ; build properly. :ensure t :defer t :commands (sweeprolog-mode - sweeprolog-top-level) + sweeprolog-top-level) :init (setq sweeprolog-swipl-path "swipl")) @@ -139,4 +153,17 @@ (indent-bars-treesit-wrap '((rust arguments parameters))) :hook ((python-base-mode yaml-mode rust-mode) . indent-bars-mode)) +;; Ellama allows using LLMs from emacs. +(use-package ellama + :ensure nil + :defer t + :bind ("C-c e" . ellama) + :init (setopt ellama-auto-scroll t) + :commands (ellama) + :config + ;; show ellama context in header line in all buffers + (ellama-context-header-line-global-mode +1) + ;; show ellama session id in header line in all buffers + (ellama-session-header-line-global-mode +1)) + ;;; 15-lsp.el end here diff --git a/custom.el b/custom.el index e8a0fcb..223d90f 100644 --- a/custom.el +++ b/custom.el @@ -3,7 +3,7 @@ ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. - '(auth-source-save-behavior nil)) + ) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful.