TweetFollow Us on Twitter

Alpha
Volume Number:10
Issue Number:7
Column Tag:Tools of the Trade

Alpha - An Adaptable Programmer’s Editor

Don’t let that shareware label fool you - this editor’s feature-rich and powerful

By David Rogers, Aldus Corporation

About the author

A programmer for fifteen years, David is a software engineer at Aldus, and lives with his wife, two small children, and a cocker spaniel in Issaquah, Washington.

[About the article:When we made mention in comp.sys.mac.programmer of the review of programmer editors in our June issue, David was quick to let us know that we had missed one. Sure enough, Alpha is a contender, and David was good enough to write up an introduction to Alpha for us - Ed stb]

Overview

Alpha is a shareware programmer’s editor for the Macintosh with a wide range of capabilities. Alpha is a product of Pete Keleher, a graduate student at Rice University.

Like most programmer’s editors, Alpha is designed to work with ASCII text, normally source code. Alpha also edits TEX files, but that capability is not reviewed here. When needed, Alpha can store text with DOS or UNIX line-ends. Alpha can also save MPW state information when you close the file. When you reopen the file, the window will be restored to its former position and the cursor positioned at its previous point in the file. This is a real advantage if you open and close files frequently.

A quick look at the look of Alpha

Alpha has a layered architecture. At the core of Alpha is an editing engine which provides the editing primitives. Layered on top of this is the command language, TCL. That’s an acronym for Tool Command Language and is pronounced “tickle”. TCL is a full-fledged C-like language. Most of the Alpha user interface is written in TCL. This exposes the internals of Alpha to the user. This access to the internals gives Alpha a great deal of flexibility.

In particular, all the keyboard mappings and menu definitions are user definable. Alpha even allows you to use multiple keystrokes as a single command in the manner of Emacs or Wordstar (Word who?). You can, of course, write your own procedures in TCL and attach menu items or keystrokes to your commands.

In addition to a rare measure of customizability, Alpha has extensive support for programmers: ToolServer support, Apple Event (including Symantec Project Manager) support, and Electric Aliases (I’ll describe this below).

Unfortunately, all this power comes at a price. Like any full-featured application, it takes time to learn to use Alpha to the fullest. This problem is exacerbated in Alpha because it lacks extensive documentation. Nevertheless, Alpha offers so much that it deserves a closer look.

“More Power!”- Tim Allen

Details Details

The power, or usefulness if you prefer, of a programmer’s editor is often a matter of attention to detail. Many of the features of Alpha are just little things. But, those little conveniences add up. Moreover, Alpha chooses to emphasize features you use often. A feature that saves you two or three minutes once a month is not nearly a helpful as the feature that saves you a second or two again and again.

Cursor Control

Alpha includes all the standard cursor control operations, moving by page, jumping to the top or bottom of the file and so forth. Alpha also includes some less common capabilities. Alpha attempts to maintain the column position when you move the cursor up or down a line. In most Macintosh editors, the cursor jumps to the left margin when the cursor hits a blank line.

You’ll notice another nice feature when you page up or down. The cursor moves with you. This allows you to quickly move great distances in your code without having to take your hands off of the keyboard. This feature could be improved, however. Currently the cursor is arbitrarily moved to the upper left corner of the window after a paging movement. It would be better if the cursor stayed in the same relative spot in the window. That would allow you to page down and page back to the exact spot you started.

Somewhat related to cursor control is the fact that Alpha includes a true undo and redo capability. Unlike many other editors, Alpha can undo and redo most actions, not just text entry.

Block Moves

Again the power is in the details. Alpha does the standard cut, copy and paste, but also includes drag-and-drop editing and rectangular selection. Drag-and-drop allows you to move blocks of code using only the mouse. Very nice - especially when modifying existing code. You’re normally mousing around a bit then anyway. Unfortunately, you cannot drag-and-drop between windows. Also, Alpha does not use Apple’s Drag Manager, so you can’t drop Finder items onto Alpha windows or text clippings into other applications.

Rectangular editing is one of those features that you don’t use often. But when you need it, you really need it. It is very useful when modifying tables of static data, for instance. Unfortunately, sometimes the rectangular selection feature isn’t quite right. Selections which include tabs aren’t calculated properly. It is obvious that the tabs are being treated a single character. Pete suggests that you convert tabs to spaces before using rectangular selection until this feature is fixed.

Example of rectangular selection

Keyboard selection (holding down Shift and typing arrow keys to make a selection) is also unusual. Once you have started selecting in a particular direction, you can’t back up. Reversing direction doesn’t shrink the selected area. It grows the opposite end of the selection. In order to shrink the selection, you have to start the selection over. This is time consuming and inconsistent with the way mouse selection works.

Searching

Alpha includes a number of ways to search your text - incremental search, multi-file search, batch multi-file search, and a grep command in the shell. More on the shell later. Incremental search allows you to start searching immediately, no muss, no fuss, no dialog. Press the key for incremental search and start typing. With each character you type, incremental search finds the next occurrence of what you have typed so far. That’s the incremental part of incremental search. Incremental search is a boon when you don’t need all the fancy options. You just want to start searching.

When you do need the options, Alpha also includes a find dialog. Alpha’s find allows full regular expression searching. For those not familiar, regular expression searching allows you to search for patterns of text. This allows you to search for “something that looks like this”. The find dialog also allows you to specify a multi-file search. You can select from predefined sets of files, or you can specify a directory to be searched. In multi-file searches, you have the choice of finding matches one at a time, the same way that Symantec does it. However, you can also elect to do a batch search. In this case, a new untitled window is opened and the output of the search is placed there.

The output is typical of grep-style output. You can also perform a grep search from the command line in the Alpha shell. No command-line parameters though. In this case, the output is displayed right in the shell window.

Two changes would greatly enhance the usefulness of Alpha’s search facilities. The multi-file searching would profit from the ability to search sub-folders recursively. The options dialog off the find dialog contains a check-box for it, but it would never activate for me - no matter how sternly I told it to. Another improvement would be to provide the option of having the grep command output TCL commands. Then you could execute a line of the output to open the file and see the surrounding text. This is the way MPW does it and it can be enormously helpful when you are searching large amounts of code.

Window Control

Window manipulation is not a sexy topic, but can be enormously helpful when you have a gaggle of windows open. Of course, Alpha has commands to switch to the next and previous windows. Alpha also allows you to choose a window from a list and to organize your windows. The choose window dialog allows you to switch to an arbitrary window without taking your hands off the keyboard.

The arrange window menu allows you to arrange your Alpha windows vertically or horizontally or to tile or overlay them. Arranging affects only the top two windows. Tiling and overlaying affects all Alpha windows.

Some sample TCL code

One thing Alpha really needs in the window management sector is split windows. It is very convenient to look at two portions of the same file at the same time. Named marks (described below) partially alleviate the need for this feature, but the split windows feature would be a better solution. [Note: Alpha allows you to open more than one copy of a file, so you can achieve a similar effect without window panes - Ed stb]

TCL command language

TCL was developed by John Ousterhout, a professor at U.C. Berkeley, for a microkernel operating system he was developing called Sprite. John developed TCL as a common command language for various Sprite tools. Well, Sprite never took off, but TCL did. In due course, an Alpha user suggested that TCL would be a nice addition to Alpha.

When Alpha was originally developed, it had a very simple and non-standard macro language. Pete saw the power of TCL and redesigned Alpha with a C core and a TCL interface. Pete continues to add features to the Alpha engine, but many of the enhancements to Alpha are done completely in TCL.

TCL is a string based language. Its only data type is string. Also, every operation is an operation on strings. TCL can manipulate numeric values, but the values are stored as strings. TCL’s syntax will often look like C on first glance, but do not be confused. TCL is entirely command based. For instance, the if statement in the following procedure is actually an if command, and the statement collections and the else are parameters.


/* 1 */
proc testThis {a b} {
 if { $a < $b} {
 set a 10
 } else {
 set b 10
 }
}

The TCL Shell window

As if that weren’t strange enough, proc in the command above is also a command. The name of the proc, the parameter list and the statement body are all parameters to the proc command. While this is an unusual approach, the language is so consistent that you should have no trouble learning to use TCL in short order. As stated above, most of Alpha’s interface is in TCL, so there are lots of examples if you do get stuck.

TCL is quite good at what it is intended for. It has arrays (lists) but nothing more complicated in the way of data structures. However, it has the usual complement of flow control statements, and a full procedural language. In addition, it has string and list processing commands you won’t find in most other languages. As a tool command language, that’s just the way you’d want it.

If you do need to perform some action that is beyond the capabilities of TCL, you can write an XTCL in your favorite compiled language. XTCLs are similar in form and function to HyperCard’s XCMDs. Unlike most of Alpha, XTCLs are adequately documented and several examples are included.

Alpha allows you interactive access to TCL through the “Shell” menu item. You can execute any currently defined procedure through the shell. Since Alpha comes with commands to copy, move, and delete files, the shell makes a usable, if limited, command-line interface. I realize that command-line interfaces are anathema to most Mac users. However, they are handy when file manipulation is repetitious or when large numbers of files are involved. You can also use the shell to quickly test commands your are developing. [MPW afficionados know there’s little reason to apologize for an interactive shell - Ed stb]

Alpha’s TCL documentation is limited. It includes a very brief definition of the language and a description of each keyword and built-in command. This is fine if you already understand the quirks of TCL, but is not sufficient for a newcomer to the language. Fortunately, the language is better documented elsewhere. If you can find documentation for version 6 of TCL, it provides a much better overview.

Interpreted languages have a bad reputation. “Slow” is the word that usually comes to mind. This is not the case with TCL. Even though Alpha executes quite a bit of TCL code at startup, Alpha loads in 4 seconds on a IIfx - less than that on an 840AV.

Programmer Specific Support

Electric Aliases / Template editing

When you’re editing code, you spend a large portion of your time typing for statements, while statements, if statements, and so forth. Wouldn’t it be nice if the editor did a lot of that work for you? That’s the principle behind Alpha’s Electric Alias feature (also known as template editing). The way it works is this: You enter “if” and press tab. The editor types the parens and the curly braces and positions the cursor in the parens. You’re ready to type the condition. Another key jumps the cursor between the condition and body of the if statement. Like everything else in Alpha, Electric Aliases are easily modified. It is convenient to set them to trigger on single characters. So, in the case of a while statement, you only have to enter a “w”, press tab, and you’re ready to enter the condition. Template editing saves a lot of time and a lot of wear and tear on the fingers.

ToolServer Support

Alpha provides support for Apple’s ToolServer by providing an editing window set to a special ToolServer mode. Anything entered in that window is sent via Apple Events to the ToolServer application. ToolServer, for the uninitiated, is MPW with no user interface. Most commands you can give in MPW will also work as commands sent to ToolServer.

Unfortunately, Alpha’s implementation is flawed. Alpha does not allow you to switch to dialogs put up by ToolServer. This precludes you from using any MPW tools which contain a dialog, or even the lowly alert command. Unless you are sure that you will never invoke a ToolServer dialog, I recommend that you do not use the ToolServer shell until this feature is fixed.

Apple Events/AppleScript Support

Alpha provides Apple Event/AppleScript support both into and out of the editor. Going into the editor, Alpha provides open, print, quit, and run events from the required suite. From the misc suite, Alpha provides the DoScript event. This is a powerful facility since you can send TCL strings to Alpha from AppleScript scripts and have them executed. Alpha does not support the full editing suite, but, given the power of TCL and the inclusion of the DoScript command, it is not a great loss. One limitation, though, is that DoScript doesn’t return the value of the executed TCL command.

Alpha provides two methods for sending apple events to other applications. The dosc command provides a number of parameters for designating the target and nature of the event. The limitation is that the data of the event must be a string or a file. Alpha also provides an AEBuild command. There is no documentation at all for this command, except that the documentation warns that this command is under development and subject to change.

Alpha uses the above commands to provide support for communicating with the Symantec Project Manager and Symantec Reference. When editing a C or C++ file, Alpha attaches an extra menu with commands for driving the Symantec Project Manager and for looking up Symantec Reference templates.

The Think Menu

Other Programming Goodies

Alpha displays the current line and column on the title bar. Alpha also searches source code at load time for function names. Alpha uses these names in a pop-up menu on the title bar. You can click on the pop-up and jump directly to a specific function.

Automatic function popup

The named-marks feature is not specifically for programmers, but it is especially useful in that context. Often when modifying existing code, you need to examine more than one function at different spots in a source file. Named marks allow you to quickly note the location of each spot and jump between them easily.

Alpha as word processor - not!

While you do not want to use Alpha as a word processor, it is useful for the occasional note and for typing long comments in source code. Alpha behaves differently (and may present different menus) depending on the mode of the active window. Each window opened in Alpha is considered to belong to a particular mode - normally based on the file extension or file type. In text mode, text wrap is active. Text entered in text mode is automatically wrapped at a user defined column. You can also wrap arbitrary areas of text on command.

Alpha will also check the spelling of selections or entire files using the freeware spelling checker Excalibur. Imagine having no spelling errors in your comments!

Omega

The topic of programmer’s editors is prone to heated debate, if not outright warfare. Everyone has a favorite feature that they swear by (and other features that they swear at). I feel compelled, therefore, to state that this article does not contain a comprehensive list of Alpha’s features. Fortunately, since Alpha is shareware, you can take a look for yourself to see if Alpha contains that gotta-have-it-or-I’ll-die feature.

Alpha Shrugged

Alpha’s greatest lack is not in the range of features or in the implementation of those features. With few exceptions, Alpha does many things and does them well. Where Alpha falls down is in making Alpha accessible to the new user. Alpha needs a great deal more documentation, including a Getting Started document. It also needs a way to easily set the new user’s preferences.

Alpha’s Future

Alpha is currently written in Symantec C. Pete is currently evaluating Metrowerks CodeWarrior. If all goes well, Pete hopes to port the Alpha source to CodeWarrior sometime this summer. At that point he will consider porting Alpha to PowerPC.

Conclusions

Whether Alpha will interest you depends on whether you are willing to pay the price for the power contained there. Alpha requires little learning to use as delivered. However, if you want to take full advantage of Alpha’s power, you must take some time to customize it to your needs.

Another price might be paid in the fact that Alpha is shareware. Because it’s shareware, it is inexpensive and you can try before you buy. However, support for Alpha is not as readily available as support for commercial products. You can reach Pete by e-mail if you have access to the Internet, but there is no phone support. Furthermore, Alpha is a sideline for Pete. He is currently a busy graduate student, but is due to finish this summer and hopes to find a research lab or faculty position soon. Obviously, support for Alpha will vary with the other demands on Pete’s time.

Availability and Pricing

Alpha has a shareware fee of $25. That fee includes all future releases of Alpha. Alpha is updated regularly. The latest update of Alpha is always available via the Internet by anonymous ftp at cs.rice.edu in the /public/Alpha directory. Alpha is also distributed to other major sites and to the major BBSs. I reviewed version 5.76.

 
AAPL
$112.94
Apple Inc.
+1.16
MSFT
$47.98
Microsoft Corpora
+0.32
GOOG
$524.87
Google Inc.
+8.52

MacTech Search:
Community Search:

Software Updates via MacUpdate

NeoOffice 2014.6 - Mac-tailored, OpenOff...
NeoOffice is a complete office suite for OS X. With NeoOffice, users can view, edit, and save OpenOffice documents, PDF files, and most Microsoft Word, Excel, and PowerPoint documents. NeoOffice 3.x... Read more
LibreOffice 4.3.5.2 - Free Open Source o...
LibreOffice is an office suite (word processor, spreadsheet, presentations, drawing tool) compatible with other major office suites. The Document Foundation is coordinating development and... Read more
CleanApp 5.0.0 Beta 5 - Application dein...
CleanApp is an application deinstaller and archiver.... Your hard drive gets fuller day by day, but do you know why? CleanApp 5 provides you with insights how to reclaim disk space. There are... Read more
Monolingual 1.6.2 - Remove unwanted OS X...
Monolingual is a program for removing unnecesary language resources from OS X, in order to reclaim several hundred megabytes of disk space. It requires a 64-bit capable Intel-based Mac and at least... Read more
NetShade 6.1 - Browse privately using an...
NetShade is an Internet security tool that conceals your IP address on the web. NetShade routes your Web connection through either a public anonymous proxy server, or one of NetShade's own dedicated... Read more
calibre 2.13 - Complete e-library manage...
Calibre is a complete e-book library manager. Organize your collection, convert your books to multiple formats, and sync with all of your devices. Let Calibre be your multi-tasking digital librarian... Read more
Mellel 3.3.7 - Powerful word processor w...
Mellel is the leading word processor for OS X and has been widely considered the industry standard since its inception. Mellel focuses on writers and scholars for technical writing and multilingual... Read more
ScreenFlow 5.0.1 - Create screen recordi...
Save 10% with the exclusive MacUpdate coupon code: AFMacUpdate10 Buy now! ScreenFlow is powerful, easy-to-use screencasting software for the Mac. With ScreenFlow you can record the contents of your... Read more
Simon 4.0 - Monitor changes and crashes...
Simon monitors websites and alerts you of crashes and changes. Select pages to monitor, choose your alert options, and customize your settings. Simon does the rest. Keep a watchful eye on your... Read more
BBEdit 11.0.2 - Powerful text and HTML e...
BBEdit is the leading professional HTML and text editor for the Mac. Specifically crafted in response to the needs of Web authors and software developers, this award-winning product provides a... Read more

Latest Forum Discussions

See All

This Week at 148Apps: December 15-19, 20...
Happy Holidays from 148Apps!   How do you know what apps are worth your time and money? Just look to the review team at 148Apps. We sort through the chaos and find the apps you’re looking for. The ones we love become Editor’s Choice, standing out... | Read more »
New Version of Tempo Smart Calendar Help...
New Version of Tempo Smart Calendar Helps You Plan Your Day Without Opening the App Posted by Jessica Fisher on December 22nd, 2014 [ permalink ] | Read more »
Sparkle - Advanced Cross-Synthesis (Mus...
Sparkle - Advanced Cross-Synthesis 1.0 Device: iOS Universal Category: Music Price: $6.99, Version: 1.0 (iTunes) Description: Sparkle is a tool for advanced spectral hybridizations made of several algorithms that operate on frequency... | Read more »
DICETINY is coming to iOS in 2015
DICETINY is coming to iOS in 2015 Posted by Jessica Fisher on December 22nd, 2014 [ permalink ] Fakedice has announced that they’re bringing their digital board game DICETINY to iOS. | Read more »
It Came From Canada: The Witcher Battle...
The Witcher 3: Wild Hunt may still be a few months away, but very soon players will be able to get a new taste of the acclaimed Polish RPG on their mobile devices with The Witcher Battle Arena. While it trades open-world exploration for compact... | Read more »
The Babies Get Lost Again in the New Azt...
The Babies Get Lost Again in the New Aztec Ruins Update for Light in the Dark Posted by Jessica Fisher on December 22nd, 2014 [ permalink ] | Read more »
Living Room 3D for IKEA Makes All In-App...
Living Room 3D for IKEA Makes All In-App Purchases Free Until 2015 Posted by Jessica Fisher on December 22nd, 2014 [ permalink ] | Read more »
Crossbow Warrior – The Legend of William...
Crossbow Warrior – The Legend of William Tell Review By Lee Hamlet on December 22nd, 2014 Our Rating: :: MISSES THE MARKUniversal App - Designed for iPhone and iPad Crossbow Warrior details the entertaining adventures of legendary... | Read more »
A New Update Races onto Asphalt 8: Airbo...
A New Update Races onto Asphalt 8: Airborne Posted by Jessica Fisher on December 22nd, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
Workflow: Powerful Automation Made Simpl...
Workflow: Powerful Automation Made Simple Review By Campbell Bird on December 22nd, 2014 Our Rating: :: GO WITH THE FLOWUniversal App - Designed for iPhone and iPad This powerful app lets users accomplish multiple tasks at touch of... | Read more »

Price Scanner via MacPrices.net

13-inch 2.4GHz Retina MacBook Pro (Apple refu...
The Apple Store has previous-generation Apple Certified Refurbished 13″ 2.4GHz/128GB Retina MacBook Pros available for $999. Apple’s one-year warranty is standard, and shipping is free: - 13″ 2.4GHz/... Read more
Apple resellers offer free overnight shipping
The Apple Store is now offering free next-day shipping on all in stock items if ordered before 12/23/14 at 10:00am PT. Local store pickup is also available within an hour of ordering for any in stock... Read more
Holiday sales continue: MacBook Airs for up t...
 B&H Photo has 2014 MacBook Airs on sale for up to $120 off MSRP, for a limited time, for the Thanksgiving/Christmas Holiday shopping season. Shipping is free, and B&H charges NY sales tax... Read more
Holiday sale continues: 13-inch Retina MacBoo...
 B&H Photo has new 13″ MacBook Pros on sale for up to $150 off MSRP as part of their Holiday pricing. Shipping is free, and B&H charges NY sales tax only: - 13″ 2.5GHz MacBook Pro: $979 save... Read more
Holiday sale continues: 15-inch Retina MacBoo...
 B&H Photo has the new 2014 15″ Retina MacBook Pros on sale for up to $300 off MSRP for a limited time. Shipping is free, and B&H charges NY sales tax only: - 15″ 2.2GHz Retina MacBook Pro: $... Read more
Holiday sale: 13-inch 128GB MacBook Air for $...
 Best Buy has the 2014 13-inch 1.4GHz 128GB MacBook Air on sale for $849.99, or $150 off MSRP, on their online store. Choose free home shipping or free local store pickup (if available). Price valid... Read more
13-inch 2.6GHz Retina MacBook Pro on sale for...
Best Buy has lowered their price on the 2014 13″ 2.6GHz/128GB Retina MacBook Pro to $1149.99 on their online store for a limited time. That’s $150 off MSRP and the lowest price available for this... Read more
Kodak Returns to CES With New Consumer Produ...
Former photography colossus Kodak is returning to CES for the first time in three years where the Kodak booth (#21818 South Hall 1) will showcase a wide range of innovative, imaging-related products... Read more
Invaluable Launches New Eponymously -Named A...
Invaluable, the world’s largest online live auction marketplace, hhas announced the official launch of the Invaluable app for iPad, now available for download in the iTunes App Store. Invaluable... Read more
IDC Reveals Worldwide Mobile Enterprise Appli...
International Data Corporation (IDC) last week hosted the IDC FutureScape: Worldwide Mobile Enterprise Applications and Solutions 2015 Predictions Web conference. The session provided organizations... Read more

Jobs Board

*Apple* Store Leader Program (US) - Apple, I...
…Summary Learn and grow as you explore the art of leadership at the Apple Store. You'll master our retail business inside and out through training, hands-on experience, Read more
Project Manager, *Apple* Financial Services...
**Job Summary** Apple Financial Services (AFS) offers consumers, businesses and educational institutions ways to finance Apple purchases. We work with national and Read more
*Apple* Retail - Multiple Positions (US) - A...
Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, you're also the Read more
*Apple* Retail - Multiple Positions (US) - A...
Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, you're also the Read more
*Apple* Retail - Multiple Positions (US) - A...
Job Description: Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.