40 lines
1.4 KiB
EmacsLisp
40 lines
1.4 KiB
EmacsLisp
;;; development/misc.el -*- lexical-binding: t; -*-
|
|
|
|
(use-package! bnf-mode
|
|
:mode "\\.bnf\\'"
|
|
:config
|
|
;; Optional: Add any custom configuration here
|
|
(setq bnf-mode-hook
|
|
(lambda ()
|
|
;; Enable line numbers
|
|
(display-line-numbers-mode)
|
|
;; Enable auto-pairing of angle brackets
|
|
(modify-syntax-entry ?< "(>" bnf-mode-syntax-table)
|
|
(modify-syntax-entry ?> ")<" bnf-mode-syntax-table))))
|
|
|
|
(use-package! ebnf-mode
|
|
:mode "\\.ebnf\\'"
|
|
:config
|
|
;; Optional customizations:
|
|
(setq ebnf-mode-indent-offset 4) ; Default is 8 spaces
|
|
(setq ebnf-mode-indent-by-production t) ; Align with the '=' in productions
|
|
(setq ebnf-mode-comment-char ?\;) ; Use ; for comments
|
|
(setq ebnf-mode-eop-char ?\.)) ; Use . for end of production
|
|
|
|
;; Devicetree mode (ZMK keymap, .dts, .dtsi)
|
|
(use-package! dts-mode
|
|
:mode ("\\.keymap\\'" "\\.dts\\'" "\\.dtsi\\'"))
|
|
|
|
;; Justfile mode (psibi/justl.el)
|
|
(use-package! justl
|
|
:config
|
|
(map! :n "e" 'justl-exec-recipe))
|
|
|
|
;; align-repeat: repeatedly align region by a given regexp/character
|
|
;; From EmacsWiki: https://www.emacswiki.org/emacs/AlignCommands
|
|
(defun align-repeat (start end regexp)
|
|
"Repeat alignment with respect to the given regular expression."
|
|
(interactive "r\nsAlign regexp: ")
|
|
(align-regexp start end
|
|
(concat "\\(\\s-*\\)" regexp) 1 1 t))
|