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

Using Emacs Bookmarks to Jump Back to Magik Debug Points

In the world of GIS development with GE Smallworld, debugging Magik sessions often means navigating a sprawling codebase where one method call can cascade through collection iterators, database transactions, and remote procedure calls. Australian utilities such as Ergon in Townsville or CitiPower in Melbourne rely on these stacks daily, so any time saved returning to a known location compounds quickly across a sprint. Emacs bookmarks offer a lightweight, native way to mark those locations without leaving the keyboard.

Unlike registers, which are transient by design, bookmarks persist with your session and survive buffer reopens. For developers juggling multiple debug points across a Magik product stack, that persistence is the difference between a focused investigation and a slow scramble through buffer history. The mechanism is older than many of the IDE features competing for attention, but its simplicity is exactly why it scales.

The trick is treating them as a curated map rather than a dumping ground. A handful of well-named bookmarks can act as breadcrumb trails through the deepest call hierarchies, and with a little care they remain readable weeks later when a regression resurfaces. The rest of this guide walks through how to build that habit inside a Magik debug workflow.

Setting Bookmarks from a Magik Debugger Buffer

When the debugger halts execution, the active buffer usually shows the Magik frame with the surrounding source. The native bookmark-set command, bound to C-x r m, can be invoked directly from that frame without leaving the context. Pressing the keys prompts for a name in the minibuffer, and the current file and line are captured instantly.

The default prompt for a name can interrupt the flow of a debugging session. Remapping the keys to call bookmark-set-no-overwrite removes the confirmation noise, which matters when stepping through half a dozen frames in a row. It is a small ergonomic gain that pays off during long investigations on Magik objects whose state is rarely obvious from the variable inspector alone.

For developers who split time between Brisbane and Perth offices, or who hand a debugging session to a colleague across the harbour in North Sydney, the bookmark name itself acts as a handover token. A descriptive label such as db-tx-rollback or pipe-send-fail tells the next reader exactly which frame to return to without rereading the buffer list.

Naming Strategies That Survive a Long Debugging Week

The hardest part of bookmarks is not setting them but choosing names that still make sense on Thursday afternoon after a long Monday. Short labels work while the context is fresh in your head, but they evaporate quickly. The Magik community in Australia tends to favour prefix-based schemes, grouping bookmarks by module: gis:raster-reproject, swaf:auth-fail, or db:deadlock-detect.

Avoiding punctuation in bookmark names prevents surprises when later passing them to bookmark-jump from a M-x prompt or from an ivy completion buffer. Stick to alphanumerics, dashes, and colons, and the names will round-trip cleanly through any wrapper you build. The discipline feels pedantic on day one but saves frustration during a midnight callout from a client in Adelaide whose Magik session has stalled on a session lock.

Embedding the issue identifier helps when one exists. A bug raised in a tracker as GIS-4421 might end up as a bookmark called gis:4421-session-leak, which can be searched later from any buffer. That cross-reference is gold during a post-mortem, particularly when the same fault resurfaces six months later after a product upgrade.

Jumping Back Without Losing the Investigation

The simplest return path is bookmark-jump, bound to C-x r b. It opens the file if it has been closed and positions the point precisely where the bookmark lives. For Magik code spread across many modules, this is often faster than M-. to find a definition, especially when the original location is several frames up the call stack.

When several debug points are open at once, naming them alphabetically by subsystem is not enough on its own. Pairing bookmark-jump with bookmark-bmenu-list produces a dedicated buffer listing every active bookmark, and a single keystroke moves the cursor there. Local consultancies such as HydePark Consulting often wire this buffer into their Magik training material because the muscle memory transfers cleanly to new starters in Sydney and Melbourne.

A useful habit is leaving a one-line annotation above each bookmarked line, such as a comment like # DEBUG: state after pipe timeout. Returning to the bookmark later, you are greeted by the explanation rather than a blank screen. The combination of bookmark and inline note often replaces a formal investigation log for short-lived issues.

Comparing Built-in Bookmarks and Custom Debug Workflows

The table below compares a few common ways of marking and returning to a Magik debug point. Each row reflects a workflow tested in real Smallworld environments, from a single developer in Hobart to a distributed team spanning Darwin and Canberra.

Approach Persistence Setup effort Best for
Native Emacs bookmarks Across sessions None Quick reuse within a single bug
bookmark-bmenu-list buffer Across sessions One keybinding Reviewing multiple debug points at a glance
Registers via C-x r Until session ends None Temporary navigation inside one buffer
gdb-bookmark style wrappers Across sessions Some Elisp Frame-aware debugging in compiled languages
pointback extension Across sessions Package install Recovering point after long context switches
Custom Magik error hooks Across sessions Maintenance Auto-marking every raised Magik exception

Native bookmarks win on simplicity. Wrappers and extensions win when a team needs richer metadata, such as the timestamp of the last visit or the value of a particular variable at the moment of the bookmark. For most Australian Magik shops working on utility network assets, the native feature is more than enough to start.

Keeping Bookmarks Alive Across Emacs Restarts

By default, bookmarks live in ~/.emacs.d/bookmarks and load automatically the next time Emacs starts. That file is plain text and reasonably diff-friendly, which means a team can commit it to a shared Git repository if they want a common starting set. Some teams restrict this to a small handful of canonical bookmarks to avoid noisy merge conflicts on every commit.

For Magik developers running Emacs over SSH from a remote jump host in a data centre, persistence is even more important. Losing bookmarks on a dropped connection can wipe out hours of careful marking, so configuring bookmark-save-flag to a non-nil value forces a save after every change. It is a small cost in disk activity for a substantial gain in reliability.

Those working under the Australian Cyber Security Centre's Essential Eight framework may need to weigh whether the bookmark file leaks sensitive internal paths or method names into source control. Stripping project-relative prefixes before saving is one workaround; another is keeping the file inside an encrypted home directory. Either approach keeps bookmarks available without exposing them in a wider repository.

Pairing Bookmarks with Magik-Specific Tools

Bookmarks become noticeably more powerful when used alongside Magik's own object browser and stack inspector. After stepping through a frame, marking the source line and the inspected object buffer gives two return paths: one to the code that produced the state, one to the data being scrutinised. Together they form a small investigation kit that can be reopened in seconds.

magik-debug users will recognise the pattern of stashing transient frames during a long trace. A bookmark per frame lets the developer skip back and forth between the entry point and the point of failure without rebuilding the call stack each time. For teams that follow the Smallworld 5.x style, where method invocations can trigger plugin code, this is often the fastest way to isolate a fault.

If you are extending the workflow further, it is worth checking how compatible code is built across language boundaries, since some Magik installations call into compiled helpers written in C. Bookmarking both ends of that boundary makes cross-language regressions far easier to localise.

When to Reach for Bookmarks Versus Other Navigation Aids

Imenu, semantic navigation, and Magik's own jump-to-definition all have their place, but none of them remember where you were yesterday. Bookmarks carry that memory without ceremony, which is what makes them ideal for the slow, iterative part of debugging where a defect spans multiple sessions over several days.

Registers are quicker but vanish at the end of the session, so they suit short hops rather than ongoing investigations. Recent files and M-x history capture intent at a coarser grain. For the precise point where a Magik method misbehaved, only a bookmark pins it with enough accuracy to revisit days later with confidence.

For Australian developers spending the Southern Hemisphere summer troubleshooting heat-related SCADA failures, this precision is a quiet productivity boost. A bookmark from yesterday's outage investigation is still valid when the network team rings at six in the morning asking for the same frame. A well-kept bookmark file becomes a personal institutional memory.

Building a Personal Bookmark Discipline

The value of bookmarks scales with how consistently they are used. A simple rule of thumb is to set a bookmark the moment you stop and think, "I will need to come back here." Five seconds invested then saves many minutes later, especially when the call originates from a customer in Ballarat rather than from your own desk.

Magik Emacs offers tooling designed around exactly these habits, from the Magik method browser to the stack inspector and the persistent session support. If you would like help tailoring a bookmark workflow to your team's Magik codebase, the contact page is the easiest way to start a conversation with the people who maintain the site.

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