Skip to content

juxt/allium-mode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

allium-mode

Emacs major mode for the Allium specification language.

Compatibility: Allium Tools core 3.x

Installation

Using package-vc (Emacs 29+)

(unless (package-installed-p 'allium-mode)
  (package-vc-install '(allium-mode :url "https://github.com/juxt/allium-mode")))

(use-package allium-mode
  :mode "\\.allium\\'")

Using straight.el

(use-package allium-mode
  :straight (:host github :repo "juxt/allium-mode")
  :mode "\\.allium\\'")

Using Doom Emacs

In packages.el:

(package! allium-mode
  :recipe (:host github :repo "juxt/allium-mode"))

In config.el:

(use-package! allium-mode
  :mode "\\.allium\\'")

Manual installation

  1. Clone this repository.
  2. Add the directory to your load-path.
  3. Add (require 'allium-mode) to your configuration.

Features

  • Syntax highlighting (regex-based or tree-sitter).
  • Indentation support.
  • LSP integration via eglot or lsp-mode.
  • Tree-sitter support for Emacs 29+.

Usage

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-rename or M-x lsp-rename
  • Code actions: M-x eglot-code-actions or M-x lsp-execute-code-action
  • Format buffer: M-x eglot-format-buffer or M-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

Tree-sitter grammar (optional)

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 configuration

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

eglot

(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.

lsp-mode

(add-hook 'allium-mode-hook 'lsp-deferred)

Testing

Run the ERT suite:

./scripts/run-tests.sh

This runs Emacs in -Q --batch mode against deterministic unit tests for core major mode behaviour, eglot registration and lsp-mode client registration.

Licence

MIT

About

Emacs major mode for the Allium specification language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors