From c8a23c89ff66dc1fbfb6468266d70f76449f4183 Mon Sep 17 00:00:00 2001 From: jao Date: Wed, 29 Oct 2025 01:29:28 +0000 Subject: programming: basic rust (wip) --- custom/jao-custom-programming.el | 120 +++++++++++++++++++++++++-------------- 1 file changed, 77 insertions(+), 43 deletions(-) (limited to 'custom') diff --git a/custom/jao-custom-programming.el b/custom/jao-custom-programming.el index 61e51ea..ed62b32 100644 --- a/custom/jao-custom-programming.el +++ b/custom/jao-custom-programming.el @@ -1,6 +1,6 @@ ;; -*- lexical-binding: t -*- -;;; Programming +;;; Tools ;;;; automatic modes (add-to-list 'auto-mode-alist '("\\.mix\\'" . hexl-mode)) (add-to-list 'auto-mode-alist '("\\.m4\\'" . m4-mode)) @@ -33,6 +33,8 @@ ;;;; eglot (use-package eglot + :config + (add-hook 'eglot--managed-mode-hook (lambda () (flymake-mode -1))) :bind (:map eglot-mode-map (("C-h ." . jao-eldoc-toggle)))) ;;;; paredit and parens @@ -58,45 +60,6 @@ (setq ediff-window-setup-function 'ediff-setup-windows-plain) (setq ediff-keep-variants nil) -;;;; compilation -;;;;; compilation mode options -(require 'compile) -(setq compilation-scroll-output t) -(setq compilation-error-regexp-alist - (remove 'omake compilation-error-regexp-alist)) -;; (add-hook 'compilation-mode-hook #'visual-line-mode) - -;;;;; mode line (no "Compiling"!) -(require 'compile) -(diminish 'compilation-minor-mode " ‡") -(when (< emacs-major-version 27) - (setcdr (assq 'compilation-in-progress minor-mode-alist) '(" ‡"))) -(when (> emacs-major-version 26) - (setcdr (assq 'compilation-in-progress mode-line-modes) '("‡ "))) - -;;;;; colorizing compilation buffer -(setq compilation-message-face 'default) -(require 'ansi-color) -(defun endless/colorize-compilation () - "Colorize from `compilation-filter-start' to `point'." - (let ((inhibit-read-only t)) - (ansi-color-apply-on-region - compilation-filter-start (point)))) - -(add-hook 'compilation-filter-hook #'endless/colorize-compilation) - -;;;;; compilation commands -(use-package jao-compilation - :commands jao-compilation-setup - :bind (("C-c C" . compile) - ("C-c c" . jao-compile))) -(jao-compilation-setup) - -;;;;; next error -(setq next-error-find-buffer-function - #'next-error-buffer-on-selected-frame - next-error-verbose t) - ;;;; flymake (use-package flymake :ensure t @@ -114,9 +77,6 @@ :bind (:map flymake-mode-map (("M-m" . jao-transient-flymake)))) -;;;; workarounds -(setq c-type-finder-time-slot nil) - ;;;; outline minor mode (use-package outline :init (setq outline-minor-mode-use-buttons nil @@ -161,6 +121,61 @@ (add-hook 'find-function-after-hook #'jao-outline-minor-expand-all) + + +;;; Build tools +;;;; compilation +;;;;; compilation mode options +(require 'compile) +(setq compilation-scroll-output t) +(setq compilation-error-regexp-alist + (remove 'omake compilation-error-regexp-alist)) +;; (add-hook 'compilation-mode-hook #'visual-line-mode) + +;;;;; mode line (no "Compiling"!) +(require 'compile) +(diminish 'compilation-minor-mode " ‡") +(when (< emacs-major-version 27) + (setcdr (assq 'compilation-in-progress minor-mode-alist) '(" ‡"))) +(when (> emacs-major-version 26) + (setcdr (assq 'compilation-in-progress mode-line-modes) '("‡ "))) + +;;;;; colorizing compilation buffer +(setq compilation-message-face 'default) +(require 'ansi-color) +(defun endless/colorize-compilation () + "Colorize from `compilation-filter-start' to `point'." + (let ((inhibit-read-only t)) + (ansi-color-apply-on-region + compilation-filter-start (point)))) + +(add-hook 'compilation-filter-hook #'endless/colorize-compilation) + +;;;;; compilation commands +(use-package jao-compilation + :commands jao-compilation-setup + :bind (("C-c C" . compile) + ("C-c c" . jao-compile))) +(jao-compilation-setup) + +;;;;; next error +(setq next-error-find-buffer-function + #'next-error-buffer-on-selected-frame + next-error-verbose t) + + +;;;; cmake +(use-package cmake-mode :ensure t) + +(use-package eldoc-cmake + :ensure t + :after cmake-mode + :hook ((cmake-mode . eldoc-cmake-enable))) + +(use-package project-cmake :ensure t) + + + ;;; Programming languages ;;;; Elisp (add-hook 'emacs-lisp-mode-hook #'jao-outline-minor-mode) @@ -236,6 +251,25 @@ ("M-," . pop-tag-mark) ("C-c <" . lc-show-package-summary)))) +;;;; Rust + +(use-package rust-mode + :ensure t + :init + (setq rust-mode-treesitter-derive t)) + +(use-package rustic + :ensure t + :after (rust-mode) + :config + (setq rustic-format-on-save nil + rustic-lsp-client 'eglot) + :custom + (rustic-cargo-use-last-stored-arguments t) + (rustic-analyzer-command '("rustup" "run" "stable" "rust-analyzer"))) + + + ;;;; Clojure (use-package clojure-mode :ensure t -- cgit v1.2.3