Skip to content

Norgate-AV/emacs-netlinx-mode

Repository files navigation

emacs-netlinx-mode

A NetLinx major mode for Emacs using Tree-Sitter.

Features

  • Syntax highlighting via tree-sitter
  • Automatic grammar installation
  • Built on Emacs 29+ native tree-sitter support

Requirements

  • Emacs 29.1 or later with tree-sitter support
  • C compiler (gcc/clang) for building the grammar
  • Git (for downloading the grammar)

Installation

From MELPA (Coming Soon)

(use-package netlinx-mode
  :ensure t
  :mode ("\\.axs\\'" "\\.axi\\'"))

Manual Installation

  1. Clone this repository:
git clone https://github.com/Norgate-AV/emacs-netlinx-mode.git
  1. Add to your Emacs configuration:
(add-to-list 'load-path "/path/to/emacs-netlinx-mode")
(require 'netlinx-mode)

Usage

The mode will automatically activate for .axs and .axi files. When you first open a NetLinx file, the tree-sitter grammar will be automatically downloaded and compiled.

If automatic installation fails, you can manually install the grammar:

M-x netlinx-mode--install-grammar

Configuration

You can customize the grammar repository location:

(setq netlinx-mode-grammar-location "https://github.com/Norgate-AV/tree-sitter-netlinx")

Development

This mode uses the built-in treesit.el library (Emacs 29+) and the tree-sitter-netlinx grammar.

Testing Locally

  1. Load the mode in Emacs:
(load-file "/path/to/netlinx-mode.el")
  1. Open a NetLinx file to test syntax highlighting

  2. Use M-x treesit-explore-mode to inspect the parse tree

LICENSE

MIT