├── README.md └── emacs_tutorial_reference.txt /README.md: -------------------------------------------------------------------------------- 1 | Emacs-Tutorial-for-Beginners 2 | ============================ 3 | 4 | Reference for "Emacs Tutorial for Beginners" video tutorials 5 | 6 | You can find the videos at: 7 | https://www.youtube.com/playlist?list=PL-mFLc7R_MJd5FoIrbNAcndPT50_hbVST 8 | 9 | Happy coding with Emacs :) 10 | 11 | Baris Yuksel 12 | -------------------------------------------------------------------------------- /emacs_tutorial_reference.txt: -------------------------------------------------------------------------------- 1 | // Essential Emacs Reference with Emacs Tutorials 2 | // 3 | // Accompanies "Emacs Tutorial: A short introduction to Emacs (Part 1)" 4 | // http://youtu.be/ujODL7MD04Q 5 | // 6 | // Also, accompanies "Emacs Tutorial: A short introduction to Emacs (Part 3)" 7 | // http://youtu.be/paSgzPso-yc 8 | // 9 | // File Commands: 10 | // -------------- 11 | // C-x C-f : Opens a file, asks for the file name. If it cannot find the file, creates the file 12 | // C-x C-s : Saves the file without a prompt 13 | // C-x s : Saves all files with a prompt 14 | // C-s C-w : Saves the file with a different name. Asks you for the name. 15 | // 16 | // Everytime you save a file, Emacs creates another file with the name "filename~". 17 | // This tilde(~) file is the previous version of the file. It will be in the same dir. 18 | // Also, Emacs auto-saves everything you type to a file with the name "#filename#". 19 | // If you quit Emacs without saving, you can see this auto-save file. Let's do that. 20 | // C-x C-c : Quits Emacs. 21 | // 22 | // M-x recover-file: recovers the auto-saved file. 23 | // 24 | // Copy/Cut/Paste Commands: 25 | // ------------------------ 26 | // C-y : Pastes whatever is in the clipboard at the cursor. 27 | // Subsequent C-y's will keep on pasting. 28 | // C-space : Starts marking/highligting a region. 29 | // C-k : Kills/deletes the whole line, puts it into the clipboard. 30 | // M-w : Copies this region into the clipboard. 31 | // C-w : Cuts this region into the clipboard (deletes the region and copies it to clipbrd) 32 | // 33 | // Saving a region involves hitting C-space to start selecting, and then hitting M-w or C-w to 34 | // copy or cut it into the clipboard, and then hitting C-y to paste it. 35 | // If you dont like the region you are selecting, hit C-g. 36 | // C-g : Always quits your command. 37 | // 38 | // Cursor Commands: 39 | // ---------------- 40 | // C-a : Beginning of line 41 | // C-e : End of line 42 | // M-> : End of buffer 43 | // M-< : Beginning of buffer 44 | // 45 | // C-/ : Undo 46 | // C-g C-/ : Redo 47 | // 48 | // Buffer Management Commands: 49 | // --------------------------- 50 | // C-x b : Switches buffers, asks you which buffer to switch to. 51 | // C-x C-b : Switches buffers, but shows you the list of buffers in a new window 52 | // 53 | // Hit C-x o (other window) to go the other window and hit on the buffer you want to 54 | // switch to. 55 | // C-x 0 : Will close that window 56 | // C-x 1 : Will leave only one window 57 | // C-x 2 : Will make a horizontal cut and show a secondary window 58 | // C-x 3 : Will make a vertical cut and show a secondary window 59 | // 60 | // Commands: 61 | // --------- 62 | // Emacs understands elisp. It is a dialect of lisp. 63 | // M-x command-name : Will execute the command. 64 | // M-x pwd : Prints the working directory 65 | // M-x indent-region : Indents the region. 66 | // 67 | // Hit M-x and type anything and hit TAB to auto-complete the commands (or to see the available 68 | // commands. ) 69 | // 70 | // You can hit M-: to go to the evaluate buffer where you can evaluate a lisp statement. 71 | // For example, "setq" sets a variable to a value. 72 | // 73 | // With C-h v, you can see the value of a variable. 74 | // 75 | // You can also use C-x C-e to evaluate (i.e. run) a lisp statement at the cursor. 76 | // (setq your_var '124) 77 | // your_var my_var 78 | // 79 | // ~/.emacs file and Packages 80 | // -------------------------- 81 | // Emacs is very versatile, you can program it, and add new abilities. Let's say that we 82 | // develop a new language that Emacs does not know about. All we have to do is to write 83 | // a "package" so that Emacs can color-code it for example. Or even write a package for 84 | // Emacs to auto-complete keywords in this language. This makes Emacs a platform for editing 85 | // many different things. 86 | // 87 | // ~/.emacs file (A file called ".emacs" under your home directory) holds all the elisp 88 | // statements that is run when you start your Emacs. 89 | // ~/.emacs.d directory (A directory called ".emacs.d" under your home directory) holds 90 | // all the packages (files of lisp commands/statements) for Emacs. 91 | // 92 | // You load a package by refering it in a "require" statement. 93 | // 94 | // For this example, I already have downloaded a package called "auto-complete" and put it 95 | // under ~/.emacs.d. I will now add a line in ~/.emacs file so that it will start every time. 96 | // Let's first test it. 97 | whi?? // no autocomplete 98 | // 99 | for // auto complete works once we add these two lines to our ~/.emacs file 100 | // 101 | // (require 'auto-complete) 102 | // (global-auto-complete-mode t) 103 | // 104 | // And then, we save .emacs file, and restart Emacs. auto-complete should be on for everything. 105 | // 106 | // We can also add the following line to ~/.emacs file so that C-c j becomes M-x goto-line each 107 | // time Emacs starts: 108 | // 109 | // (global-set-key (kbd "C-c j") 'goto-line) 110 | // 111 | // 112 | // For your reference, M-x goto-line goes to a line! 113 | --------------------------------------------------------------------------------