Emacs major mode for the Allium specification language.
Compatibility: Allium Tools core 3.x
(unless (package-installed-p 'allium-mode)
(package-vc-install '(allium-mode :url "https://github.com/juxt/allium-mode")))
(use-package allium-mode
:mode "\\.allium\\'")(use-package allium-mode
:straight (:host github :repo "juxt/allium-mode")
:mode "\\.allium\\'")In packages.el:
(package! allium-mode
:recipe (:host github :repo "juxt/allium-mode"))In config.el:
(use-package! allium-mode
:mode "\\.allium\\'")- Clone this repository.
- Add the directory to your
load-path. - Add
(require 'allium-mode)to your configuration.
- Syntax highlighting (regex-based or tree-sitter).
- Indentation support.
- LSP integration via
eglotorlsp-mode. - Tree-sitter support for Emacs 29+.
allium-mode uses standard Emacs LSP/Xref commands rather than adding custom commands.
After opening an .allium file and connecting LSP (eglot-ensure or
lsp-deferred), you can use:
- Hover:
M-x eldoc(or automatic ElDoc display) - Go to definition:
M-.(xref-find-definitions) - Find references:
M-?(xref-find-references) - Rename symbol:
M-x eglot-renameorM-x lsp-rename - Code actions:
M-x eglot-code-actionsorM-x lsp-execute-code-action - Format buffer:
M-x eglot-format-bufferorM-x lsp-format-buffer - Outline navigation:
M-x imenu(richer structure when tree-sitter is available)
Built-in mode commands and variables:
- Indentation width: customise
allium-indent-offset - LSP server command: customise
allium-lsp-server-command
On Emacs 29+, allium-mode automatically uses tree-sitter when the Allium grammar is installed, giving you more accurate highlighting and richer imenu navigation. Without the grammar, the mode falls back to regex-based highlighting.
To compile and install the grammar:
M-x treesit-install-language-grammar RET allium RET
When prompted for the repository URL, enter:
https://github.com/juxt/tree-sitter-allium
Accept the defaults for the remaining prompts. This compiles the grammar and installs the shared library into your tree-sitter directory. You need a C compiler available on your system (cc).
To suppress the startup reminder if you prefer regex highlighting, add to your config:
(setq allium-treesit-reminder nil)LSP features require the allium-lsp server on your PATH. Download a
pre-built binary from allium-tools releases,
or build from source (see docs/editors/emacs.md in the allium-tools repo).
(add-hook 'allium-mode-hook 'allium-eglot-ensure)allium-eglot-ensure checks that the server is installed before connecting. If allium-lsp is not on your PATH, it shows install instructions instead of a generic eglot error.
(add-hook 'allium-mode-hook 'lsp-deferred)Run the ERT suite:
./scripts/run-tests.shThis runs Emacs in -Q --batch mode against deterministic unit tests for core major mode behaviour, eglot registration and lsp-mode client registration.