module: add :lang janet

This commit is contained in:
Henrik Lissner
2025-05-08 01:24:14 -04:00
parent 61198800aa
commit 5477ba4c16
4 changed files with 106 additions and 0 deletions

View File

@ -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

View File

@ -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))

View File

@ -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"))

View File

@ -141,6 +141,7 @@
;;hy ; readability of scheme w/ speed of python ;;hy ; readability of scheme w/ speed of python
;;idris ; a language you can depend on ;;idris ; a language you can depend on
;;json ; At least it ain't XML ;;json ; At least it ain't XML
;;janet ; Fun fact: Janet is me!
;;(java +lsp) ; the poster child for carpal tunnel syndrome ;;(java +lsp) ; the poster child for carpal tunnel syndrome
;;javascript ; all(hope(abandon(ye(who(enter(here)))))) ;;javascript ; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB ;;julia ; a better, faster MATLAB