How to Use Emacs

How to Use Emacs


To run emacs, just type
   emacs
or
   emacs filename
where filename is the file you want to edit. You may also launch your favorite version of emacs shell (e.g. Aquamacs on OS X).

The simplest commands:

Use the arrow keys to move the cursor

C-x C-f         open a new file
C-x C-s         save the current file
C-x C-c         exit the emacs (but save files first)
Here, the prefix C- refers to the CONTROL key. For example, C-x means to simultaneously press the CONTROL key and the "x" key.


Key Bindings (that I use)

In the following, the prefix C- refers to the CONTROL key, the prefix M- refers to the META key (usually Alt-). For example, C-n means to simultaneously press the CONTROL key and the key "n".

Text:
C-k             kill the current line
C-space         set a region mark
C-w             kill-region (between cursor and mark)
M-w             memorize the contents of the region (without kill)
C-y             yank (i.e., insert text last killed or memorize)
C-_             undo

Search:
C-s 		isearch-forward 
C-r 		isearch-backward 

Files:
C-x C-f		find-file 
C-x C-r 	find-file-read-only     
C-x C-s		save-current-file

Buffers (i.e., windows):
C-x 1		remove-other-windows 
C-x 2		split-window

Misc:
C-x o		move the cursor to the other window
C-x b		switch to a different buffer    
C-x C-c		save-buffers-kill-emacs 

Running Macaulay2 (M2)

To run M2 in emacs push F12.
To execute the current line or selection in the M2 window push F11.