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

If you can find it and fit through the d...
The holy trinity of amazing company names have come together, to release their equally amazing and adorable mobile game, Hamster Inn. Published by HyperBeard Games, and co-developed by Mum Not Proud and Little Sasquatch Studios, it's time to... | Read more »
Amikin Survival opens for pre-orders on...
Join me on the wonderful trip down the inspiration rabbit hole; much as Palworld seemingly “borrowed” many aspects from the hit Pokemon franchise, it is time for the heavily armed animal survival to also spawn some illegitimate children as Helio... | Read more »
PUBG Mobile teams up with global phenome...
Since launching in 2019, SpyxFamily has exploded to damn near catastrophic popularity, so it was only a matter of time before a mobile game snapped up a collaboration. Enter PUBG Mobile. Until May 12th, players will be able to collect a host of... | Read more »
Embark into the frozen tundra of certain...
Chucklefish, developers of hit action-adventure sandbox game Starbound and owner of one of the cutest logos in gaming, has released their roguelike deck-builder Wildfrost. Created alongside developers Gaziter and Deadpan Games, Wildfrost will... | Read more »
MoreFun Studios has announced Season 4,...
Tension has escalated in the ever-volatile world of Arena Breakout, as your old pal Randall Fisher and bosses Fred and Perrero continue to lob insults and explosives at each other, bringing us to a new phase of warfare. Season 4, Into The Fog of... | Read more »
Top Mobile Game Discounts
Every day, we pick out a curated list of the best mobile discounts on the App Store and post them here. This list won't be comprehensive, but it every game on it is recommended. Feel free to check out the coverage we did on them in the links below... | Read more »
Marvel Future Fight celebrates nine year...
Announced alongside an advertising image I can only assume was aimed squarely at myself with the prominent Deadpool and Odin featured on it, Netmarble has revealed their celebrations for the 9th anniversary of Marvel Future Fight. The Countdown... | Read more »
HoYoFair 2024 prepares to showcase over...
To say Genshin Impact took the world by storm when it was released would be an understatement. However, I think the most surprising part of the launch was just how much further it went than gaming. There have been concerts, art shows, massive... | Read more »
Explore some of BBCs' most iconic s...
Despite your personal opinion on the BBC at a managerial level, it is undeniable that it has overseen some fantastic British shows in the past, and now thanks to a partnership with Roblox, players will be able to interact with some of these... | Read more »
Play Together teams up with Sanrio to br...
I was quite surprised to learn that the massive social network game Play Together had never collaborated with the globally popular Sanrio IP, it seems like the perfect team. Well, this glaring omission has now been rectified, as that instantly... | Read more »

Price Scanner via MacPrices.net

B&H has 13-inch M2 MacBook Airs with 16GB...
B&H Photo has 13″ MacBook Airs with M2 CPUs, 16GB of memory, and 256GB of storage in stock and on sale for $1099, $100 off Apple’s MSRP for this configuration. Free 1-2 day delivery is available... Read more
14-inch M3 MacBook Pro with 16GB of RAM avail...
Apple has the 14″ M3 MacBook Pro with 16GB of RAM and 1TB of storage, Certified Refurbished, available for $300 off MSRP. Each MacBook Pro features a new outer case, shipping is free, and an Apple 1-... Read more
Apple M2 Mac minis on sale for up to $150 off...
Amazon has Apple’s M2-powered Mac minis in stock and on sale for $100-$150 off MSRP, each including free delivery: – Mac mini M2/256GB SSD: $499, save $100 – Mac mini M2/512GB SSD: $699, save $100 –... Read more
Amazon is offering a $200 discount on 14-inch...
Amazon has 14-inch M3 MacBook Pros in stock and on sale for $200 off MSRP. Shipping is free. Note that Amazon’s stock tends to come and go: – 14″ M3 MacBook Pro (8GB RAM/512GB SSD): $1399.99, $200... Read more
Sunday Sale: 13-inch M3 MacBook Air for $999,...
Several Apple retailers have the new 13″ MacBook Air with an M3 CPU in stock and on sale today for only $999 in Midnight. These are the lowest prices currently available for new 13″ M3 MacBook Airs... Read more
Multiple Apple retailers are offering 13-inch...
Several Apple retailers have 13″ MacBook Airs with M2 CPUs in stock and on sale this weekend starting at only $849 in Space Gray, Silver, Starlight, and Midnight colors. These are the lowest prices... Read more
Roundup of Verizon’s April Apple iPhone Promo...
Verizon is offering a number of iPhone deals for the month of April. Switch, and open a new of service, and you can qualify for a free iPhone 15 or heavy monthly discounts on other models: – 128GB... Read more
B&H has 16-inch MacBook Pros on sale for...
Apple 16″ MacBook Pros with M3 Pro and M3 Max CPUs are in stock and on sale today for $200-$300 off MSRP at B&H Photo. Their prices are among the lowest currently available for these models. B... Read more
Updated Mac Desktop Price Trackers
Our Apple award-winning Mac desktop price trackers are the best place to look for the lowest prices and latest sales on all the latest computers. Scan our price trackers for the latest information on... Read more
9th-generation iPads on sale for $80 off MSRP...
Best Buy has Apple’s 9th generation 10.2″ WiFi iPads on sale for $80 off MSRP on their online store for a limited time. Prices start at only $249. Sale prices for online orders only, in-store prices... Read more

Jobs Board

*Apple* Systems Administrator - JAMF - Activ...
…**Public Trust/Other Required:** None **Job Family:** Systems Administration **Skills:** Apple Platforms,Computer Servers,Jamf Pro **Experience:** 3 + years of Read more
Liquor Stock Clerk - S. *Apple* St. - Idaho...
Liquor Stock Clerk - S. Apple St. Boise Posting Begin Date: 2023/10/10 Posting End Date: 2024/10/14 Category: Retail Sub Category: Customer Service Work Type: Part Read more
Top Secret *Apple* System Admin - Insight G...
Job Description Day to Day: * Configure and maintain the client's Apple Device Management (ADM) solution. The current solution is JAMF supporting 250-500 end points, Read more
Sonographer - *Apple* Hill Imaging Center -...
Sonographer - Apple Hill Imaging Center - Evenings Location: York Hospital, York, PA Schedule: Full Time Sign-On Bonus Eligible Remote/Hybrid Regular Apply Now Read more
Beauty Consultant - *Apple* Blossom Mall -...
Beauty Consultant - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.