diff --git a/modules/lang/janet/README.org b/modules/lang/janet/README.org new file mode 100644 index 000000000..44cfe98f5 --- /dev/null +++ b/modules/lang/janet/README.org @@ -0,0 +1,55 @@ +#+title: :lang janet +#+subtitle: Fun fact: Janet is me! +#+created: May 08, 2025 +#+since: 25.06.0 + +* Description :unfold: +This module adds rudimentary support for the [[https://janet-lang.org/][Janet programming language]]. + +** Maintainers +- [[doom-user:][@hlissner]] + +[[doom-contrib-maintainer:][Become a maintainer?]] + +** Module flags +/This module has no flags./ + +** Packages +- [[doom-package:janet-mode]] + +** Hacks +#+begin_quote +󱌣 This module's hacks haven't been documented yet. [[doom-contrib-module:][Document them?]] +#+end_quote + +** TODO Changelog +# This section will be machine generated. Don't edit it by hand. +/This module does not have a changelog yet./ + +* Installation +[[id:01cffea4-3329-45e2-a892-95a384ab2338][Enable this module in your ~doom!~ block.]] + +#+begin_quote +󱌣 /No installation steps have been documented./ [[doom-contrib-module:][Document them?]] +#+end_quote + +* Usage +#+begin_quote +󱌣 This module has no usage documentation yet. [[doom-contrib-module:][Write some?]] +#+end_quote + +* TODO Configuration +#+begin_quote +󱌣 This module has no configuration documentation yet. [[doom-contrib-module:][Write some?]] +#+end_quote + +* Troubleshooting +/There are no known problems with this module./ [[doom-report:][Report one?]] + +* Frequently asked questions +/This module has no FAQs yet./ [[doom-suggest-faq:][Ask one?]] + +* TODO Appendix +#+begin_quote +󱌣 This module has no appendix yet. [[doom-contrib-module:][Write one?]] +#+end_quote diff --git a/modules/lang/janet/config.el b/modules/lang/janet/config.el new file mode 100644 index 000000000..cf26fbd66 --- /dev/null +++ b/modules/lang/janet/config.el @@ -0,0 +1,39 @@ +;;; lang/janet/config.el -*- lexical-binding: t; -*- + +(use-package! janet-mode + ;; HACK: Needed to override autoloaded `auto-mode-alist' and + ;; `interpreter-mode-alist' entries from this or `janet-ts-mode', so we can + ;; rely on `major-mode-remap-defaults' instead. + :mode "\\.\\(jdn\\|janet\\)\\'" + :interpreter "janet[0-9]*\\'" + :config + (after! dtrt-indent + (add-to-list 'dtrt-indent-hook-mapping-list '(janet-mode janet janet-indent))) + + ;; HACK: janet-mode calls `janet--set-indentation' each time it's activated, + ;; making its (global) side-effects unnecessarily difficult to change, so I + ;; disable it and call it manually (and once). + ;; REVIEW: PR this upstream? + (defadvice! +janet--inhibit-indent-init-a (fn &rest args) + :around #'janet-mode + (letf! ((#'janet--set-indentation #'ignore)) + (apply fn args))) + + (janet--set-indentation) + (dolist (sym '(with label catseq eachp eachk)) + (put sym 'janet-indent-function 'defun))) + + +;; (use-package! janet-ts-mode +;; :when (modulep! +tree-sitter) +;; :defer t +;; :init +;; (set-tree-sitter! 'janet-mode 'janet-ts-mode +;; `(janet-simple :url "https://github.com/sogaiu/tree-sitter-janet-simple" +;; :cc ,(if (featurep :system 'windows) "gcc.exe"))) +;; :config +;; ;; HACK: These autoloads are inserted twice by this package, so remove them so +;; ;; this module can be the single source of truth. +;; (cl-callf2 delete '("\\.janet\\'" . janet-ts-mode) auto-mode-alist) +;; (cl-callf2 delete '("\\.jdn\\'" . janet-ts-mode) auto-mode-alist) +;; (cl-callf2 delete '("janet" . janet-ts-mode) interpreter-mode-alist)) diff --git a/modules/lang/janet/packages.el b/modules/lang/janet/packages.el new file mode 100644 index 000000000..ba107e355 --- /dev/null +++ b/modules/lang/janet/packages.el @@ -0,0 +1,11 @@ +;; -*- no-byte-compile: t; -*- +;;; lang/janet/packages.el + +(package! janet-mode + :recipe (:files ("*.el")) + :pin "9e3254a0249d720d5fa5603f1f8c3ed0612695af") + +;; (when (modulep! +tree-sitter) +;; (package! janet-ts-mode +;; :recipe (:host github :repo "sogaiu/janet-ts-mode") +;; :pin "ac684edf57e4d4e085cf99d5ad2ee084b46b8123")) diff --git a/static/init.example.el b/static/init.example.el index 8e60d5892..bd1a08975 100644 --- a/static/init.example.el +++ b/static/init.example.el @@ -141,6 +141,7 @@ ;;hy ; readability of scheme w/ speed of python ;;idris ; a language you can depend on ;;json ; At least it ain't XML + ;;janet ; Fun fact: Janet is me! ;;(java +lsp) ; the poster child for carpal tunnel syndrome ;;javascript ; all(hope(abandon(ye(who(enter(here)))))) ;;julia ; a better, faster MATLAB