``Why are we hiding from the police, daddy?''In this chapter I attempt to give you a guide to the various editors available on the SOCS system.
``They use Emacs, son, and we use vi.''
Permission is hereby granted to redistribute this work unmodified in content in either source or formatted form, so long as this copyright and the author's names are preserved.
You may also modify this work and distribute the modified work provided that:
This work is a part of SOCS Inside-Out: The Definitive Survival Guide. You may, however, also obtain it separately in different standalone formats.
During the course of your program here at SOCS, you will often find that you will need to create and edit text files1, whether to compose an email, write a program, configure an application or for any of a myriad of reasons.
Unix2 has a rich variety of editors available ranging from the minimal to the truly exotic. Here I will cover the editors pico, xedit, asWedit, JOVE, Emacs and vi.
Each editor has its own section, organized in three subsections (and possibly subsubsections):
Editor commands sometimes involve the Control key (usually labelled Ctrl or Ctl) or the Meta key. On most contemporary keyboards, the Meta key is labelled Alt.3 If you have no Meta key, you can use Esc instead.
I will use the following convenient abbreviations:
If you are panicking about which editor to choose, use this one.
Pico is an extremely simple and easy to use editor. It was written in 1989 for the email client Pine by the administrative staff of the University of Washington. Details can be obtained at the Pine Project History webpage.
At the shell prompt, type pico. Your screen should show something similar to this.
The first line on the screen is a status bar which gives you information about the pico version you are using, the file you are currently editing and whether or not there are any outstanding modifications that have yet to have been saved. The blank region following the first line is the buffer4, where you type and edit text. More importantly, take a look at the bottom 2 lines of your screen. This is a summary of the more useful keybindings. For example, note ^X Exit at the bottom-left at the screen - this means: press C-x to exit. Above ^X Exit you should also see ^G Getting Help - this means: press C-g to get help. Pico uses ^ as an abbreviation for the Control key.
Now press C-x to get back to the shell prompt. If you typed anything in the buffer, pico will prompt you to save it - simply say `no' by pressing N (again, notice the helpful menu at the bottom).
From now on I will assume that you are smart enough to understand the menu at the bottom as well as pico's prompts to you.
Type pico <filename> at the shell prompt. <filename> can be a new file or an existing file. If it is a new file, it will be created when you save it in pico. If it is an existing file, you will see the contents of the file in pico and you will be able to change and, if you wish, save them.
Example:
[lisa] [/u2/ugrad/navindra] pico letter-to-mom
An alternate method is to open or create the file from inside of pico.
To create a file simply type out the contents in the buffer, then press C-o and follow the prompts. To open an existing file press C-r followed by C-t and now use the arrow keys to select the file you wish to open. Press Enter and pico will include the contents of the file. Note that in this case, pico is really only inserting the file's contents in the current buffer so when you save the file, you will have to specify or change the filename.
Assuming you have already opened a file, simply use the arrow keys to move the cursor around in the buffer, Backspace to delete unwanted text before your cursor, C-d to delete text at your cursor and the alpha-numeric keys to insert the text you want.
For more information on what you can do, look to the bottom menu. Just about everything you can currently do in pico is listed there. When in doubt, press C-g for help or type man pico at the shell prompt.
From within pico, press C-o to save or WriteOut your changes. You will be offered the option of changing the file which is written; if you know what you are doing simply either edit it at the prompt or press C-t to choose the file, else simply press Enter to accept the default.
There is nothing advanced about this editor. It provides the bare minimum which some find to be sufficient. People have been known to complete their program at SOCS without ever using any editor other than pico - quite obviously those people have lives.
That being said, here are some tips you may find useful.
Pico is a simple editor, suitable for a novice or anyone wishing to invest only a minimum amount of time in learning an editor.
Xedit a simple text editor for X written by Chris D. Peterson of the (now defunct) MIT X Consortium.
You need to be on a machine running the X Window System (eg, one of the Linux machines) to use this editor. At the machine's shell prompt type: xedit <filename> to open an existing file, or create a new one.
You will be presented with a window such as this.
There are 3 self-explanatory buttons at the top followed by a text-field. You can Quit, Save or Load a file. You can specify the filename in the text-field.
Underneath, you will find a text-field that is 3 lines wide by default. xedit will typically output messages here. You can also use this text-field as a scratch pad.
Finally, below all this is the window where you edit your text.
xedit actually has some useful Emacs-like keybindings (Emacs is described in section 5). For more information, see the manpage (man xedit). For your convenience, I will list the keybindings here.
Key | Function | Key | Function |
Binding | Binding | ||
C-a | Beginning Of Line | M-b | Backward Word |
C-b | Backward Character | M-f | Forward Word |
C-d | Delete Next Character | M-i | Insert File |
C-e | End Of Line | M-k | Kill To End Of Paragraph |
C-f | Forward Character | M-q | Form Paragraph |
C-g | Multiply Reset | M-v | Previous Page |
C-h | Delete Previous Character | M-y | Insert Current Selection |
C-j | Newline And Indent | M-z | Scroll One Line Down |
C-k | Kill To End Of Line | M-d | Delete Next Word |
C-l | Redraw Display | M-D | Kill Word |
C-m | Newline | M-h | Delete Previous Word |
C-n | Next Line | M-H | Backward Kill Word |
C-o | Newline And Backup | M-< | Beginning Of File |
C-p | Previous Line | M-> | End Of File |
C-r | Search/Replace Backward | M-] | Forward Paragraph |
C-s | Search/Replace Forward | M-[ | Backward Paragraph |
C-t | Transpose Characters | M-Delete | Delete Previous Word |
C-u | Multiply by 4 | M-ShiftDelete | Kill Previous Word |
C-v | Next Page | M-Backspace | Delete Previous Word |
C-w | Kill Selection | M-ShiftBackspace | Kill Previous Word |
C-y | Unkill | ||
C-z | Scroll One Line Up |
This editor might look ugly, but it is pretty simple. I have never actually seen anyone seriously using this editor but it may well surpass pico in editing features.
asWedit is a funky GUI editor written by AdvaSoft. See their website at ASWedit and asWedit HTML editors for details.
At any Linux machine, type asWedit (note capitalization) at the machine's shell prompt. This should bring up a nice GUI window with menu and tool bars. You can find out how to create a new file, to open an existing file or to save a file all from the File menu.
For more information on asWedit see the Help menu.
asWedit is also an HTML editor. For more information, please see the editor's internal documentation.
This editor was mentioned purely for your benefit. Although there was no serious coverage of it, anyone familiar with Windows-type applications is sure to be at home.
The first Emacs was born in 1975 at MIT as a set of macros written for the editor TECO5 under ITS6 on a PDP-10 machine. It was written by Richard Matthew Stallman (RMS). RMS went on to write the now widely popular GNU Emacs as part of the GNU project.
There are three levels at which you can use Emacs depending on your level of illumination.
At the shell prompt, type emacs.78 Your screen should show something similar to this. If you are on a machine running the X Window System, a window will pop up with features similar to those in the previous screenshot.9
The first line on the screen is the menubar (you may not have this if you are using an older version of Emacs or if you are running XEmacs in a terminal window). Novice Emacs users will definitely find it easier to use the menubar at first. Seasoned Emacs users, however, will most likely have no use for this menubar - they will probably turn it off or ignore it and use the keybindings for the relevant functions instead. Anyway, to access this menubar either press the F10 key or M-` or use the mouse if Emacs is running under X. From there, follow the interactive cues and instructions on how to proceed.
From now on, I will assume that you are competent enough to use and understand the menu. Note that although many common functions can be done through the menu, I will not always mention this since you can easily figure it out for yourself.
The region below the menubar displays the contents of the buffer and is where the editing takes place. Emacs can actually have several such regions visible at once but for now you have just one.
The line before the last on the screen is the modeline. This line gives useful information about the status of Emacs and the text you are editing.
The final line is the echo area. Emacs echos your commands here (if you type them too slowly or you pause) and also gives you interactive prompts and information here.
You might have noticed that the buffer is currently advertising the Emacs tutorial. Yes, Emacs is self-documenting so feel free to stop here and go through the tutorial! To find out about other sources of help in Emacs, press F1 ? or C-h ?. In particular, you might also want to refer to the Info documentation for Emacs. You can access this with F1 i or C-h i. A lot of the Info documentation is also available in HTML format, check the Emacs and XEmacs websites.
From the menu, choose Files and then Exit Emacs. Alternately, simply press the C-x C-c key sequence.
If you find yourself in the middle of an Emacs command or key sequence (ie. your cursor is currently in the echo area or the echo area shows that it is waiting for you), you can abort by pressing C-g once or several times. You can also use C-g to stop a command that is taking too long.
From the shell prompt, type emacs <filename>. <filename> can be a new file or an existing file. If it is a new file, it will be created when you save it. If it is an existing file, you will see the contents of the file in Emacs and you will be able to edit it and, if you wish, save the changes.
Example:
[lisa] [/u2/ugrad/navindra] emacs -q letter-to-mom
From inside Emacs, you must find or visit the file. From the menu choose Files followed by Open File or simply press the C-x C-f key sequence. In both cases you will be presented with a prompt in the echo area. Either type in the filename (or, you may type in . to open up the current directory in dired) if you know it or wish to create a new file, or press Tab one or more times to see a list of completions for the part of the filename you have already typed in (if any). Tab will cause Emacs to complete the filename if only one alternative exists or else it will present you with the alternatives.
There are other ways of opening a file including use of the powerful dired mode. Press C-x d and hit Enter. Emacs will present you with a list of files. Use the arrow keys and Enter to select the desired file.
Assuming you have already opened a file, simply use the arrow keys to move the cursor around in the buffer, Delete to delete unwanted text before your cursor10, C-d to delete text at your cursor and the alpha-numeric keys to insert the text you want.
Here I must mention that seasoned Emacs users generally do not use arrow keys to move around in Emacs. Instead, they use various Emacs key bindings. This is nicer for the touch typist because it means you do not have to move your hands from the home row of the keyboard.
A few relevant navigational key bindings are:
Key | Function | Key | Function |
Binding | Binding | ||
C-b | backward-char (left arrow) | M-b | backward-word |
C-f | forward-char (right arrow) | M-f | forward-word |
C-n | next-line (down arrow) | M-> | end-of-buffer |
C-p | previous-line (up arrow) | M-< | beginning-of-buffer |
C-a | beginning-of-line | M-a | backward-sentence |
C-e | end-of-line | M-e | forward-sentence |
C-v | scroll-up | M-v | scroll-down |
There are many more useful functions and features for editing text including the kill/yank functions (similar to cut and paste), unlimited undo and the search/replace functions. I will not cover these because there is really no point when Emacs already has a perfectly good tutorial built into it. I strongly recommend that you take the time to go through this tutorial and familiarize yourself even more with Emacs. It will probably take you 1 or 2 hours but will be worth it in the end. You should learn about buffers and how to manage them amongst other things. To get to the tutorial, press F1 t or C-h t or even M-x help-with-tutorial (see section 5.2.1 for more information on the last form).
To save the file you are currently editing, use the menu or press C-x C-s (or C-x s if you wish to be prompted before Emacs does anything). To save the file with a different name, press C-x C-w and enter the new filename (or press Enter to save under the current name).
Emacs is a real-time display editor that can be extended by the user while it is running. The basic core is a Lisp interpreter implemented in C, with all other functionality implemented in Lisp on top of this interpreter. This has profound consequences: not only does it mean the user can add new editing commands or change old ones by adding or replacing functions, it also implies that Emacs is, by no means, limited to editing. For more information on Emacs' extensibility, I refer you to Richard M. Stallman's old but excellent AI Memo 519a EMACS The Extensible, Customizable Self-Documenting Display Editor.
This extensibility has led to a large number of useful Emacs functions, modes and applications written by free software developers the world over. Emacs is bundled with a large number of these goodies, and XEmacs has even more. Others can be found on the Internet.11
Interactive functions (also known as commands) can be invoked by M-x function. Often-used commands are usually bound to key sequences for convenience. Conversely, all bound key sequences in Emacs invoke a command. You can add, modify or remove keybindings at your leisure.
An example command is forward-char. It can be invoked with M-x forward-char12 or any of its default keybindings such as C-f or the arrow key.
You can find out all the keybindings in the current buffer, what command a key sequence will invoke, and more, from within Emacs. See M-x help-for-help or the other Emacs documentation for more information.
There are some functions, such as buffer-name, which you cannot invoke with the M-x syntax and nor can you bind them to a key sequence. You can, however, evaluate these functions in the Lisp interpreter or use them in your own Lisp programs. I will not describe any of this here.
To write your own functions, it helps to be familiar with a Lisp language. The excellent13 308-302 course covers Scheme, a simple Lisp. This course is more than enough to give you a kickstart into Emacs Lisp programming. Other sources of information include the Info documentation, various websites such as Programming in Emacs Lisp or Emacs Lisp Introduction, or even the Emacs source code!
A proper Emacs installation usually includes all the elisp code for the various modes and functions. This is an invaluable resource to the Elisp programmer. The location of the source code is rather system dependent but if you look around long enough you will find it all.14 A handy command included in XEmacs and possibly the latest Emacs, is find-function. This command will find and display the source code for any non-primitive Emacs function.
You can experiment with function-writing in the *scratch* buffer which is in Lisp Interaction mode by default. You may also put permanent functions in your .emacs file (section 5.2.3) or any other file you wish, although, by convention, Emacs Lisp files have .el as the extension. You can load the functions you have saved in a file with the load-file command.
Emacs has many different major modes, each of which customizes Emacs for editing text of a particular sort. There are major modes for plain text, Lisp, C, C++, Java, Pascal, LATEX, HTML and so on. Major modes are mutually exclusive; at any time, each buffer has one major mode. You can, however, use several minor modes at a time.
One notable mode is the Fundamental mode. This mode has no mode-specific redefinitions or variable settings. Each Emacs command behaves in its most general manner and each option in its default state.
Modes make your life significantly easier. For example, the major mode java-mode along with the minor mode font-lock-mode will display Java code with different colours and fonts for different syntactic elements of the code (see the XEmacs screenshot), auto-indent the code as you write and sometimes give you cues when code is syntactically wrong. Many functions and commands are also provided that allow you to perform powerful operations on your code.
You will find modes for just about anything under the sun. If the mode is not bundled with the current version of Emacs, and the language has been out there for any length of time at all, chances are someone has already written a relevant mode and published it on the Internet.
To learn more about major modes, see the node Major Modes in the Emacs Info documentation.
There are also application-type programs written for Emacs. You can find miscellaneous games (including a graphical tetris), calendars, mail readers, news readers, web browsers and even IRC clients written in elisp.
Later versions of Emacs and XEmacs allow you to customize them through a funky point-and-click interface. Type M-x customize to invoke this interface. customize is fine to a point - it is nicely organized, great for such things as visually selecting fonts and colours, changing options from their default values and finding things that can be customized.
Traditionally, Emacs has been customized by editing the .emacs file in the user's home directory. Some people maintain this is still the best way to customize Emacs. However, due to the nice design of customize, nothing is lost with newer versions of Emacs. You can use customize, while retaining the full power of manual .emacs customization.
You would edit .emacs to, amongst other things, set global and local keybindings, change global, mode-local and buffer-local defaults, load extra emacs code, modify functions to change emacs behavior, and write your own handy functions. I should point out that you can very well edit your .emacs without fully understanding elisp, although if things go wrong you might need to seek the help of an Emacs guru.
Useful commands in your .emacs customization quest include describe-mode, apropos, describe-variable, describe-function, find-function. You should read the Emacs documentation or mode specific documentation if you wish to learn more.
Finally, it is very inspiring to look at other people's .emacs files. On the SOCS system, public readable .emacs files include: ~navindra/.emacs, ~jetset/.emacs, ~wheelan/.emacs (Bill Heelan notes that his .emacs on the SOCS system has not necessarily been maintained. However, I believe you can still learn a lot from this file.), ~lucb/.emacs and ~kent/.emacs amongst others. Please note that it is politically correct to properly attribute any significant amount of code you may choose to borrow from these files. Alternately, please obtain the author's permission.
XEmacs, formerly known as Lucid Emacs, is a direct descendent of an alpha version of Emacs 19. The split occurred because of political differences between free software developers.
XEmacs has some extra features not yet contained in stock Emacs.15 Amongst these are toolbar-support, colour support in terminal mode, inbuffer image support (nice for Gnus, W3, tetris or just for browsing pictures), rather remarkable client/server support and the fact that it is bundled with a larger number of Emacs packages. XEmacs also looks nicer.
Emacs also has a few advantages over XEmacs which include being less bloated and more widely distributed.
To learn more about XEmacs and Emacs, check the XEmacs site.
(global-set-key [(control h)] 'backward-delete-char)
Note that C-h will no longer work as help, although you should still be able to use the F1 key.
To make the Delete key delete the character under the cursor, try this:
(global-set-key [delete] 'delete-char)
This last is not guaranteed to work on a terminal but it should work under X.
The Emacs distribution contains a large amount of information. You are encouraged to find and browse the installation tree.
A few of the countless websites that cover Emacs are:
On Usenet, Emacs people hangout on comp.emacs, comp.emacs.xemacs, gnu.emacs.help, gnu.emacs.sources, alt.religion.emacs and the other gnu.emacs.* newsgroups.
This is a remarkable editor and its various characteristics such as extensibility, customizability and innumerous bundled packages are particularly appealing to the programmer.
JOVE stands for Jonathan's Own Version of Emacs and was written by Jonathan Payne. JOVE is very lightweight and starts up faster than Emacs, making it a very popular editor on the SOCS system. JOVE can be customized but does not include an extension language such as Emacs Lisp.
To launch JOVE, simply type jove or jove <filename>.
Most of the Editor Basics described in the Emacs section (section 5.1) as well as the keybindings listed in the xedit advanced section (section 3.2) also apply to JOVE, hence there is no need to redescribe them.
You also want to go through the JOVE tutorial. At the shell prompt, type teachjove.
I must mention that you will probably encounter problems with C-s in JOVE. This is because C-s is bound to STOP-TERMINAL by default on most Unix systems and JOVE does not override this setting. Hence if you press C-s while in JOVE, you screen will seem to freeze. Simple press C-q to unfreeze it. A way around this problem is to type stty stop none from the command prompt17 or to simply avoid C-s in JOVE.
You should read the JOVE manpage (man jove) to find out about the JOVE initialization file, .joverc, and the commands such as auto-execute-command, set, bind-to-key, etc.
You might also want to take a look at other people's .joverc files. Publically readable .joverc files on the SOCS system include ~wheelan/.joverc (courtesy Bill Heelan) and ~lucb/.joverc (courtesy Luc Boulianne). Again, let me remind you that you should properly attribute any code you may borrow from these files or, obtain the author's blessings.
JOVE can be obtained at the FTP site. All JOVE announcements are posted to the comp.editors newsgroup.
If you like Emacs but are looking for something more lightweight, this is the editor for you.
In 1976, Bill Joy took the sources of the two line editors ed and ex, and created vi. Vi soon attracted a large following and has since evolved into many different versions for many platforms. The basic concepts of vi have, however, remained unchanged.
Sooner or later you will meet vi simply because it is the editor that is on every Unix system and it is one of the most versatile. Vi also tends to be the default Unix editor.18 With over 200 useful commands, vi may at first sound rather frightening to the beginner but the few introduced here will give you the basics for quick, efficient editing.
vi is launched like just about every other editor so far: From the shell prompt type vi or vi <filename>.19 This is where the similarity ends.
I recommend that you now find a dispensable text file and open it up in vi for experimenting.
Before continuing, you must understand that there are two modes in which you use vi:
You can use the arrow keys to move around in command mode. As you might have anticipated however, seasoned vi users do not use the arrow keys but rather the more ergonomic hjkl keys situated on the home row. Seasoned vi users also know how to jump to or modify efficiently the parts of the text they are interested in.
I encourage you to experiment with the following commands to move around in text. Commands are case-sensitive, for example, a does not mean the same thing as A.
Command | Action |
h | Move left 1 character (left arrow). |
j | Move down 1 line (down arrow). |
k | Move up 1 line (up arrow). |
l | Move right 1 line (right arrow). |
b | Move back to beginning of word. |
e | Move forward to end of word. |
w | Move forward to beginning of next word. |
^ | Go to first non-whitespace character of line. |
0 | Go to beginning of line. |
$ | Go to end of line. |
| |
C-f | Scroll forward one screen. |
C-b | Scroll backward one screen. |
C-d | Scroll down 1/2 screen. |
C-u | Scroll up 1/2 screen. |
1G | Goto start of buffer. |
G | Goto end of buffer. |
vi is a display-oriented text editor based on the underlying line editor ex. This means you can also give ex commands to vi. To enter an ex command, type : in command mode. You might now type set showmode followed by Enter. This tells vi to display the mode on the status line. To make this the default setting, you need to edit the .exrc file (section 7.2.2).
Try experimenting with the following insert commands. Remember that you can use Esc to switch back to command mode.
Command | Action |
a | Append text after the cursor. |
i | Insert text before the cursor. |
A | Append text at the end of the current line. |
I | Insert text at the start of the current line. |
o | Open a new line below the current line. |
O | Open a new line above the current line. |
I encourage you to play around further with the command and insert modes to ensure you properly understand these concepts. If you are still uncomfortable, then I recommend you read the VI Introductory Guide.
To abort vi without saving any of your changes, switch to command mode and type :quit! or :q!. : tells vi to use the ex interface, and ! specifies that vi should discard any modifications.
You already know how to open a file from the command line prompt. When in vi, you can type :vi <filename> to do the same. As always, <filename> may refer to a new or existing file. If the current buffer contains unsaved modifications, vi may refuse to open the new file. You must either save (section 7.1.5) the changes or force vi to discard them with :vi! <filename>.
You already know how to move around in the buffer and how to enter new text. The only major thing left to explain is how to delete text. In command mode, use the following commands.
Command | Action |
x | Delete character. |
dw | Delete word. |
d$ | Delete rest of line. |
D | Delete rest of line. |
dd | Delete line. |
There are of course many other useful editing commands and features in vi. As with the Emacs section, I will not cover these. For more information on (amongst others) numeric arguments, search/replace, undo and copy/paste commands, I recommend the VI Editor Reference Manual.
Use the the following commands:
Command | Action |
:w | Write file. |
:w <filename> | Write to <filename>. |
:w! <filename | Overwrite <filename>. |
:wq | Write and quit. |
ZZ | Write and quit. |
A few of the more useful vi commands you should know of are listed below.
Command | Action |
J | Join lines. |
:s | Substitute on lines matching a regular expression. |
This is a very powerful command and I highly | |
recommend that you read up on it. | |
! | Filter through command(s). You can perform many |
powerful operations with this command and the help of | |
external programs. | |
:r! <command> | Insert the output of a shell command in the buffer. |
. | Repeat last command. |
You can customize vi by editing the .exrc file in your home directory. VIM users should put any VIM-specific customizations in .vimrc and source the .exrc if necessary.
As you might have guessed, you can put any ex command in the .exrc. You do not need to specify the :, it is assumed. There are three main kinds of customizations that can be defined in the .exrc:
As another example, consider :map K {!}fmt This means, map K to {!}fmt which can be broken down to:
Or, in other words, pipe the current paragraph to the external command fmt and replace the current paragraph with the output of this command. Try running this macro on paragraphs with overly long lines in order to see the effect.
Clearly, the combination of map and the multitude of useful vi commands allow for very powerful operations. There are various packages for vi and VIM which implement macros for a range of operations from writing HTML to editing a file over ftp. A search on the Internet should reveal a gold mine of useful macros.
VIM supports different variations of the above mentioned commands, it is up to you to read up on them. On top of this, VIM also supports several other elaborate commands including if-then control structures.
Here are some illuminating .exrc and .vimrc files. Please note that these files may contain non-text characters so be sure to properly download the file. As always, remember that it is politically correct to properly attribute the author of any code you may choose to borrow.
VIM is Vi IMproved and has many advantages over standard vi. VIM has been described by some as the Emacs of Vi's. You might want to refer to VIM - Why? for a list of VIM features which include, comprehensive internal documentation, completion, multi-undo, multi-buffer, split-screen and scripting support.
VIM also has a lot of support for programming, such as, macros for compiling and locating compilation errors, auto-indentation features and more.
Also of interest is the fact that VIM supports colours and can optionally provide a Graphical User Interface. See gvim.gif and VIM Pictures for some screenshots.
There are many other clones of vi that may be of interest. These include nvi, elvis and viper-mode (vi-emulation mode in Emacs). For a list of these, see All about VI and its clones.
There is a multitude of information on Vi on the World Wide Web. Some notable websites are:
On Usenet, vi people usually hangout on the comp.editors newsgroup.
I hope I have been able to convey to you the compelling reasons for learning vi. Vi is one of the most powerful and versatile editors with an abundance of features such as macros, and filter and scripting support. On top of this, vi is available on just about every Unix installation, and is very lightweight.
I have attempted to give a fair introduction to the various editors available on the SOCS system. Each editor has its own set of advantages and disadvantages, and in the end it is up to you to weigh your needs and choose what is best for you. Despite popular belief, editors are a means to an end, not a religion.
And, finally, if you have any suggestions on how this article could be
improved, please do not hesitate to
email
me.
I would like to thank the following people:
Material in this article has been taken from or inspired by the following sources:
1 A file is a collection of letters, numbers and special characters: it may be a program, a database, a dissertation, a reading list, a simple letter etc.
2 Since UNIX is actually a trademark, I will use Unix (note capitalization) to refer to UNIX-like OSes such as Linux, Solaris and FreeBSD.
3 So why call it Meta then? Presumably, keyboards once actually did have a key labelled Meta. If you wish to find out more, try asking about it on comp.emacs or alt.religion.emacs.
4 A buffer is a temporary area in memory where a copy of the file contents are stored. Any changes you make here will not affect the file on the disk until you instruct the editor to save the changes.
5 TECO: Text Editor and COrrector, originally Tape Editor and COrrector
6 ITS: Incompatible Time-sharing System
7 Advanced: You can use the -q option for the moment in order to get around some crud the sysadmins have found necessary to enforce on everyone by default. Amongst other disagreeable things, the system default disables C-z as suspend. If you are curious as to why this was done, the reasons are mostly historical and do not really concern anyone except the older folks using the system. -q will tell Emacs not to load any init files but you can also use the -l <filename> option in conjunction in order to load your personal customizations.
8 If you are lucky, XEmacs (section 5.2.4) will now be available on the system. To run XEmacs instead of Emacs, type xemacs.
9 If you do not want this window, invoke Emacs with the -nw option.
10 One of the most irritating stupidities of Emacs is that the Backspace key does not work as expected by default. It invokes help (you can press C-g to abort it). I mention ways around this in the Advanced section (section 5.2.5).
11 For example, see the Emacs Lisp Repository or gnu.emacs.sources.
12 Note that you can use TAB to help you complete the command. Try typing M-x foTAB and you will find Emacs will either fill in the rest of the command or present you with a list of the different possible alternatives.
13 Personally, I took this course when Prakash Panangaden was teaching it. Please check the course webpage and the standard sources for the most up to date information on the course.
14 You may want to start your search at /usr/local/pkgs/ or /usr/local/pkgs/gnu/. Look for the Emacs or XEmacs subdirectories and find the files with extension .el.
15 I should note here that Emacs 20.3 was recently announced and probably contains features that the current XEmacs 20.4 does not.
16 Especially those of us without overly-large hands.
17 You could of course put this command in your shell's start-up file so that you do not have to type it every time.
18 See the environment variables EDITOR and VISUAL.
19 If you are lucky, VIM will be available (section 7.2.3). Type vim or vim <filename> instead to use it.