# emacs

* Prior to starting this demonstration, you should set up your unix directory according to the instructions in [Unix utilities](http://rous.mit.edu/index.php/Unix_utilities)
* [emacs](http://en.wikipedia.org/wiki/GNU_Emacs) is a powerful text editor with extensive functionality.

\
1\) Control mode is activated by pressing and holding the \<ctrl> key while pressing the second key. This process is written as:

C-key

This example shows the result after C-s (search):

[![Ctrls.jpg](http://rous.mit.edu/images/1/1e/Ctrls.jpg)](http://rous.mit.edu/index.php/File:Ctrls.jpg)

2\) Meta-mode is activated by pressing and releasing the \<ESC> key followed by some other key that activates a sub-menu of commands. This process is written as:

ESC option

This example is what appears after entering ESC x (activate execute-extended-command menu)

[![Meta.jpg](http://rous.mit.edu/images/6/62/Meta.jpg)](http://rous.mit.edu/index.php/File:Meta.jpg)

***

* check to see that you are in the IAP\_2010 directory unix by entering the command:

```
pwd
```

* the result should be (where USERNAME is your own unix username)

/home/USERNAME/IAP\_2010/unix

* If it is not, you can change to that directory by executing:

```
cd /home/USERNAME/IAP_2010/unix
```

* create a copy of the file replace.txt with:

```
cp replace.txt replace2.txt
```

* Begin editing replace2.txt with:

```
emacs replace2.txt
```

* Note, on new accounts a splash screen welcomes you to emacs use C-l to exit the screen and proceed to editing.
* Insert text by regular typing.
* Delete letters with C-d
* Delete lines with C-k
* Find and replace text with ESC x , then type replace-string on M-x line. enter search string, then return, then replacement text.
* Move to the end of the document with ESC >
* Move back to the start of the document with ESC <
* Play tetris with ESC x, tetris
* Save and exit with C-x followed by C-c then answer prompts if changes were made.
* To turn off the splash welcome screen, edit a file called .emacs to have the contents:

```
(setq inhibit-splash-screen t)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://igb.mit.edu/mini-courses/introduction-to-unix-and-ki-computational-resources/basic-unix/unix-text-editors/emacs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
