The three basic keys of eev: A mini tutorial Eduardo Ochs http://angg.twu.net/#eev http://angg.twu.net/#eev-three-main-keys (Version: 2019aug09) Eev's central idea is that you can keep "executable logs" of what you do, in a format that is reasonably readable and that is easy to "play back" later, step by step and in any order. The is the second of the mini-tutorials. The first one was on a way to install eev "for total beginners" that creates a script called ~/eev that starts Emacs with eev-mode on and opens the main sandboxed tutorial of eev: (find-eev-quick-intro) The `(find-*-intro)'s are interactive tutorials. The mini-tutorials are videos. This mini-tutorial is about the basic ideas that you need to understand to run the interactive tutorials. ^ | three keys! In Emacs terminology `C-e' is `control-e', and `M-e' is `alt-e'. We pronounce `M-e' as `meta-e'. Some old keyboards had a "meta key". See: https://en.wikipedia.org/wiki/Meta_key Some keys in Emacs recognize numeric prefixes. For example, `M-4 M-2 a' inserts 42 `a's. Lisp is a programming language that uses: 1. lots of lists 2. lots of parentheses - they delimit the lists 3. no ","s between the elements of these lists 4. the name of a function at the beginning of the list, the arguments for the function after that. These lists without commas are called "sexps". See: https://en.wikipedia.org/wiki/Sexp These sexp are Lisp expressions (programs!): (* 2 3) (* 4 5) (+ (* 2 3) (* 4 5)) they return these results: (* 2 3) --> 6 (* 4 5) --> 20 (+ (* 2 3) (* 4 5)) --> 26 This is a sexp with "side effects": (insert "HELLO") SPOILER: The basic keys of eev are: M-e - to follow an elisp hyperlink. (Elisp = Emacs Lisp) Mnemonic: "(e)valuate"/"(e)xecute". M-k - to go back. Mnemonic: "(k)ill buffer". M-j - to (j)ump to certain predefined places. For example: M-2 M-j runs: (find-emacs-keys-intro) M-5 M-j runs: (find-eev-quick-intro) M-j takes you to the list of jump targets. You just need to learn `M-e', `M-k' and `M-j' keys to navigate: 1. the sandboxed tutorials for eev, 2. the list of all most important keys, 3. and the Emacs manuals! This mini-tutorial is BASED on these parts of the main tutorial: (find-eev-quick-intro) (find-eev-quick-intro "2. Evaluating Lisp") (find-eev-quick-intro "3. Elisp hyperlinks") (find-eev-quick-intro "7.1. `eejump'") (find-eev-quick-intro "7.1. `eejump'" "numeric arguments")
2. Evaluating LispWhen you type `M-e' emacs moves the point to the end of the current line, then runs a variant of `C-x C-e'. Try this on each line of the block below: (+ (* 2 3) (* 4 5) ) `M-e' accepts several different numeric prefixes that alter its behavior. We are only interested in one of them now - `M-0 M-e' highlights the sexp for a fraction of a second instead of executing it. Try it above. Also: (insert "HELLO") [In this video we will also use `M-2 M-e' and `M-3 M-e' - they create two-window settings with the "target" of the sexp in the right window... but the idea of the "target" of a sexp only makes sense when that sexp behaves as a hyperlink...]
3. Elisp hyperlinksEach one of the sexps below makes Emacs "go somewhere" if you execute it with `M-e'. Executing sexps like those - we will call them "elisp hyperlinks" - is like following a hyperlink in a browser. In a browser you can "go back" after following a hyperlink because the previous page is kept in the memory somehow. In Emacs+eev the easiest way to "go back" is with `M-k', which runs a function called `ee-kill-this-buffer'. If you follow one of the links below with `M-e', it creates a new buffer and displays it. If you then type `M-k' this new buffer is killed, and Emacs displays the buffer that was just below it, which is this tutorial... try it! Here are some nice elisp hyperlinks: (find-file "~/eev-current/eev-flash.el") (find-fline "~/eev-current/eev-flash.el") (find-fline "~/eev-current/") (find-fline "/tmp/") (find-efunctiondescr 'find-file) (find-man "date") (find-man "sleep") (find-sh "date; sleep 1; date") (find-node "(emacs)Lisp Eval") (find-enode "Lisp Eval") (find-efunction 'find-file) Not all elisp hyperlinks "go somewhere"; some are like buttons that perform an action, like the one below, that acts as if the user had pressed a series of keys, (eek "<down> C-a H E L L O ! <up> C-e") and some display their output in the echo area: (find-sh0 "date") Note: `find-fline' is a contraction of `find-file-line'... `find-fline' is better for hyperlinks than `find-file' because it can be "refined" to point to a precise place in a file. See: (find-refining-intro "2. Refining hyperlinks") See also: (find-enode "Major Modes") (find-enode "Major Modes" "Dired") (find-links-conv-intro "4. Elisp hyperlinks: some conventions") (find-links-conv-intro "messy")
7.1. `eejump'Some key sequences in Emacs accept numeric arguments. For example, try typing `M-9 a' (not `M-9 M-a'!) - this will insert 9 copies of the letter `a'. See: (find-enode "Arguments") Eev binds the key `M-j' (`eejump') to a function that jumps to a place that depends on the numeric argument. For example, `M-5 M-j' runs (find-eev-quick-intro), that reloads this intro and goes to the top of it, and `M-2 M-j' runs: (find-emacs-keys-intro) `M-6 M-j' runs: (find-escripts-intro) `M-1 M-j' runs: (find-fline "~/TODO")
7.2. The list of eejump targetsIf you type `M-j' without a prefix argument then it runs `(find-eejumps)', that displays a help text followed by all the current eejump targets as defuns, one in each line. Try it: (eek "M-j") (find-eejumps) You will see that two of those entries are: (defun eejump-1 () (find-fline "~/TODO")) (defun eejump-5 () (find-eev-quick-intro)) The help text starts with: ;; (find-eejumps) ;; See: (find-eev-quick-intro "7.1. `eejump'") ;; (find-emacs-keys-intro "1. Basic keys (eev)") ;; For example, ;; M-1 M-j runs: (find-fline "~/TODO") ;; M-2 M-j runs: (find-emacs-keys-intro) ;; M-5 M-j runs: (find-eev-quick-intro) ;; Current eejump targets: So if your mind goes blank and you forget everything except for `M-j' and `M-e' you can just type `M-j' and follow one of the elisp hyperlinks in the help text.
What are the next steps?Next steps: 1) Learn e-script blocks: (find-eev-quick-intro "6.1. The main key: <F8>") (find-eev-quick-intro "6.2. Other targets" "display all") 2) Learn how to use index-anchor pairs: (find-eev-quick-intro "8.1. Introduction: `to'") 3) Learn how to write your executable notes and put them here: `M-1 M-j' runs: (find-fline "~/TODO") Etc, etc, etc... Note that learning to read comes after learning to write!... See: (find-here-links-intro "1.1. Reading and writing") Btw, the videos that I produced using this "script" are here: http://angg.twu.net/#eev-three-main-keys Version in English: http://www.youtube.com/watch?v=s0_48wzWFbU http://angg.twu.net/eev-videos/three-keys-2.mp4 Version in Portuguese: http://www.youtube.com/watch?v=GUuCpmLItTs http://angg.twu.net/eev-videos/three-keys-1-pt.mp4