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.

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Tokkun Studio unveils alpha trailer for...
We are back on the MMORPG news train, and this time it comes from the sort of international developers Tokkun Studio. They are based in France and Japan, so it counts. Anyway, semantics aside, they have released an alpha trailer for the upcoming... | Read more »
Win a host of exclusive in-game Honor of...
To celebrate its latest Jujutsu Kaisen crossover event, Honor of Kings is offering a bounty of login and achievement rewards kicking off the holiday season early. [Read more] | Read more »
Miraibo GO comes out swinging hard as it...
Having just launched what feels like yesterday, Dreamcube Studio is wasting no time adding events to their open-world survival Miraibo GO. Abyssal Souls arrives relatively in time for the spooky season and brings with it horrifying new partners to... | Read more »
Ditch the heavy binders and high price t...
As fun as the real-world equivalent and the very old Game Boy version are, the Pokemon Trading Card games have historically been received poorly on mobile. It is a very strange and confusing trend, but one that The Pokemon Company is determined to... | Read more »
Peace amongst mobile gamers is now shatt...
Some of the crazy folk tales from gaming have undoubtedly come from the EVE universe. Stories of spying, betrayal, and epic battles have entered history, and now the franchise expands as CCP Games launches EVE Galaxy Conquest, a free-to-play 4x... | Read more »
Lord of Nazarick, the turn-based RPG bas...
Crunchyroll and A PLUS JAPAN have just confirmed that Lord of Nazarick, their turn-based RPG based on the popular OVERLORD anime, is now available for iOS and Android. Starting today at 2PM CET, fans can download the game from Google Play and the... | Read more »
Digital Extremes' recent Devstream...
If you are anything like me you are impatiently waiting for Warframe: 1999 whilst simultaneously cursing the fact Excalibur Prime is permanently Vault locked. To keep us fed during our wait, Digital Extremes hosted a Double Devstream to dish out a... | Read more »
The Frozen Canvas adds a splash of colou...
It is time to grab your gloves and layer up, as Torchlight: Infinite is diving into the frozen tundra in its sixth season. The Frozen Canvas is a colourful new update that brings a stylish flair to the Netherrealm and puts creativity in the... | Read more »
Back When AOL WAS the Internet – The Tou...
In Episode 606 of The TouchArcade Show we kick things off talking about my plans for this weekend, which has resulted in this week’s show being a bit shorter than normal. We also go over some more updates on our Patreon situation, which has been... | Read more »
Creative Assembly's latest mobile p...
The Total War series has been slowly trickling onto mobile, which is a fantastic thing because most, if not all, of them are incredibly great fun. Creative Assembly's latest to get the Feral Interactive treatment into portable form is Total War:... | Read more »

Price Scanner via MacPrices.net

Early Black Friday Deal: Apple’s newly upgrad...
Amazon has Apple 13″ MacBook Airs with M2 CPUs and 16GB of RAM on early Black Friday sale for $200 off MSRP, only $799. Their prices are the lowest currently available for these newly upgraded 13″ M2... Read more
13-inch 8GB M2 MacBook Airs for $749, $250 of...
Best Buy has Apple 13″ MacBook Airs with M2 CPUs and 8GB of RAM in stock and on sale on their online store for $250 off MSRP. Prices start at $749. Their prices are the lowest currently available for... Read more
Amazon is offering an early Black Friday $100...
Amazon is offering early Black Friday discounts on Apple’s new 2024 WiFi iPad minis ranging up to $100 off MSRP, each with free shipping. These are the lowest prices available for new minis anywhere... Read more
Price Drop! Clearance 14-inch M3 MacBook Pros...
Best Buy is offering a $500 discount on clearance 14″ M3 MacBook Pros on their online store this week with prices available starting at only $1099. Prices valid for online orders only, in-store... Read more
Apple AirPods Pro with USB-C on early Black F...
A couple of Apple retailers are offering $70 (28%) discounts on Apple’s AirPods Pro with USB-C (and hearing aid capabilities) this weekend. These are early AirPods Black Friday discounts if you’re... Read more
Price drop! 13-inch M3 MacBook Airs now avail...
With yesterday’s across-the-board MacBook Air upgrade to 16GB of RAM standard, Apple has dropped prices on clearance 13″ 8GB M3 MacBook Airs, Certified Refurbished, to a new low starting at only $829... Read more
Price drop! Apple 15-inch M3 MacBook Airs now...
With yesterday’s release of 15-inch M3 MacBook Airs with 16GB of RAM standard, Apple has dropped prices on clearance Certified Refurbished 15″ 8GB M3 MacBook Airs to a new low starting at only $999.... Read more
Apple has clearance 15-inch M2 MacBook Airs a...
Apple has clearance, Certified Refurbished, 15″ M2 MacBook Airs now available starting at $929 and ranging up to $410 off original MSRP. These are the cheapest 15″ MacBook Airs for sale today at... Read more
Apple drops prices on 13-inch M2 MacBook Airs...
Apple has dropped prices on 13″ M2 MacBook Airs to a new low of only $749 in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, now available for $679 for 8-Core CPU/7-Core GPU/256GB models. Apple’s one-year warranty is included, shipping is free, and each... Read more

Jobs Board

Seasonal Cashier - *Apple* Blossom Mall - J...
Seasonal Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Seasonal Fine Jewelry Commission Associate -...
…Fine Jewelry Commission Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) Read more
Seasonal Operations Associate - *Apple* Blo...
Seasonal Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Read more
Hair Stylist - *Apple* Blossom Mall - JCPen...
Hair Stylist - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.