GNU Emacs 2015 10 2 1 GNU Emacs 1 1.1....................................... 1 1.2....................................... 1 1.2.1..................................... 1 1.2.2..................................... 1 1.2.3....................................... 2 1.3......................................... 2 1.4..................................... 3 1.4.1................................... 3 1.4.2 Window...................... 4 1.5 Emacs....................... 4 1.5.1 1......................... 4 1.5.2 2......................... 5 1.6.................................. 5 1.7...................................... 7 1.7.1 Emacs.................. 7 1.7.2....................................... 8 1.8...................................... 8 1.8.1.................... 8 1.8.2 Emacs......................... 9 1.9 Emacs Tutorial..................................... 9 1.10 Emacs.............................. 10 i
1 GNU Emacs UNIX OS vi vi GNU Emacs GNU Emacs 1 1.1 GNU Emacs C- (<CTRL>) C-f f M- ( <ALT> ) <ESC> 1.2 1.2.1 GNU Emacs ( Emacs ) emacs X Window System 1. emacs ( ) : Windows Emacs 2. emacs -nw emacs --no-windows : X Window System Emacs X Emacs X Emacs 1.2.2 Emacs File -> Quit C-x C-c 1 GNU Emacs UNIX UNIX 1
1: Emacs 1.2.3 1. emacs Emacs Emacs 2. emacs -nw Emacs 1.3 emacs & Emacs 1 & Emacs ˆ File Edit Options... (menu bar) Emacs 2 ˆ For information about... (echo area) Emacs 2 2
Emacs (minibuffer) ˆ (Emacs ) 1 X Window System ( ) Emacs (frame) ˆ ( 2 ) (mode line) Emacs 1. Emacs 2. File Split Window (split) Emacs 3. File Remove Splits 1. File 2. Split Window (C-x 2) C-x 2 C-x 2 x ( ) 2 3. File 1.4 1.4.1 Emacs Emacs ( ) Emacs : C-g 3
1 2 C-x 3 2 C-g 1.4.2 Window Emacs (C-x 1 Remove Split ) 1.5 Emacs 1.5.1 1 ls - list directory contents mv - move files commands file Emacs 1. Emacs emacs & 2. C-x C-f 1.10 Emacs Find file: ~/ 3. commands file <ENTER> <ENTER> <BS> C-g 2. commands file 4. commands file ls - list directory contents mv - move files Emacs <ENTER> <BS> 3 (C-x-) 4
5. Emacs ( ) C-x C-s () Wrote... commands file 6. Emacs commands file cat 1.5.2 2 1.5.1 1 commands file ls - list directory contents mv - move files cat - print files Emacs UNIX 1. emacs & Emacs 2. commands file emacs ls 3. commands file 1.5.1 1 C-x C-f commands file <ENTER> commands file Emacs (Emacs ) ( 2 ) commands file 4. (cat - print files) Emacs 5. 1 Emacs Emacs 6. commands file cat 1.6 2 CPU (central processing unit) (main memory; ) CPU 5
(CPU) ( ) (C-x C-s) (C-x C-f) 2: Emacs Emacs ( ) Emacs Emacs (buffer) Emacs Emacs C-x C-f ( 1.5.1 ) ( 1.5.2 ) Emacs C-x C-s ( 2 ) -- ** 1. Emacs emacs & commands file 2. Emacs commands file File -> Close (current buffer) 6
3. ls 4. Emacs commands file? commands file 5. Emacs ( 2 ) commands file -- (Emacs ) 3 cat cat - concatenate and print files ** 6. UNIX commands file 7. -- 8. commands file cat 1.7 1.7.1 Emacs Emacs 1. Emacs emacs & (X & ) 2. C-x C-f 3. 4. C-x C-s 5. 2 4 Emacs 6. Emacs C-x C-c 7
1.7.2 1. emacs motion Emacs backward forward character C-b C-f line C-p C-n Emacs 2. Emacs commands file cp rm cp - copy files and directories rm - remove files or directories Emacs 3. Emacs (a) unix ls mkdir (b) mv emacs motion unix (c) Emacs C-x C-f (d) Find File: ~/unix/emacs motion <ENTER> ~ ~/file ~/subdir/file ~ (subdir) (file) (e) emacs motion Emacs (f) unix emacs motion UNIX 1.8 1.8.1 C-x C-w UNIX cp commands file commands copy 1. commands file 8
2. C-x C-w () Write file: ~/ 3. commands copy <ENTER> commands copy commands copy C-x C-w commands file commands copy 1.8.2 Emacs Emacs 4 y, n, yes, no 1.9 Emacs Save file...? n... exit anyway? yes 1.9 Emacs Tutorial Emacs Important Help menu items: Emacs Tutorial Learn-by-doing tutorial for using Emacs efficiently. Emacs Help Emacs Tutorial (C-h t) CTRL-h t 5 4 Emacs ( *scratch*) 5 Emacs C-h C-h M-x help <ENTER> M-x help-with-tutorial <ENTER> 9
1.10 Emacs C-x C-c C-g C-x C-f C-x C-s C-x C-w C-x s ( ) C-h ( M-x help <ENTER> ) C-h t ( M-x help <ENTER> t ) C-x u (undo) C- (undo) C-f C-b C-a C-e C-p C-n C-v M-v 1 (forward) 1 (backward) (previous) (next) <BS> C-d C-k C-y C-<SPACE> C-w M-w 1 1 (kill) kill-ring (yank) ( ) (kill-ring ) kill-ring C-x b C-x C-b C-x k C-x o C-x 0 C-x 1 C-x 2 C-x 3 C-s M-% 10