Miscellaneous
-------------
emacs -q         Start Emacs without running .emacs
C-x C-c          End emacs 
C-x u            Undo 
M-no. command    Execute command with a numeric argument 
C-q 007          Insert control character, here bell 
C-q C-l          Insert control character, here ctrl-l
C-x C-d          List directory 
C-u C-x C-d      Verbose directory listing 
C-o              Open line 
C-x =[l]         Display location, column etc., [line] 
<tab>            Complete command and wait 
<insert>         Toggles insert/overwrite mode 
M-x recover-file Restores the auto-saved file, after a crash 
M-x manual-entry Displays a Unix man page 
M-x shell        Start a shell in a separate buffer 

Buffers
-------
C-x C-b             List buffers 
C-x a               Append current region to another buffer 
C-x b               Go to buffer 
C-x k               Kill buffer 
C-x C-s             Save buffer 
M-x cd              Change current buffer's default directory 
M-x copy-to-buffer  Move region to buffer 

C-x C-b             Start buffer menu
  1                 selects the current buffer for display 
  d                 mark for deletion 
  f                 display sel. buffer in place of buffer w. 
  k                 mark for deletion 
  o                 select curr. buffer in another window 
  s                 mark for saving 
  u                 undo save and delete marks 
  x                 execute delete/save 

Command history
---------------
C-x <esc><esc>           Re-execute previous minibuffer command 
M-p[n]                   Display previous[next] command 
M-x list-command-history

Cursor
------
C-x C-x        Exchange point and mark 
C-a[e]         Start[end] of line 
C-M-a[e]       Start[end] of the current function
C-M-n[p]       Forward/backward over a parenthetical group
C-M-f[b]       Forward/backward over a balanced expression
C-b[f]         Character backward [forward] 
C-n[p]         Line forward [backward] 
C-u C-<spc>    Step through mark ring 
C-v [M-v]      Screen forward [backward] 
M-x goto-line  To a particular line 
M-<, M->       Go to begin [end] of the buffer 

Delete
------
C-d        Delete character 
C-k        Kill line 
C-w        Kill region 
C-y        Yank 
M-w        Copy region 
M-y        Step through kill ring 

Windows
-------
C-x 0  delete current window 
C-x 1  delete all other windows 
C-x 2  split screen horizontally 
C-x 3  split screen vertically 
C-x o  go to the next window 

Files
-----
C-x C-s             Save a buffer to a file 
C-x C-f             Load a file 
C-x C-w             Rename buffer and write to file 
C-x i               Insert a file into the current buffer

Dired
-----
C-x d  Start dired
 ?     short help on dired 
 +     create directory 
 c     copy 
 d     mark for deletion 
 e     visit file or directory 
 f     visit file or directory 
 g     re-read directory 
 h     help 
 m     mark file 
 o     visit file or directory in another window 
 q     quit dired 
 R     rename 
 u     unmark a file 
 v     view file 
 x     execute deletion 

Help
----
C-h C-h	    help for help 
C-h a	    command-apropos 
C-h f	    describe-function 
C-h k[c]    describe-key [briefly]
C-x C-h     help commands 

Indenting
---------
C-M-\       Indent lines in the region 
C-u 4 C-M-\ Indent lines in the region to column 4 
TAB         Indent to next tab 

Search
------
C-s[r]    isearch forward [backward]
<return>  exit search 
C-g       cancel search 
C-g       stop search and go back

Replace
-------
M-%       Query replace string 
 <spc>    replace this occurence 
 n        skip to next 
 .        replace this string and stop 
 ,        replace and let me see the result 
 !        replace all remaining 
 ^        back up to previous instance 
 C-r      enter recursive edit 
 C-w      delete this instance and enter recursive edit 
 M C-c    exit recursive edit and resume query replace
 C-]      exit recursive edit and exit query replace 
 q,<ret>  exit 

Registers
---------
C-x r SPC a  Store current point in reg a. (C-x /)
C-x r i a    Retrieve text from reg. a     (C-x g)
C-x r j a    Jump to position in reg. a    (C-x j)
C-x r s a    Copy current region to reg. a (C-x x)

Tags
----
Unix> etags *.c        create the file ./TAGS
M-x visit-tags-file    specify a tags file 
M-.                    find tag 

Macros
------
C-x ( Beginning macro definition
C-x ) End macro definition
C-x e Execute last macro} 
C-x q Query (used inside macro definitions)} 
        <spc>  Continue executing the macro 
        n      Skip the rest of the macro and restart 
        q      Skip the rest and stop 
        C-l    Redraw the screen and ask for ... 
        C-r    Enter recursive editing level C-M-c exits 

M-x name-last-kbd-macro  Name the last macro 
C-x C-f ~/.emacs  
M-x insert-kbd-macro     Writes the named macro to the startup file 

Compilation
-----------
M-x compile Compile 
M-x grep    Run grep over files 
C-x `       Visit next error 
C-c C-c     Visit the source code for the current error message





2018-04-20