Sam (text Editor) - Design and Features

Design and Features

Sam is designed as two synchronous programs: a command interpreter and a mouse-oriented bitmap windowing interface. The interpreter's command set is modeled after the UNIX editor ed and may be used to operate the editor from a standard text terminal. By default, however, Sam presents its own graphical user interface (GUI) window, samterm, which additionally allows point-and-click operations through Smalltalk-80-style pop-up context menus. This two-process structure allowed sam to access files on networked host systems through remote execution of the file-access process while running the windowing interface locally, thereby bypassing latency over slow connections in its GUI.

Samterm presents windows to files being edited and to at least one persistent command window which accepts input as sam commands. Most common editing operations are quickly and naturally accomplished with the point-and-click interface, which also functions inside the command window. This latter fact allows commands to be edited (and resubmitted) just as any other text, a function inherited from the DMD 5620 terminal interface.

Sam's command syntax is formally similar to ed's or ex's, containing (structural-) regular expression based conditional and loop functions and scope addressing, even sharing some of ed's syntax for such functions. But while ed's commands are line-oriented, sam's are selection-oriented. Selections are contiguous strings of text (which may span multiple lines), and are specified either with the mouse (by sweeping it over a region of text) or by a pattern match. Sam's commands take such selections as basic—more or less as other Unix tools treat lines; thus, multi-line and sub-line patterns are as naturally handled by Sam as whole-line patterns are by ed, vi, AWK, Perl, etc. This is implemented through a model called structural regular expressions, which can recursively apply regular-expression matching to obtain other (sub)selections within a given selection. In this way, sam's command set can be applied to substrings that are identified by arbitrarily complex context.

Sam extends its basic text-editing command set to handling of multiple files, providing similar pattern-based conditional and loop commands for filename specification. Any sequence of text-editing commands may be applied as a unit to each such specification.

Sam was one of the first text editors to support infinite undo to revert any number of editing errors. This feature, combined with Sam's facility to easily edit its own commands and, fundamentally, its small, orthogonal command set (containing only 33 commands), represent the program's bias toward a low learning threshold over other more expressive power editors.

Sam is the preferred text editor of many eminent computer scientists; it replaced ed as Ken Thompson's favorite text editor, and he still uses it to this day. Sam is the text editor used by Bjarne Stroustrup and Brian Kernighan. Others, like Dennis Ritchie, had moved on to use acme instead.

Sam vs. acme editor wars occur in the Plan 9 community (both are shipped with Plan 9) although both stem from a similar aesthetic bias. Both were written by Rob Pike.

The latest incarnation of sam was written as part of the Plan 9 operating system, but there are Microsoft Windows and X Window System ports available.

Read more about this topic:  Sam (text Editor)

Famous quotes containing the words design and/or features:

    Teaching is the perpetual end and office of all things. Teaching, instruction is the main design that shines through the sky and earth.
    Ralph Waldo Emerson (1803–1882)

    Art is the child of Nature; yes,
    Her darling child, in whom we trace
    The features of the mother’s face,
    Her aspect and her attitude.
    Henry Wadsworth Longfellow (1807–1882)