Skip to Content

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

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

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

  • a very important command is CTRL g (C-g), to cancel any command u started writing in the emacs command line.
  • 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.
  • 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.
  • also u can customize emacs through options ---> customize emacs.
  • text-editing commands:
    • C-space ---> set a mark.
      • type C-x C-x to switch between the set mark and the cursor (after C-space).
    • C-w ---> cut.
    • M-w ---> copy.
    • C-y ---> yank/paste.
      • type M-y to browse through the "kill ring" (all what u have copied, cut, killed, selected in the clipboard), after C-y
    • C-k ---> deletes from the point of the cursor to the end of the line.
      • 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.
    • C-_ ---> undo (when undos end, start redoing).
  • Multi windows:
    • C-x 2 ---> splits the window in focus horizontally.
    • C-x 3 ---> splits the window in focus vertically.
    • C-x o ---> switches focus to the next window.
    • C-x 0 ---> closes the window in focus.
  • Major Modes:
    1. tramp: ssh through emacs.
    2. gnus: news reader and mail client.
    3. w3m: web browser, supports tables and images.
    4. latex: with the latex-preview minor mode, u can c the generated output of latex while u r writing.
    5. psgml: validator editor of sgml, xml, html.
    6. erc: irc client.
      • supports nick completion.
      • supports completion of other words using M-/ TAB


Dr. Radut | book