From 1d9121b6e716563b502252f621f81f0f95d5ea93 Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Sun, 9 Mar 2025 21:28:36 +0200 Subject: Add arkta-progmodes.el, add stuff from init.el --- arkta/arkta-progmodes.el | 250 +++++++++++++++++++++++++++++++++++++++++++++++ init.el | 247 +--------------------------------------------- 2 files changed, 251 insertions(+), 246 deletions(-) create mode 100644 arkta/arkta-progmodes.el diff --git a/arkta/arkta-progmodes.el b/arkta/arkta-progmodes.el new file mode 100644 index 0000000..06d736b --- /dev/null +++ b/arkta/arkta-progmodes.el @@ -0,0 +1,250 @@ +;; -*- lexical-binding: t -*- +;; Copyright © 2018-2025 Uko Koknevics + +(use-package c-ts-mode + :after treesit + :straight '(c-ts-mode :type built-in) + :mode ("\\.c\\'" + ("\\.cpp\\'" . c++-ts-mode)) + :init + (defun arkta/c-setup () + (set-tab-usage t) + (set-tab-width c-ts-mode-indent-offset)) + :hook (c-ts-base-mode . arkta/c-setup) + :custom + (c-ts-mode-indent-offset 8) + (c-ts-mode-indent-style (lambda () + `(((node-is ")") parent-bol 0) + ((node-is "}") parent-bol 0) + ((node-is "access_specifier") parent-bol 0) + ((parent-is "argument_list") parent-bol c-ts-mode-indent-offset) + ((parent-is "parameter_list") parent-bol c-ts-mode-indent-offset) + ((parent-is "field_declaration_list") parent-bol c-ts-mode-indent-offset) + ,@(alist-get 'linux (c-ts-mode--indent-styles 'c)))))) + +(use-package cmake-ts-mode + :after treesit + :straight '(cmake-ts-mode :type built-in) + :mode ("CMakeLists\\.txt\\'" + "\\.cmake\\'")) + +(use-package csharp-mode + :after treesit + :straight '(csharp-mode :type built-in) + :mode "\\.cs\\'") + +(use-package css-mode + :after treesit + :straight '(css-mode :type built-in) + :mode "\\.css\\'") + +(use-package dart-mode + :straight t + :mode "\\.dart\\'") + +(use-package dockerfile-ts-mode + :after treesit + :straight '(dockerfile-ts-mode :type built-in) + :mode "Dockerfile\\'") + +(use-package ebuild-mode + :straight t + :mode ("\\.ebuild\\'" + "\\.eclass\\'")) + +(use-package elisp-mode + :straight '(elisp-mode :type built-in) + :mode ("\\.el\\'" . emacs-lisp-mode) + :init + (use-package auto-compile + :straight t + :hook ((emacs-lisp-mode . auto-compile-on-load-mode) + (emacs-lisp-mode . auto-compile-on-save-mode)))) + +(use-package elixir-mode + :straight t + :mode "\\.exs?\\'" + :init + (defun arkta/elixir-setup () + (add-hook 'before-save-hook #'elixir-format nil t)) + :hook (elixir-mode . arkta/elixir-setup)) + +(use-package gdscript-mode + :straight t + :mode "\\.gd\\'") + +(use-package go-ts-mode + :after treesit + :straight '(go-ts-mode :type built-in) + :mode "\\.go\\'" + :init + (defun arkta/go-setup () + (add-hook 'before-save-hook #'gofmt-before-save nil t) + (set-tab-usage t) + (set-tab-width go-ts-mode-indent-offset)) + :hook (go-ts-mode . arkta/go-setup)) + +(use-package groovy-mode + :straight t + :mode ("Jenkinsfile\\'" + "\\.gradle\\'" + "\\.groovy\\'")) + +(use-package haskell-mode + :straight t + :mode "\\.hs\\'") + +(use-package java-ts-mode + :after treesit + :straight '(java-ts-mode :type built-in) + :mode "\\.java\\'") + +(use-package js + :after treesit + :straight '(js :type built-in) + :mode ("\\.js\\'" . js-ts-mode)) + +(use-package json-ts-mode + :after treesit + :straight '(json-ts-mode :type built-in) + :mode "\\.json\\'") + +(use-package lisp-mode + :straight '(lisp-mode :type built-in) + :mode "\\.lisp\\'" + :init + (use-package slime + :straight t + :after lisp-mode + :commands slime + :custom + (inferior-lisp-program (executable-find "sbcl")))) + +(use-package lua-mode + :straight t + :custom + (lua-indent-level 4) + :mode ("\\.lua\\'" "\\.rockspec\\'")) + +(use-package make-mode + :straight '(make-mode :type built-in) + :mode (("Makefile\\'" . makefile-gmake-mode) + "GNUmakefile\\'" + "\\.mk\\(\\.template\\)?\\'")) + +(use-package markdown-mode + :straight t + :mode ("\\.md\\'" . gfm-mode)) + +(use-package nasm-mode + :straight t + :mode ("\\.asm\\'" + "\\.inc\\'") + :init + (defun arkta/nasm-setup () + (set-tab-width 4)) + :hook (nasm-mode . arkta/nasm-setup)) + +(use-package nix-mode + :straight t + :mode "\\.nix\\'") + +(use-package nxml-mode + :straight '(nxml-mode :type built-in) + :mode ("\\.xml\\'" + "\\.plist\\'" + "\\.svg\\'")) + +(use-package org + :straight '(org :type built-in) + :bind (("C-c l" . org-store-link) + ("C-c a" . org-agenda)) + :mode ("\\.org\\'" . org-mode) + :init + (use-package htmlize + :straight t) + :custom + (org-agenda-files '("~/TODO.org")) + (org-log-done t)) + +(use-package php-mode + :straight t + :mode "\\.php\\'") + +(use-package pico8-mode + :straight '(pico8-mode :host github + :repo "Kaali/pico8-mode") + :mode "\\.p8\\'") + +(use-package prolog + :straight '(prolog :type built-in) + :mode ("\\.pl\\'" . prolog-mode)) + +(use-package python + :after treesit + :straight '(python :type built-in) + :mode ("\\.py\\'" . python-ts-mode)) + +(use-package ruby-ts-mode + :after treesit + :straight '(ruby-ts-mode :type built-in) + :mode "\\.rb\\'") + +(use-package rust-ts-mode + :after treesit + :straight '(rust-ts-mode :type built-in) + :mode "\\.rs\\'") + +(use-package scala-mode + :straight t + :mode "\\.scala\\'") + +(use-package scheme + :straight '(scheme :type built-in) + :commands scheme-mode + :mode ("\\.scm\\'" . scheme-mode) + :config + (put 'module 'scheme-indent-function 2)) + +(use-package smalltalk-mode + :straight t + :mode "\\.st\\'") + +(use-package svelte-mode + :straight t + :mode ("\\.svelte\\'" "\\.svx\\'")) + +(use-package sml-mode + :straight t + :mode "\\.sml\\'" + :init + (use-package company-mlton + :after company + :straight '(company-mlton :host github + :repo "MatthewFluet/company-mlton") + :hook (sml-mode . company-mlton-init))) + +(use-package toml-ts-mode + :after treesit + :straight '(toml-ts-mode :type built-in) + :mode "\\.toml\\'") + +(use-package typescript-ts-mode + :after treesit + :straight '(typescript-ts-mode :type built-in) + :mode "\\.ts\\'") + +(use-package typst-mode + :straight t + :mode "\\.typ\\'") + +(use-package yaml-ts-mode + :after treesit + :straight '(yaml-ts-mode :type built-in) + :mode "\\.ya?ml\\'") + +(use-package zig-mode + :straight t + :mode "\\.zig\\'") + +(provide 'arkta-progmodes) diff --git a/init.el b/init.el index 05184e0..662e5b9 100644 --- a/init.el +++ b/init.el @@ -199,6 +199,7 @@ ;; HIC SVNT DRACONES (require 'arkta-cosmetic) +(require 'arkta-progmodes) (require 'arkta-project) (use-package ace-window @@ -211,33 +212,6 @@ :config (amx-mode +1)) -(use-package c-ts-mode - :after treesit - :straight '(c-ts-mode :type built-in) - :mode ("\\.c\\'" - ("\\.cpp\\'" . c++-ts-mode)) - :init - (defun arkta/c-setup () - (set-tab-usage t) - (set-tab-width c-ts-mode-indent-offset)) - :hook (c-ts-base-mode . arkta/c-setup) - :custom - (c-ts-mode-indent-offset 8) - (c-ts-mode-indent-style (lambda () - `(((node-is ")") parent-bol 0) - ((node-is "}") parent-bol 0) - ((node-is "access_specifier") parent-bol 0) - ((parent-is "argument_list") parent-bol c-ts-mode-indent-offset) - ((parent-is "parameter_list") parent-bol c-ts-mode-indent-offset) - ((parent-is "field_declaration_list") parent-bol c-ts-mode-indent-offset) - ,@(alist-get 'linux (c-ts-mode--indent-styles 'c)))))) - -(use-package cmake-ts-mode - :after treesit - :straight '(cmake-ts-mode :type built-in) - :mode ("CMakeLists\\.txt\\'" - "\\.cmake\\'")) - (use-package company :straight t :custom @@ -273,20 +247,6 @@ :config (counsel-mode +1)) -(use-package csharp-mode - :after treesit - :straight '(csharp-mode :type built-in) - :mode "\\.cs\\'") - -(use-package css-mode - :after treesit - :straight '(css-mode :type built-in) - :mode "\\.css\\'") - -(use-package dart-mode - :straight t - :mode "\\.dart\\'") - (use-package dashboard :straight t :demand t @@ -302,16 +262,6 @@ :config (dashboard-setup-startup-hook)) -(use-package dockerfile-ts-mode - :after treesit - :straight '(dockerfile-ts-mode :type built-in) - :mode "Dockerfile\\'") - -(use-package ebuild-mode - :straight t - :mode ("\\.ebuild\\'" - "\\.eclass\\'")) - (use-package editorconfig :straight t :config @@ -326,23 +276,6 @@ :documentOnTypeFormattingProvider)) (eglot-autoshutdown t)) -(use-package elisp-mode - :straight '(elisp-mode :type built-in) - :mode ("\\.el\\'" . emacs-lisp-mode) - :init - (use-package auto-compile - :straight t - :hook ((emacs-lisp-mode . auto-compile-on-load-mode) - (emacs-lisp-mode . auto-compile-on-save-mode)))) - -(use-package elixir-mode - :straight t - :mode "\\.exs?\\'" - :init - (defun arkta/elixir-setup () - (add-hook 'before-save-hook #'elixir-format nil t)) - :hook (elixir-mode . arkta/elixir-setup)) - (use-package elpher :straight t :commands (elpher) @@ -362,31 +295,6 @@ :config (gcmh-mode +1)) -(use-package gdscript-mode - :straight t - :mode "\\.gd\\'") - -(use-package go-ts-mode - :after treesit - :straight '(go-ts-mode :type built-in) - :mode "\\.go\\'" - :init - (defun arkta/go-setup () - (add-hook 'before-save-hook #'gofmt-before-save nil t) - (set-tab-usage t) - (set-tab-width go-ts-mode-indent-offset)) - :hook (go-ts-mode . arkta/go-setup)) - -(use-package groovy-mode - :straight t - :mode ("Jenkinsfile\\'" - "\\.gradle\\'" - "\\.groovy\\'")) - -(use-package haskell-mode - :straight t - :mode "\\.hs\\'") - (use-package ibuffer :straight '(ibuffer :type built-in) :bind (("C-x C-b" . ibuffer) @@ -405,122 +313,10 @@ :config (ivy-mode +1)) -(use-package java-ts-mode - :after treesit - :straight '(java-ts-mode :type built-in) - :mode "\\.java\\'") - -(use-package js - :after treesit - :straight '(js :type built-in) - :mode ("\\.js\\'" . js-ts-mode)) - -(use-package json-ts-mode - :after treesit - :straight '(json-ts-mode :type built-in) - :mode "\\.json\\'") - -(use-package lisp-mode - :straight '(lisp-mode :type built-in) - :mode "\\.lisp\\'" - :init - (use-package slime - :straight t - :after lisp-mode - :commands slime - :custom - (inferior-lisp-program (executable-find "sbcl")))) - -(use-package lua-mode - :straight t - :custom - (lua-indent-level 4) - :mode ("\\.lua\\'" "\\.rockspec\\'")) - (use-package magit ;; TODO: Do some proper setup :straight t) -(use-package make-mode - :straight '(make-mode :type built-in) - :mode (("Makefile\\'" . makefile-gmake-mode) - "GNUmakefile\\'" - "\\.mk\\(\\.template\\)?\\'")) - -(use-package markdown-mode - :straight t - :mode ("\\.md\\'" . gfm-mode)) - -(use-package nasm-mode - :straight t - :mode ("\\.asm\\'" - "\\.inc\\'") - :init - (defun arkta/nasm-setup () - (set-tab-width 4)) - :hook (nasm-mode . arkta/nasm-setup)) - -(use-package nix-mode - :straight t - :mode "\\.nix\\'") - -(use-package nxml-mode - :straight '(nxml-mode :type built-in) - :mode ("\\.xml\\'" - "\\.plist\\'" - "\\.svg\\'")) - -(use-package org - :straight '(org :type built-in) - :bind (("C-c l" . org-store-link) - ("C-c a" . org-agenda)) - :mode ("\\.org\\'" . org-mode) - :init - (use-package htmlize - :straight t) - :custom - (org-agenda-files '("~/TODO.org")) - (org-log-done t)) - -(use-package php-mode - :straight t - :mode "\\.php\\'") - -(use-package pico8-mode - :straight '(pico8-mode :host github - :repo "Kaali/pico8-mode") - :mode "\\.p8\\'") - -(use-package prolog - :straight '(prolog :type built-in) - :mode ("\\.pl\\'" . prolog-mode)) - -(use-package python - :after treesit - :straight '(python :type built-in) - :mode ("\\.py\\'" . python-ts-mode)) - -(use-package ruby-ts-mode - :after treesit - :straight '(ruby-ts-mode :type built-in) - :mode "\\.rb\\'") - -(use-package rust-ts-mode - :after treesit - :straight '(rust-ts-mode :type built-in) - :mode "\\.rs\\'") - -(use-package scala-mode - :straight t - :mode "\\.scala\\'") - -(use-package scheme - :straight '(scheme :type built-in) - :commands scheme-mode - :mode ("\\.scm\\'" . scheme-mode) - :config - (put 'module 'scheme-indent-function 2)) - (use-package server :config (setq server-socket-dir (expand-file-name local-dir "server"))) @@ -532,24 +328,6 @@ :custom (backward-delete-char-untabify-method nil)) -(use-package smalltalk-mode - :straight t - :mode "\\.st\\'") - -(use-package sml-mode - :straight t - :mode "\\.sml\\'" - :init - (use-package company-mlton - :after company - :straight '(company-mlton :host github - :repo "MatthewFluet/company-mlton") - :hook (sml-mode . company-mlton-init))) - -(use-package svelte-mode - :straight t - :mode ("\\.svelte\\'" "\\.svx\\'")) - (use-package swiper :straight t :bind (([remap isearch-forward] . swiper-isearch) @@ -557,11 +335,6 @@ ("C-s" . swiper-isearch) ("C-r" . swiper-isearch-backward))) -(use-package toml-ts-mode - :after treesit - :straight '(toml-ts-mode :type built-in) - :mode "\\.toml\\'") - (use-package treemacs :straight t :commands (treemacs treemacs-select-window) @@ -599,21 +372,3 @@ (unless (treesit-language-available-p name) (treesit-install-language-grammar name)))) treesit-language-source-alist)) - -(use-package typescript-ts-mode - :after treesit - :straight '(typescript-ts-mode :type built-in) - :mode "\\.ts\\'") - -(use-package typst-mode - :straight t - :mode "\\.typ\\'") - -(use-package yaml-ts-mode - :after treesit - :straight '(yaml-ts-mode :type built-in) - :mode "\\.ya?ml\\'") - -(use-package zig-mode - :straight t - :mode "\\.zig\\'") -- cgit v1.2.3