Emacs
Curriculum[edit]
![]() |
Coder Merlin™ Computer Science Curriculum Data |
Unit: Lab basics Experience Name: Emacs (W1004) Next Experience: HTML (W1004.50) Knowledge and skills:
Topic areas: Emacs Classroom time (average): 45 minutes Study time (average): 240 minutes Successful completion requires knowledge: understanding that documents are preserved in files; understanding the difference between document files and temporary files Successful completion requires skills: starting, stopping, and suspending emacs; creating a new file, opening an existing file, saving modifications to a file; navigating forward and backward through a file by character, word, sentence, and line; navigating to the start and end of the document; searching for text incrementally (forwards and backwards); marking a region of text and cutting, copying, and pasting text |
Background[edit]
Emacs is a powerful text editor and environment that we'll be using heavily throughout our experiences. You can read more about emacs in this guided tour emacs tour, but the best way to learn emacs is just by jumping in to the tutorial. Be very, very thorough! However, you may safely skip the sections titled "Multiple Frames" and "Disabled Commands."

Note: If you do not see an X tweet below by Cameron Pittman, it could be because some schools block X/Twitter.}}
Finally took the time to learn <a href="https://twitter.com/emacs?ref_src=twsrc%5Etfw">@emacs</a> recently and holy guacamole I'm HOOKED! Today while taking notes in org mode, I trained a neural network with <a href="https://twitter.com/JuliaLanguage?ref_src=twsrc%5Etfw">@JuliaLanguage</a>, wrote LaTeX, linked to papers from my bibtex library, AND ALL OF IT HAPPENED INLINE! WHAT IS THIS SORCERY??? <a href="https://t.co/dbvW1PKGVj">pic.twitter.com/dbvW1PKGVj</a>
— Cameron Pittman (@cwpittman) <a href="https://twitter.com/cwpittman/status/1304210984081469441?ref_src=twsrc%5Etfw">September 11, 2020</a>
The Tutorial[edit]
Log on to the server and start emacs:
john-williams@codermerlin:~$ emacs
Emacs starts up. Read the startup screen closely. It's important to learn to read messages thoroughly; don't skim, read. A careful reading tells you exactly what you need to do to start the tutorial.
A helpful emacs key reference is available here: Emacs Keys

Remember that on the wiki key, combinations are displayed as two adjacent keyboard keys, separated by a hyphen. In the emacs tutorial, a different method is used.
On the Wiki | Within emacs Tutorial |
---|---|
CONTROL-h | C-h |
ALT-x | M-x |
As you work through the tutorial, nearly all keys behave exactly as described here, with one notable exception. The tutorial describes the undo command as CONTROL-/. However, for reasons related to the manner in which terminal emulators operate, that key sequence will (probably) not work. The alternative sequence, CONTROL-SHIFT-_ does work. Another alternative, although a bit more cumbersome, is CONTROL-x u.
Temporary Files[edit]
Emacs creates two types of files for your benefit, automatically: backup and auto-save.
Backup Files[edit]
Backup files are created automatically whenever you save a file. This enables you to easily go back to an older version if necessary. The backup file is named the same as your original file but with a tilde (~) as a suffix. If you're certain that you don't need the backup file, you may safely delete it (though it's probably better to simply ignore it).
Auto-Save Files[edit]
Emacs automatically saves your files periodically, so in case of an unexpected event (e.g., emacs crashes), you can still recover your file. The auto-save file is named the same as your original file but with a leading and trailing number sign (#). If a crash occurs, you can recover the file by opening your original file and then executing ALT-x recover-file. Emacs notifies you if it detects a file in this state. In general, emacs automatically deletes these files when it cleanly exits.
How to Perform Common Tasks[edit]
- How to Copy from One File to Another
- How to Replace a String
- Version Control
- Power User Tips
- Emacs-Enable Mouse Mode
Emacs for Essays[edit]
![]() |
Coming Soon |
|
Exercises[edit]

After completing W1008:
- M1004-10 Complete Merlin Mission Manager Mission M1004-10.
Excursions[edit]

- Using emacs navigation commands (including CONTROL-U), produce an ASCII art image at least forty characters wide and twenty-four characters high. Save your image to a file at the path ~/Experiences/W1004/art.txt.
- Repeat the above process adding several new images below the first to form a vertical comic strip.
- References: ASCII art (Wikipedia)
Experience Metadata
Experience ID | W1004 |
---|---|
Next experience ID | W1004.50 |
Unit | Lab basics |
Knowledge and skills | §10.121 §10.212 |
Topic areas | Emacs |
Classroom time | 45 minutes |
Study time | 4 hours240 minutes <br /> |
Acquired knowledge | understanding that documents are preserved in files understanding the difference between document files and temporary files |
Acquired skill | starting, stopping, and suspending emacs creating a new file, opening an existing file, saving modifications to a file navigating forward and backward through a file by character, word, sentence, and line navigating to the start and end of the document searching for text incrementally (forwards and backwards) marking a region of text and cutting, copying, and pasting text |
Additional categories |