Differences

This shows you the differences between two versions of the page.

Link to this comparison view

help:general_linux:emacs_tips [2015/08/27 10:16] (current)
Line 1: Line 1:
 +====== Emacs Tips ======
  
 +
 +
 +
 +
 +
 +===== Emacs Command Shorthand =====
 +
 +From the emacs built in tutorial((the tutorial is available in emacs with C-h t))
 +<​file>​
 +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.
 +</​file>​
 +
 +On our system the META key is generally on both the ``Esc`` and the Left ``Alt``.
 +
 +
 +
 +===== Colors! =====
 +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.
 +
 +
 +===== Suspending =====
 +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:
 +<​code>​(global-set-key (kbd "​C-z"​) '​suspend-emacs)</​code>​
 +
 +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.
 +
 +[[http://​www.gnu.org/​software/​emacs/​manual/​html_node/​elisp/​Suspending-Emacs.html|Read more...]]