MicroEmacs 4.00 - A Review By Tim Swenson MicroEmacs is a text editor that is available on many different computer platforms. It was originally written for Unix, but it has migrated to MS-DOS, Windows, Mac, ST, Amiga, CP/M, and QDOS. The earliest port that I am aware of was done of MicroEmacs 3.8. Then versions 3.9 and 3.11 were ported. Thierry Godefroy has taken the source of the latest version of MicroEmacs, 4.00, and ported it to the QL. Unlike the previous ports, Thierry has added a number of QDOS features that make the end editor much more usable. I first started using MicroEmacs when I wanted an editor that could be used on the same file on different platforms. MicroEmacs was about the only editor on the QL that was available on other computers. It was not the easiest editor to learn. The commands were a bit cryptic, the terms were different, and overall a bit of a struggle. I started using it only knowing just enough commands to get done what I needed to get done. Editing Power MicroEmacs has all of the basic text editing fuctions, including marking text, deleting marked text, copying marked text, saving mark text to a file, importing a file, and search and replace. MicroEmacs can edit and display more than one file. Each file is loaded into a buffer to edit. Each buffer can be displayed in a seperate window. There are commands to create new windows, jump between windows, resize windows, and delete windows. MicroEmacs has various modes that it can work in. The modes are: ABBREV - Saves typing by automatically expanding known abbreviations to full words. Some abbreviations are built-in, but more can be added. ASAVE - Automatically saves files after so many characters have been changed (added or deleted). CMODE - Adds a number of features to help programming in C, such as autoindentation, show matching open brace ({) when close brace (}) is typed, and a # sign with leading white space will be left flushed (for preprocessor directive). CRYPT - The file edited is encrypted for saves and decrypted for reading, based on a user given encryption key. OVER - Overwrite mode. WRAP - Turns on word wrap. The right margin is defined by the user. VIEW - Read-only mode. I found that when using the WRAP mode, MicroEmacs is not a bad word processor. The reformat command lets you reformat a paragraph after it's been edited. One feature that I really have not used is Undo. A number of commands are kept in memory (user configurable) and you can undo 1 or more commands. You can even list the past commands. Since MicroEmacs came from a Unix backgroud, it can "shell" out to the operating system. Since the QL does not have a shell to execute, the built in default is to run Adrian Ives Shell "sh". This will allow you to do QDOS-like commands, like listing the directory of a disk. You can also run/exec a program from within MicroEmacs. You can edit a C program and then run the compiler from within MicroEmacs. Macro Language The most powerfull feature of MicroEmacs is having a macro langauge. Other editors have ways to automate tasks. ED/QED allows you to enter a list of commands and it will execute them, even repeatedly. MicroEmacs allows all this, plus it supports IF statements and WHILE loops. All of the MicroEmacs commands have a name, so every command is available for use in a macro. Here is an example of what a macro looks like: store-procedure get-word set $kill "" !force next-word set-mark !force end-of-word copy-region set %word $kill ; write-message &cat "The Word is : " %word !endm This procedure goes to the next word, marks it, and then copies it into the "kill" buffer. Macros can be stored in a file and executed by reading the file in, or you can create procedures, read them in, and call then whenever you need them. You can even bind your procedure to a key sequence so that it is run when you enter the sequence. MicroEmacs is really driven by the commands and not the keyboard. The various commands are binded to a particular keyboard sequence. Since only the commands themselves perminate, you can change the keyboard commands to suit your prefered setup. If you want to change the save-file command from CTRL-X-CTRL-S to CTRL-S, you can. This allows MicroEmacs to "emulate" virtually any editor. On the MicroEmacs web page there is a macro file that make MicroEmacs behave like the popular MS-DOS editor, BRIEF (which I believe is based on older WordStar commands). MicroEmacs has a configuration file called emacs_rc. This file is nothing more than a macro file with some pre-defined configuration. You can put in your own procedures or you can totally change the configuration. The only thing special about this file is that MicroEmacs looks for it upon starting. QDOS Support Thierry has added a lot to MicroEmacs to make it work better in the QDOS environment. He has added support for Toolkit II, Pointer Environment, Menu Extensions (QMENU), Environment Variables, QPAC2 (for buttons), FileInfo II, and QTYP II. Not all of these extensions are need to run MicroEmacs, it checks to see which extenions are resident and only uses those that are present. The biggest addition is Pointer Environment menus. Most of the MicroEmacs commands can be executed by selecting them from a menu. Without the menus, you have to memorize a number of cryptic commands. The commands are still there, but the menus make them almost useless. With Environment Variable support, you can change the configuration of MicroEmacs for QDOS specific features. A list of paths can be put in the PATH variable for MicroEmacs to search for files. SHELL defines which shell you want to use. EMACS_POINTER defines what type of pointer (hand or cursor) to use. EMACS_HOME defines where the emacs_rc will reside (this was a variable Thierry put in at my request). I am not a user of FileInfo II, so I can't really explain exactly how MicroEmacs interfaces with FileInfo II. Since Thierry is also the author of FileInfo II, I'm sure that it interfaces well. If you have the Menu Extensions loaded then you can copy text to/from MicroEmacs and the scrap. This allows you to transfer text to/from other applications. With QTYP II, the SPELL mode is usable. It allows for real-time spell checking or the use of the "spell-check" command, which spell checks words in the current buffer. This feature was only just recently added. Theirry expects to expand it and make it more usable. Personally, I really like the ability to run spell checking in an editor after I've type the text. I find real-time spell checking a bit of a pain. The interruption of spell checking throws off my train of thought. Thierry has even made the mouse implement some MicroEmacs commands. Besides moving the cursor around, using the right mouse button to drag across text, the text is highlighted and put into the "kill" buffer. The kill buffer is a temporary place to store text. The text can then be copied from the kill buffer into the current buffer (by again using the right mouse button). This is how MicroEmacs does cut & paste. Running MicroEmacs Since I've been using MicroEmacs for a while, setting it up and running it was fairly easy. I'll explain the steps here to assist someone new to MicroEmacs. The MicroEmacs zip file is fairly large. It contains the executable, the configuration file, some command file, and the source code. The whole package needs a hard disk or ED disk to unzip to. If you are proficient with unzip or have ACP, you should be able to unzip only the portions you need. It would be nice to have just a zip file of only the parts necessary to run MicroEmacs, as most people don't need the source code. The primary files needed for MicroEmacs are: emacs - The executable emacs_rc - The configuration file There are a number of command (_cmd), macro, files that are mentioned in the configuration file, but unless you these commands, they are not really necessary. In fact, you can edit the emacs_rc file to take any reference out. You should put the emacs executable in a directory for other executables (defined by PROG_USE). I'm using a RomDisq, so I put MicroEmacs in the directory ROM1_EDT_. I use the PTH device and have PROG_USE set to PTH1_ with ROM1_EDT_ stored in the PTH. I have also put the emacs_rc in ROM1_EDT_. MicroEmacs firsts checks DATA_USE then PROG_USE when searching for the emacs_rc configuration file. Since I had the file in the PROG_USE directory with DATA_USE defined to FLP1_, MicroEmacs would first look at FLP1_ for the file and then look in ROM1_EDT_. If I did not have a floppy in the drive, this would add about 5 seconds to the start up time. After some heavy hinting, Theirry added the EMACS_HOME environment variable. MicroEmacs now checks to see if this variable is set. If so, it checks the directory there for the configuration file. If not, it defaults back to it's old behavior. Now MicroEmacs comes up much faster. I quickly added : setenv "EMACS_HOME=rom1_edt_" to my BOOT file. If you unzip MicroEmacs to a floppy and execute it there, it pretty much works "right out of the box". You can then configure it all you want. The emacs_hlp file is the QDOS README file and covers all of the features of the QDOS version. Also included in the zip file is the original MicroEmacs documentation. It explains how to use and configure MicroEmacs. Expect to read a bit before attempting to really configure MicroEmacs. With power comes complexity. My Impression As a user of MicroEmacs for a number of years, this version of MicroEmacs is big jump in usability. MicroEmacs was a powerfull editor that was anywhere from kind of hard to fairly hard to use, depending on what you wanted to do. The addition of menus makes it easy to use. I have been wanting to do more with MicroEmacs macros, but found it a bit confusing to figure out how to execute them. This was due mostly to the key the "execute-file" command was bound to. It was very unobvious to me how to get it to work. A few months ago I sat down, banged my head against the wall, until it sunk in. Then Theirry came out with this version and suddenly it was so easy to just select the command I wanted from the menu. With all the new features and such, I did find that this port of MicroEmacs to be slower, in screen handling, than over versions. I have attrubited this to the overhead needed by the Pointer Environment support. It takes a few extra cycles to scan for mouse movement. When executing commands I have not noticed any slowness. If you have MicroEmacs execute a couple of commands from a macro, it's very fast. I wrote a macro to do some search and replacing, printing out some text to the message line between each search. The text flashed by on the message line so fast I could not read it. Your Impression Your opinion of MicroEmacs will depend on a number of factors. Depending on the level of complexity you like, you may find MicroEmacs harder to run than other QL editors. If you have a basic QL system (non-(Super)Gold Card), you may find MicroEmacs kind of slow, when compared to an editor like QED (which I believe was written in Assembly). I would not recommend MicroEmacs to anyone that is not willing to spend some time to learn the powerfull features. If you are comfortable with your current editor and it satisfies all your needs, then MicroEmacs may not benefit you. If you are looking for more capability from your editor, then MicroEmacs is probably something worth looking into.