Files
doomemacs/modules/lang/janet/config.el
Henrik Lissner d545fccf47 fix(:lang): missing grammar recipes
I removed the grammar recipes in 3b58741 to avoid redundancy with the
upstream recipes, but didn't realize that those upstream recipes weren't
added until Emacs 31, so users on 30 and older would get errors when
trying to install any missing grammars.

This also establishes a hard dependency between :lang (php +tree-sitter)
and :lang ({javascript,web} +tree-sitter).

Amend: 3b58741522
2025-08-31 14:39:38 +02:00

34 lines
1.2 KiB
EmacsLisp

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