Emacs Tips

From the emacs built in tutorial1)

Emacs commands generally involve the CONTROL key (sometimes labeled
CTRL or CTL) or the META key (sometimes labeled EDIT or ALT).  Rather than
write that in full each time, we'll use the following abbreviations:

 C-<chr>  means hold the CONTROL key while typing the character <chr>
          Thus, C-f would be: hold the CONTROL key and type f.
 M-<chr>  means hold the META or EDIT or ALT key down while typing <chr>.
          If there is no META, EDIT or ALT key, instead press and release the
          ESC key and then type <chr>.  We write <ESC> for the ESC key.

On our system the META key is generally on both the ``Esc`` and the Left ``Alt``.

To enable syntax highlighting in emacs an a per session basis, in emacs enter:

M-x global-font-lock-mode

To make it always so, add the line:

(global-font-lock-mode 1)

To your ~/.emacs file. If you don't have a file in your home directory named .emacs just create one and put this line in it. The next time you start emacs you will get this feature.

At some point it became apparent that students were under the impression that C-z was how to exit emacs. They were using this shortcut and logging out which exposed a bug in Emacs that would take all available memory and crash that system. C-z has since been mapped to display a message telling you the proper way to exit emacs (C-x C-c).

If however you do actually use the suspend feature of emacs and want it back, add the following to your ~/.emacs file:

(global-set-key (kbd "C-z") 'suspend-emacs)

Pressing C-z will suspend emacs giving you a job_spec of the stopped job. You can bring emacs back with the fg command followed by that job_spec.


the tutorial is available in emacs with C-h t