Emacs Extensions for
GE Smallworld Magik Development

Screen-casts, tutorials, and productivity tools for Magik programmers who use Emacs. From tab-mode and code folding to the Magik Debugger and object inspector — explore features built by a developer, for developers.

Learn More
HydePark Consulting Screen-casts on YouTube RSS via FeedBurner

Nine screen-casts published between November 2010 and January 2011 — covering everything from ECB mode to the Tree Item GUI control. Read the story behind the project →

Get in Touch

Configuring Emacs LSP Mode for Magik Development

Magik is the proprietary object-oriented language that powers GE Smallworld, a geospatial platform relied upon by electric and gas utilities, water authorities, rail operators, and mining companies across Australia. From the New South Wales gas distributor head-quartered in Sydney to the Pilbara iron-ore networks managed out of Perth, Magik sits at the heart of asset registers that keep essential services running. Programmers who work with it tend to live inside Emacs, and they often ask the same question: how can the editor speak the Language Server Protocol to Magik so that completion, diagnostics, and navigation behave the way they do in modern polyglot setups?

There is no fully supported, vendor-blessed LSP server for Magik today, but a workable approximation is within reach. By pairing one of Emacs' LSP clients with the community tree-sitter grammar, a few helper packages, and a modest amount of custom Elisp, developers in Brisbane consultancies and Adelaide water boards can get hover help, go-to-definition, and inline diagnostics on their .magik buffers. The recipe below focuses on practical, repeatable steps rather than theoretical purity, and it acknowledges the local realities of Australian Smallworld shops.

The state of Magik language tooling

Magik was designed in the late 1980s as a prototype-friendly language for Smallworld, with first-class support for collections, geometry, and persistent objects stored in a binary database. It has never had a public, open grammar, and the official Smallworld IDE ships as a Windows-only Swing application. That history is why most Magik developers eventually migrate to Emacs: the editor runs identically on a developer's MacBook in a Melbourne co-working space, on a Linux workstation in a Darwin data centre, and on a Windows server used to access the Smallworld session manager.

The language's syntax is close enough to Smalltalk that several generic Emacs modes can highlight it adequately, but the deeper features that an LSP server normally exposes — symbol resolution across modules, type inference for chained method calls, jump-to-implementation for methods on sw5_workspace! — are not available out of the box. A community project, sometimes referred to as magik-lsp or smallworld-language-server, has been circulating among consultants for several years, but it remains a stub that does not implement enough of the specification to be useful for large code bases. Until that changes, the most realistic path is a hybrid setup that uses an LSP client where it helps and falls back to Emacs-native facilities where the server is silent.

Choosing between lsp-mode and eglot

Both lsp-mode and eglot are mature LSP clients, and either will accept a server written for Magik once one becomes available. The choice mostly comes down to how much you want to manage by hand. eglot was merged into Emacs itself at version 29, which means a developer running the latest binary on their corporate Windows image does not need to fetch a separate package. It is small, fast, and exposes a clean set of hooks for adding new servers, but it offers fewer batteries-included conveniences for non-LSP workflows.

lsp-mode is the more feature-rich option, with a built-in UI for server management, a richer set of UI side-windows, and tighter integration with treemacs and magit. Many Magik developers already use it for Python or TypeScript on the same machine, so the marginal cost of enabling it for .magik files is low. The downside is that lsp-mode makes more assumptions about how the workspace is structured, and it can be chatty in logs that are hard to filter for Australian privacy review. A common compromise is to keep lsp-mode installed and active, but only register the Magik-related projects through lsp-workspace-blacklist so the client does not start a broken server in the background.

In a typical init.el the configuration looks similar in either case. With eglot, you call (add-to-list 'eglot-server-programs '(magik-mode . ("magik-lsp" "--stdio"))) and let the editor handle the rest. With lsp-mode, the equivalent line goes through lsp-client-settings or a lsp-deferred call inside a use-package block. Both approaches leave room to swap in a future server without rewriting the rest of the configuration.

Building a hybrid stack with tree-sitter and company-mode

Because the official LSP server is missing, the bulk of the daily experience has to come from Emacs-native tooling. The tree-sitter-magik grammar, maintained by an Adelaide-based contributor, parses .magik files into a concrete syntax tree and powers tree-sitter-hl-mode for accurate highlighting. Install it through treesit-install-language-grammar and enable it on the magik-mode hook, and the editor will keep colours stable even when the LSP server is absent or crashes mid-edit.

For completion, company-mode is hard to beat. A small set of back-ends covers most situations: company-dabbrev-code for symbols seen in the same buffer, company-files for file paths in Magik resource strings, and a custom company-magik-methods that walks the Smallworld session's RWO list when an external Smallworld process is reachable. A local ELisp back-end can also read the _methods files generated by the Smallworld compiler to offer method names, parameters, and return types without round-tripping to a running Magik image. This last trick is particularly handy on long-haul flights between Perth and Sydney, where network access to the session manager is patchy at best.

Diagnostics come from flycheck rather than from the language server. A short checker that invokes magik_compile -warnings_only on the current buffer produces a JSON stream that flycheck can parse with minimal glue code. Results are good enough to catch unbalanced _block / _endblock pairs and missing _pragma declarations, which are the two most common classes of typo in real Smallworld code bases. Where the LSP spec would normally provide a richer report, the flycheck variant is a serviceable substitute.

Debugging, object inspection, and method navigation

Even without a working language server, Emacs can already do most of what Magik programmers need from a development environment. edebug instruments individual _method definitions and lets you step through execution with a real Smallworld session attached, which is how most bugs in production rule chains are tracked down. Place the cursor on a method call, hit C-u C-M-x with edebug-defun, and the running Magik image will halt at the entry point with the local bindings visible in the echo area.

Object inspection is another area where Emacs' built-in facilities shine. A custom command bound to C-c C-i can use magik-eval to send the current expression to a Smallworld REPL buffer and pretty-print the resulting sw5_object! with its slot names. For chains of method calls, a small wrapper around xref-find-definitions (M-.) walks the RWO class hierarchy and jumps straight to the source method, even when the implementation lives in a different module loaded at runtime. Reverse navigation with M-, is reliable, which makes refactoring sessions across the dozens of modules in a typical Australian water utility much less painful.

Method browsers and class hierarchies are exposed through the Smallworld Session Manager's own tools, but they can be driven from Emacs with a thin wrapper. A dedicated buffer called *magik-classes*, populated by an asynchronous call to sw5_class_hierarchy(), gives a tabulated-list-mode view that filters by name and jumps to the corresponding source with a single keystroke. None of this needs an LSP server, and the workflow remains stable across the mix of Windows, Linux, and macOS workstations that characterise the Australian Smallworld consulting market.

A workflow that fits Australian Smallworld shops

The reality of running Magik development in Australia is shaped by the industries that use Smallworld. Queensland's rail operators, Western Australia's mining giants, and the state-owned water utilities in Melbourne and Hobart all run hot, business-critical Smallworld environments where downtime is measured in regulatory headaches. Developers are often working across multiple time zones — coordinating with Smallworld support in the United Kingdom during AEST business hours, and joining late-night calls with consultants in Europe or the Americas when a major release is in flight. A snappy Emacs setup that starts the moment a .magik file is opened is therefore not a luxury; it is a productivity requirement.

Local legislation also matters. The Privacy Act 1988 and the Australian Privacy Principles govern how customer data held in Smallworld's RWO stores can be accessed, which means diagnostic tools must avoid logging personally identifiable information. A careful LSP configuration that pipes server stderr through lsp-log-io and redacts obvious identifiers is worth the effort, and the same care has to extend to any custom flycheck checker. Several Australian firms already audit their Emacs configurations against the same controls they apply to production monitoring, and a short note about redaction in the team's init.el is now considered good practice.

Finally, the rhythm of work in this country is different from the European Smallworld community. Hot summer afternoons in Adelaide or Perth push developers to work from air-conditioned home offices with the blinds drawn, while the early starts common in Brisbane's mining sector suit a configuration that loads quickly from use-package rather than pulling megabytes of package data on every launch. The setup described in this article is intentionally small: a few hundred lines of Elisp, no heavy external dependencies beyond a tree-sitter grammar, and a single optional language server that can be turned off without breaking the rest of the workflow. That balance is what makes it survive the long-term maintenance that any Australian Smallworld shop will demand.

Approach Completion Diagnostics Navigation Startup weight
lsp-mode + future Magik server Excellent when the server lands Rich, server-driven Standard LSP Medium
eglot + future Magik server Excellent when the server lands Rich, server-driven Standard LSP Light
tree-sitter + company-magik Good, from local RWO list Flycheck-based xref / M-. with custom wrapper Light
EAF + Magik bridge Decent for in-buffer tasks Limited Through Emacs xref Heavy
magik-mode alone Symbol dabbrev only None Manual Negligible

If your team needs hands-on help tailoring an Emacs configuration for a Magik code base, HydePark Consulting offers setup sessions, code reviews, and ongoing support across Australian time zones. Reach out through the contact page to book an introductory call and a configuration audit tailored to your Smallworld deployment.

Core Features

Tab Mode & ECB

Quick tab switching and Emacs Code Browsing mode for navigating Magik codebases efficiently.

Magik Smeller

Code analysis tool that helps identify potential issues in Magik source files.

Code Folding

Hide/Show mode for collapsing and expanding Magik code blocks to focus on what matters.

Visual Bookmarks

Quick visual bookmarks for jumping between key locations in your Smallworld session buffers.

Object Inspector

Inspect Magik objects and display them in an Emacs Deep Print buffer for detailed examination.

Magik Debugger

Set breakpoints and monitor slots and variables directly from within Emacs.

Development Tools

Direct links between Emacs and the Smallworld Development Tools application, including Click Monitor.

Screen-casts & Tutorials

Dark code editor window with syntax-highlighted Magik source code in muted blues and greys, conveying a focused development environment

Screen-cast 1: Tab Mode, ECB & More

Covers tab-mode, ECB, Magik Smeller, code folding, visual bookmarks, pragma toggling, moving code, external editor, and MS Explorer.

November 7, 2010
Split-pane Emacs interface with multiple buffers open, warm amber and navy tones against a dark background

Screen-cast 5: Object Inspection & Deep Print

Inspect a Magik object, prompt for an expression evaluated within a Smallworld session, and display results in a Deep Print buffer.

January 16, 2011
Debugging interface with breakpoint markers and variable watch panels in subdued teal and charcoal tones

Screen-cast 7: Magik Debugger

Useful tools for application developers: Object Inspector and Magik Debugger with breakpoints and slot/variable monitoring.

January 2011
Tree control GUI element with expandable branches rendered in clean greys and muted blues on a light background

Screen-cast 9: Tree Item GUI Control

Tree Item is a GUI control providing extensive facilities for displaying lists with rows, columns, trees, and in-place editing.

January 20, 2011