------------------------------------------------------------------------------
MC logo
Using Emacs on Sandbox
[^] CSc 422 Assignment 1
------------------------------------------------------------------------------
[CSc 422 Assignment 1] [CSc 422 Assignment 2] [CSc 422 Assignment 3] [CSc 422 Assignment 4]
[Get Some Unix] [Using Emacs on Sandbox]
If you would like to edit directly on Sandbox through putty, you might want to use the emacs editor. If you do, I would recommend running the local command emacscust, and tell it yes. It makes some customizations to your emacs by adding some lines to its configuration file, .emacs. You only need to do this once.

You can Google up any number of emacs tutorials, which you might find useful. Commands are generally using the keyboard, but one of the recommended customizations enables the mouse through putty, so you can use it to move around the file, and you can scroll with the scroll wheel. To begin editing, just give the command

emacs filename
that will bring up the emacs window and display the file contents.

Regular (printable) characters are just added to the file at the cursor. Commands are given using control or escape character sequences. Here are some useful commands, a few of which depend on the above customizations. The notation ^ means hold down the control key while typing. ESC refers to the escape key. You can press the ESC key as shown, or you can instead hold down the ALT key while typing the character that follows.

arrow keys, ^f, ^b, ^n, ^pUse the arrows to move around, or the four control codes which stand for forward, back, next, or previous.
Page Up, Page Down, ESC v, ^vThese scroll a page of text up or down
Delete, ^d, backspace, ^hThese delete the next or previous character.
ESC d, ESC backspaceDelete the next or previous word.
^kDelete (kill) the rest of the current line.
^sSearch for a string.
^x^sSave your modifications back to the same file.
^x^wWrite to a file (emacs will ask for a file name).
^x^eExecute a compile command. Emacs will ask what command to run, which defaults to make, but can be changed. It will remember what you change it to the next time you compile.
^x^nMove to the next compile error.
^x^vOpen another file for editing.
^xoSwitch to some other subwindow. Some commands divide the screen into multiple windows (inside emacs, not new windows on your GUI). Compiling, for instance, opens a window for messages. This command allows you to switch the cursor between them. You can also use the mouse.
^xdDelete the current subwindow.
^gCancel whatever you started (but haven't finished).
^xuUndo
^x^cExit emacs. If you have unsaved edits, emacs will offer to save them for you.