Emacs is a very powerful Text Editor that is used by many "old timers" as an IDE (Integrated Development Environment). In other words, people edit, compile, and test their C programs using Emacs.


Emacs, at its very least, is a text editor. Additionally, it is a programming environment, a debugging environment, a directory lister, a file creator, a news reader, an email program, an adventure game, etc.

Emacs contains its own programming language (E-lisp), that allows you to upgrade and add functionality to the editor, even as you type into it.

Emacs is not for the faint of heart, and has a steep learning curve, but is expandable to allow you to become the best programmer you can. There are other IDEs for developing code (we have seen Matlab's). Some are flashier, some are better for specific tasks, but few are even close to the power and flexibility of the EMACS system.

Emacs is free. Emacs is wonderful. Emacs is open source.

Emacs has a large number of "shortcut" keys which take memorization. Most of the shortcuts are listed in the pull down menus, but the best typers/programmers learn the shortcut keys.

Buffers and Windows

Emacs will let you open several "buffers" at a time. Each buffer will contain a file (or some other Emacs resource, like a directory listing).

Emacs Short Cut Keys

One of the greatest powers of Emacs, is that all of the operations you can do using the pull down menus are also assigned "Short Cut" keys. The more short cuts you remember, the more productive your programming time can be.

Below are a list of shortcuts. Note, almost all the short cuts have standard ways (non shortcut versions). For example, the arrow keys work as well as Cntl-n,p,b,f.

Editing a file in Emacs.

C-n      (Control n) next line 
C-p      (Control p) previous line 
C-b      (Control b) back one character 
C-f      (Control f) forward one character 

C-x C-s  (Control x, followed by Control s) - Save Current File 
C-x C-c  (Control x, followed by Control c) - Exit Emacs  

M-x describe-bindings       (show all the keys and there control sequence)

C-x 1  (Control x, followed by 1) - Un-split windows 
C-x 2  (Control x, followed by 2) - Split windows vertically 
C-x 3  (Control x, followed by 3) - Split windows horizontally 

M-x compile     (allows you to compile in emacs) 
C-x `		(go to next error (after compiling in emacs))

Compiling a program inside of emacs.

To compile a program in Emacs, type Escape followed by x followed by compile, or use the pull down "tool" menu and select compile.

On the emacs command line (the extra line at the bottom of the emacs window) you will see:

Compile command: make -k        

Delete the make -k and replace it with:

Compile command: g++ -g -pedantic -Wall -o name_of_the_executable source_file.C

Hit the enter key

Back to Topics List