Skip to Content

Revision of Emacs tips from Thu, 25/11/2004 - 5:35pm

The revisions let you track differences between multiple versions of a post.

Manal's picture
  1. ALT x (written as M-x) opens the emacs command.
    1. M-x then press tab, to view all possible commands/functions (tab completion).
    2. u type the command to enable/disable functions.
    3. M-x eshell ---> opens emacs shell.
    4. M-x term ---> opens bash.
  2. CTRL x (written as C-x) for commands related to the editor.
    1. C-x C-f ---> open file.
    2. C-x C-s ---> save file.
    3. C-x C-c ---> quit emacs.
    4. C-x d ---> opens dired mode.
  3. CTRL c (written as C-c) for commands related to the mode u r in.
  4. CTRL h (written as C-h) for help commands, also u can access it through F1.
    1. C-h C-h ---> about help.
    2. C-h b ---> key bindings.
    3. C-h t ---> interactive tutorial.
  5. u can press ESC then press x, instead of typing ALT x.
  6. examples of Major modes (C++ mode, erc, gnus, etc.).
  7. examples of minor modes (spell checking mode).

  1. a very important command is CTRL g (C-g), to cancel any command u started writing in the emacs command line.
  2. for changing the default color of emacs, download the color-theme package from the emacs wiki, gunzip it under the elisp/ directory (create it first), then open it using M-x color-theme-select and select a nicer theme.
  3. if u want to change the emacs defaults, u have to edit the .emacs file (create it first), and then u have to know some lisp syntax to be able to write ur own preferences.
  4. also u can customize emacs through options ---> customize emacs.
  5. text-editing commands:
    1. C-space ---> set a mark.
      1. type C-x C-x to switch between the set mark and the cursor (after C-space).
    2. C-w ---> cut.
    3. M-w ---> copy.
    4. C-y ---> yank/paste.
      1. type M-y to browse through the "kill ring" (all what u have copied, cut, killed, selected in the clipboard), after C-y
    5. C-k ---> deletes from the point of the cursor to the end of the line.
      1. if u press C-k many times quickly, u can kill many lines and when u paste emacs paste them all not only the last line.
    6. C-_ ---> undo (when undos end, start redoing).
  6. Multi windows:
    1. C-x 2 ---> splits the window in focus horizontally.
    2. C-x 3 ---> splits the window in focus vertically.
    3. C-x o ---> switches focus to the next window.
    4. C-x 0 ---> closes the window in focus.
  7. Major Modes:
    • tramp: ssh through emacs.
    • gnus: news reader and mail client.
    • w3m: web browser, supports tables and images.
    • latex: with the latex-preview minor mode, u can c the generated output of latex while u r writing.
    • psgml: validator editor of sgml, xml, html.
    • erc: irc client.
      1. supports nick completion.
      2. supports completion of other words using M-/ TAB


Dr. Radut | book