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 Org-Mode to write better Magik documentation in Emacs

Technical documentation for Magik often begins as scattered notes: a method description in a ticket, a code sample in an email, and a database query saved somewhere on a shared drive. Over time, that material becomes difficult to search, update, and trust. Emacs Org-mode provides a more dependable way to bring those fragments together.

For developers working with GE Smallworld, an Org file can become a living technical reference for Magik classes, methods, collections, database behaviour, debugging procedures, and project conventions. It supports lightweight writing while retaining the structure and automation expected by an experienced development team.

Why Org-mode suits Magik documentation

Org-mode is useful because it treats documentation as structured plain text rather than a collection of isolated pages. Headings provide a hierarchy for packages, classes, methods, examples, and operational notes. Sections can be folded, expanded, searched, and rearranged without opening a separate visual editor.

That structure maps neatly to Magik work. A top-level heading might describe a Smallworld module, with child headings for its responsibilities and dependencies. Further levels can document individual methods, expected arguments, return values, side effects, and known failure conditions. Code blocks can sit beside the explanation instead of being copied into a separate reference document.

Org files also work well for documentation that changes alongside source code. A developer can keep a project guide in the same repository as Magik source, review edits through version control, and record decisions near the material they affect. This helps prevent the familiar situation where the code has changed but the wiki still describes last year’s behaviour.

For an Australian team spread between Sydney, Melbourne, Brisbane, and Perth, plain-text documentation is especially practical. It avoids dependence on a single office network or proprietary desktop application, and it remains usable when consultants and client staff have different systems. A small team can keep things straightforward: commit the Org file, review it, and publish a readable version when needed.

Building a useful Magik reference file

A good Org document should have a predictable shape. One approach is to use a top-level heading for the product or application, followed by sections such as architecture, development setup, Magik language notes, database access, troubleshooting, and release procedures. Each area can contain smaller headings that mirror the way developers look for information.

For example, a class reference might use headings like Class purpose, Creation, Public methods, Collection behaviour, Error handling, and Examples. A method entry can state what the method does in plain English, then show its signature and a short usage example. This is clearer than relying on a long narrative that mixes API facts with implementation history.

Org properties can add useful metadata without making the page visually busy. A method heading might include properties for its owning class, maturity, related ticket, or version. Tags can distinguish :api:, :database:, :debugging:, and :howto: content. Searching by tag is helpful when a team needs every database-related note before a migration or release.

Keep the hierarchy meaningful rather than excessive. If every sentence receives its own heading, folding becomes less useful and the file feels like a database export. Aim for sections that answer a recognisable question: how an object is created, why a query is slow, what a collection contains, or how to inspect a failed operation.

Combining explanation with Magik code

Org-mode source blocks are well suited to technical examples because they preserve indentation and syntax while keeping prose close at hand. Magik snippets can demonstrate method definitions, iteration over collections, object inspection, and common idioms. Even when execution is not automated, the source block makes examples easier to copy, review, and maintain.

A useful example should include context. Instead of showing a mysterious three-line fragment, explain which class owns it, what input it expects, and what the reader should observe. For a database-related method, document the relevant schema assumptions and whether the operation returns a single object, a collection, or a value that may be unset.

Long examples should be divided into small, purposeful blocks. One block can show object creation, another can show a method call, and a third can demonstrate diagnostic output. This makes it easier for a reader to compare the example with code in a live GE Smallworld environment. It also reduces the risk that an outdated setup step hides the important part of the technique.

Use #+begin_src and #+end_src consistently, and label blocks with a language such as magik if the local Emacs configuration supports it. If a major mode does not provide full Magik font-locking or execution support, the documentation still benefits from the block’s formatting, export behaviour, and clear separation from prose.

Navigating methods, objects, and related notes

Large technical references need links between concepts. Org-mode supports internal links to headings, named targets, and search terms, allowing a note about a method to point directly to its class overview or a related debugging procedure. This is more efficient than asking readers to search manually through a large file.

Cross-references are particularly valuable for Magik concepts that appear in several contexts. A collection may be discussed in a language guide, a data-loading procedure, and a performance note. Link those explanations rather than repeating the same paragraph in all three places. When the underlying behaviour changes, fewer copies need updating.

A documentation file can also include an index of commonly used methods, classes, and troubleshooting terms. A heading such as “Quick links” can point to object inspection, method lookup, database sessions, and error diagnosis. The index is simple to maintain because links remain readable in plain text and can be checked during review.

Documentation need Useful Org-mode feature Example for Magik teams
Class and method hierarchy Nested headings and folding Class overview with child method entries
Runnable or copyable examples Source blocks Collection iteration or object inspection
Related concepts Internal links Link a method note to its database explanation
Progress tracking TODO keywords and properties Mark an API note as draft or reviewed
Repeated reference data Tables and radio targets Field mappings, status codes, or parameters
Published manuals Export back ends Produce HTML or PDF for client distribution

The same approach works for screen-cast notes. A recording can have an Org page containing its purpose, prerequisites, timestamps, commands, and follow-up links. A developer watching a short demonstration after an arvo support session can jump directly to the relevant method rather than replaying the entire video.

Recording database and collection analysis

Magik documentation often needs to explain relationships that are awkward to describe in ordinary paragraphs. Org tables are useful for field mappings, collection contents, configuration values, object states, and comparisons between environments. They are readable in the source file and can be exported into HTML or other formats.

For database work, record the logical purpose of a query alongside its technical details. Include the source table or object type, filters, expected cardinality, indexing assumptions, and any transaction considerations. If a query is safe only in a read-only session, say so plainly. Operational warnings should be visible near the example rather than buried in a general administration chapter.

Collections deserve similar treatment. A note might compare a list, a property bag, and a domain-specific collection by ordering, duplicate handling, lookup behaviour, and typical use. This gives newer Magik developers a decision guide rather than a set of disconnected definitions. It also creates a convenient place to document project conventions that are not obvious from the language alone.

Org tables should remain modest in size. A giant exported data dictionary quickly becomes difficult to review and may expose information that should not be committed to a repository. Use representative values, pseudonymised identifiers, and links to controlled system documentation where sensitive details are involved.

Fitting Org-mode into an Emacs workflow

The strongest results come when writing documentation is part of normal development rather than an administrative task performed at the end of a project. Emacs makes it possible to keep a Magik source buffer, an Org reference file, a shell, and a version-control interface available in the same working environment.

Agenda views can collect documentation tasks such as “verify method example”, “describe new schema field”, or “review upgrade notes”. TODO keywords can distinguish TODO, IN-PROGRESS, REVIEW, and DONE. This is a practical way to prevent documentation debt from disappearing behind feature work, particularly on long-running utility or GIS projects.

Small extensions can improve the experience further, from better source-block editing to capture templates and export customisation. The Emacs extensions collection is a useful place to find related productivity ideas for developers already using Emacs with Magik. Choose additions carefully: a stable, understandable workflow is more valuable than a heavily customised configuration that only one person can maintain.

A capture template can create a consistent note from an error or support call. It might insert the date, application area, observed behaviour, suspected cause, resolution, and follow-up action. Australian consulting teams often move between client sites and remote sessions, so capturing a reliable note immediately can save a great deal of reconstruction later.

Publishing documentation for different audiences

Org-mode documents can serve developers internally and produce polished material for clients, operations staff, or training sessions. Export to HTML can create a searchable web reference, while PDF export can provide a controlled release document. Keep the source as the master copy and treat generated files as build output where possible.

Use export settings to control what each audience sees. Internal notes may include implementation details, work-in-progress warnings, and links to source files. A client-facing guide may need only supported procedures, configuration instructions, and clear examples. Tags and subtree export make it possible to maintain these views without duplicating the entire document.

A small style guide helps several authors produce consistent material. Define how method names are formatted, how code blocks are labelled, how warnings are written, and when an example requires a version note. Australian spelling should be applied consistently in headings and prose, while Magik identifiers and API names must remain exactly as they appear in code.

Documentation also needs ownership. Assign a maintainer for each major area and add a review date or version property to sections that describe changing behaviour. A quarterly check may suit a stable system, while release notes and database procedures deserve review during every deployment. The goal is trustworthy information, not paperwork for its own sake.

Maintaining a living technical knowledge base

A useful Org-based reference should reflect real development questions. When someone asks how to inspect an object, locate a method, analyse a collection, or diagnose a database problem, the answer can become a small improvement to the relevant section. Over time, repeated support conversations turn into searchable institutional knowledge.

Avoid documenting every implementation detail simply because it exists. Focus on information that helps someone make a decision, complete a task, understand a constraint, or recover from an error. Explain why a pattern is used, especially when it differs from ordinary Magik examples or from conventions in another Smallworld project.

Version control provides the safety net. Review changes to code examples and method descriptions alongside source changes, and use meaningful commit messages when documentation records a behavioural change. If a team works with contractors or multiple client organisations, repository permissions and redaction rules should be agreed before sensitive configuration or infrastructure details are added.

Start with one active area, such as debugging or database analysis, rather than attempting to convert years of scattered material in a single effort. Create a modest Org structure, add accurate examples, link related notes, and refine the workflow as developers use it. With that discipline, Emacs becomes more than a place to edit Magik: it becomes a dependable environment for building and maintaining the knowledge around the code.

Adopt an Org file for the next Magik feature or support issue, record the method behaviour and working example as you go, then commit the result with the source. A small, accurate reference created during real work is the best foundation for a documentation system that serves developers, consultants, and clients 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