Emacs

From Coder Merlin
Revision as of 21:24, 22 April 2021 by Yong-yan (talk | contribs)
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Prerequisites[edit]

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".

CautionWarnIcon.png
Do not skip this tutorial or skimp on your effort. Learning emacs is essential to doing well and every minute that you invest in learning emacs will pay off a hundred fold.

The Tutorial[edit]

Log on to the server and start emacs:

john-williams@codermerlin:~$  emacs

emacs will start. Read the startup screen closely. It's important to learn to read messages thoroughly; don't skim, read. A careful reading will tell you exactly what you need to do to start the tutorial.

A helpful emacs key reference is available here: Emacs Keys

Hint.pngHelpful Hint

Remember that on the wiki key combinations are displayed as two adjacent keyboard keys, separated by a hyphen. Within the emacs tutorial, a different method is used.

On the Wiki Within emacs Tutorial
CONTROL-h C-h
ALT-x M-x


Hint.pngHelpful Hint

As you work through the tutorial nearly all keys will behave exactly as described, with one notable exception. The tutorial describes the undo command as CONTROL-/. However, for reasons related to the manner in which terminal emulators operate, this key sequence will (probably) not work. The alternative sequence, CONTROL-SHIFT-_ will work. Another alternative, though a bit more cumbersome, is CONTROL-x u.

Temporary Files[edit]

Emacs creates two types of files for your benefit, automatically.

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 it may safely be deleted (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) your file can still be recovered. The auto-save file is named the same as your original file but with a leading and trailing number sign (#). In the event of a crash, the file may be recovered by opening your original file and then executing ALT-x recover-file. Emacs will notify you if it detects a file in this state. In general, emacs will automatically delete these files when it cleanly exits.

Emacs for Essays[edit]

ComingSoonIcon.png
Coming Soon
  • Setting fill column
  • Setting auto fill
  • Don't use carriage-returns within a paragraph
  • Use two carriage-returns between paragraphs
  • Spell check
  • Word count
  • Tagging

Exercises[edit]

Template:W1004-Exercises

Excursions[edit]

Excursions101 138 Boeheimkirchen 070430.jpg
  • 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)