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

Editing Magik on a Remote Server with TRAMP in Emacs

Many Magik developers based in Sydney, Melbourne, or Brisbane routinely edit Smallworld source code that lives on a central server rather than on their laptop. Connecting to that machine from inside Emacs is often handled by TRAMP, the transparent remote access layer that allows file editing, shell commands, and even debugger sessions to flow across an SSH tunnel. Because Smallworld GIS installations are commonly shared across utility teams in New South Wales, Queensland, and Victoria, working through TRAMP keeps everyone reading the same canonical version of the source tree.

TRAMP treats remote files almost like local ones, which fits Magik development particularly well. You can open a .magik file sitting on a remote Solaris or Linux host, run your usual font-locking and indentation, jump to method definitions, and feed arguments into a Magik REPL running on the same box — all without leaving the Emacs frame on your screen. The experience feels local even though the bytes are travelling across the National Broadband Network or a corporate WAN.

Understanding TRAMP for Remote Magik Work

TRAMP is the long-standing Emacs package, originally written by Kai Großjohann and now maintained by Michael Albinus, that lets you edit files on remote machines using a variety of transport protocols. For Magik programmers the only one that matters in practice is SSH, because GE Smallworld deployments and the supporting application servers are typically Linux or Solaris boxes locked behind a corporate VPN.

A TRAMP path looks almost like an ordinary file path: opening /ssh:developer@gis-server.qut.example.com:/opt/smallworld/magik/application/foo.magik drops you into a buffer that reads and writes through an authenticated shell session. Behind the scenes Emacs uses /bin/sh -c to invoke either the old rsh-style rcp plumbing or the modern plink-based default, depending on your installed version.

The key advantage for Magik developers is that the editing experience, including syntax highlighting, imenu-based method navigation, and abbrev expansion, runs locally in Emacs while the file content and the Magik interpreter stay remote. Even heavyweight operations like string search across a 200-megabyte application folder complete in a reasonable amount of time because Emacs streams the file rather than copying it first.

Establishing Secure Connections from Australian Workstations

Before TRAMP can do anything useful, you need a working SSH relationship between the workstation and the Smallworld host. Most consultants in Australia use OpenSSH from a Linux laptop, macOS Terminal, or Windows using the built-in OpenSSH client that shipped with Windows 10 — which removes a common source of compatibility pain with TRAMP.

Generating an ed25519 keypair is the modern preference, and copying the public key to the remote server's ~/.ssh/authorized_keys file means TRAMP will log in without prompting for a password every time you open a buffer. For teams spread between Adelaide and Perth, putting the public key into a shared deployment script lets a new starter be productive from day one.

Telstra and Optus corporate firewalls often intercept high-port traffic, so it is worth keeping the SSH daemon on port 22 or a documented alternative port supplied by the customer's infrastructure team. Where a bastion host sits between the developer machine and the Smallworld production server, TRAMP can chain through it with the multi-hop syntax /ssh:user@bastion.example.com|ssh:user@gis-server:/path.

Australian privacy and data-residency expectations also matter: customer data for utilities that run Smallworld must remain inside the country, so files should not be cached on overseas endpoints. TRAMP supports the local tilde directory and respects tramp-directory-cache policies that prevent Emacs from leaking credentials to remote hosts beyond the ones you actually trust.

Configuring Emacs for Magik Over TRAMP

Magik-mode already understands the .magik extension and applies font-locking keywords for the language. Once that mode is installed and available on your local Emacs, TRAMP automatically activates it for any remote buffer whose filename ends in .magik — there is no separate remote mode to load.

A useful snippet in your init.el keeps TRAMP happy on Australian connections:

(setq tramp-default-method "ssh")
(setq tramp-ssh-controlmaster-options
      "-o ControlMaster=auto -o ControlPersist=15m")
(setq vc-handled-backends '(Git))

The ControlMaster setting multiplexes multiple TRAMP sessions over a single TCP connection, which removes several seconds of handshake overhead every time you open a new buffer. This matters in offices where the link to the data centre traverses metro Ethernet across Melbourne's Hoddle Grid or Sydney's M2 corridor.

For Smallworld deployments that still depend on the legacy rcp method because the server runs an ancient AIX release, you can force the transport explicitly with the /scp: or /rsync: prefix. Most modern sites have moved off AIX, but HydePark Consulting has kept rcp configurations documented for utility clients in regional Queensland.

Navigating Smallworld Source Code Remotely

Method navigation in Magik relies heavily on imenu and the sw-jump-to-method helpers. When TRAMP ferries the buffer across, imenu asks the remote file for its outline by parsing the content through a process filter; the latency is usually negligible, but you may notice a brief pause on a slow link from a regional office in Townsville or Cairns.

A practical workflow is to keep a project file that lists the canonical remote path of the application: running M-x magik-open-project on that file opens every .magik buffer with TRAMP under the hood. The Magik REPL, started with M-x run-magik or via the sw-repl launcher, runs on the remote server but is presented as a comint buffer locally — every command you type goes across the wire and every printed result comes back.

Collection browsing, a frequent task when analysing Smallworld GIS geometries, uses the same remote REPL. Sending (geo_set.all_instances) returns a printable summary that scrolls inside the local comint buffer, and you can copy-paste a vector object back into a temporary scratch buffer for inspection without ever copying the source file onto your laptop.

Debugging and Inspecting Objects Through Remote Sessions

Debugging Magik through TRAMP works because the Smallworld debugger is a process that lives on the server and merely exposes a text or socket interface. Magik-mode ties Emacs to that interface through sw-debug.el, and TRAMP is invisible to the protocol — you set breakpoints, step, and inspect frames exactly as you would if the REPL were local.

Object inspection through the .magik-inspector command opens an extra window on the local screen that streams slot values from the remote process. For very large Smallworld object graphs, such as a sw_gis!geometry loaded with hundreds of vertices, you can throttle the inspector with a depth limit so that the round-trip cost stays predictable on a contended link.

Where remote debugging slows you down — say, because a customer's data centre in Sydney is congested with end-of-month batch jobs — toggling tramp-inline-compression-start to enable zlib compression over SSH trims substantial bytes off every Magik print_self payload. The trade-off is slightly higher CPU on both ends, which on modern server hardware is rarely a concern.

Tuning for Latency and Bandwidth Constraints

Australia's geography imposes real round-trip latency on developer traffic. A ping between Brisbane and Singapore already crosses 80 ms; between Perth and the east coast it nudges 50 ms; to a server hosted in Sydney CBD from a workstation in Ballarat the typical value sits around 35 ms. TRAMP feels snappiest when this number is kept low, so choosing a data centre or a cloud region inside the same city as the developer is worth investigating.

NBN services used by remote staff vary wildly in upload speed. A standard FTTC link delivers around 30 Mbps upstream, plenty for a TRAMP connection, but the satellite and fixed-wireless tiers common in the Northern Territory can drop to 5 Mbps with noticeable jitter. Setting tramp-chunksize to a smaller value forces Emacs to fetch smaller blocks, which feels more responsive on flaky uplinks.

If your utility customer runs the Smallworld application server on premises, ask whether the corporate Wi-Fi in the office separates guest and contractor VLANs. Joining the developer VLAN directly often beats fighting with a remote VPN tunnel that has been configured for office workers in Sydney rather than travelling consultants in Wagga Wagga.

Combining TRAMP With Magik-mode Productivity Tools

The Magik extensions published on Magik Emacs already assume a TRAMP-friendly workflow. Code folding is implemented as overlays that operate on the local buffer representation, so you can collapse a multi-hundred-line method definition on a remote Smallworld file without round-tripping anything during the fold.

Method navigation, abbrev expansion, and the smallworld-tag-table plugin all evaluate against imenu indices that TRAMP and Emacs build lazily on demand. HydePark Consulting has tuned these caches to refresh when you switch git branches, so jumping between release lines of a long-running GIS project remains quick across the network boundary.

For day-to-day editing, resist the temptation to sync the entire source tree down with git clone just to avoid TRAMP. The remote workflow guarantees you always edit the right file, and the post-commit hook in your local git repo can push changes straight to a remote worktree. If you would rather work offline, save the project as a directory and use TRAMP only when reaching back to the server — the two styles coexist cleanly inside one Emacs session.

Ready to streamline your Magik editing on remote servers? Reach out to HydePark Consulting via the contact page on Magik Emacs to discuss tailored Emacs setups, TRAMP tuning for your network, or hands-on support for Smallworld utility projects across Australia.

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