; Welcome to the first installment of emacs-command-a-day. Learning ; emacs can be hard as there are many commands and key-bindings that ; beginners find difficult. To help you make the transition to "the ; best text editor ever", I'll bring you one command each week day, so ; you can practice on your own at a reasonable pace. ;; Emacs Installation Notes ; I assume that you can start emacs. If you have no idea how, (on a ; mac or linux system) you should be able to open up a terminal and ; type in `emacs`. ; On windows it's a bit more complicated, but simple enough not to ; warrant it's own day; go to ; http://ourcomments.org/cgi-bin/emacsw32-dl-latest.pl and then select ; the link "Download latest EmacsW32+Emacs patched". Install it and ; run it. ;; Your First Command ; So you've started emacs! Great! If you're having issues, google ; it. This is the price of admission. ; The first thing that usually comes to your mind is: "Okay, now how ; do I close this thing?" ;;; C-x C-c runs the command save-buffers-kill-terminal ; When you see keys listed as 'C-c' that means, "hold Ctrl then press ; c". As you notice my description above, it mentions that the ; key-bindings 'C-x C-c' run a command, this command is literally ; called save-buffers-kill-terminal and it should be self evident as ; to what it does. ; If you've made changes to a buffer, you may be prompted for a ; selection (look to the very small and thin buffer at the bottom of ; your emacs window), to see your choices, type C-h and you should see ; something like this: ;;; Type SPC or `y' to save the current buffer; ;;; DEL or `n' to skip the current buffer; ;;; RET or `q' to give up on the save (skip all remaining buffers); ;;; C-g to quit (cancel the whole command); ;;; ! to save all remaining buffers; ;;; C-r to view this buffer; ;;; d to view changes in this buffer; ;;; or . (period) to save the current buffer and exit. ; If you have not made recent changes emacs will just close. ; You might be wondering at this point, what's up with all these ; semi-colons? These are comments in lisp (elisp to be precise), elisp ; is the language that makes all of these awesome commands in emacs ; possible. At the same time I am introducing you to using emacs, I am ; also introducing you to programming emacs. ; Rather than using key-bindings (such as C-x C-c) we can also automate ; command execution, or rebind commands to new keys or do any number ; of things that we want. Here's how you would eval ; save-buffers-kill-terminal in elisp. (save-buffers-kill-terminal) ; Whew! That wasn't so hard was it? Don't worry about the fact you ; have no idea what to do with this. We're taking baby steps. ; I will be posting these as gists on github and on my blog ; (commandlion.com), I am not perfect, please feel free to fork and fix ; any issues you may find. ;; Joseph Kern 2011-08-24