||Paredit mode. Start with it from day 1! Matching pairs of parentheses, won’t let you delete one without the other. Inserts appropriate newlines, too
||Emacs as a Lisp environment. (Also, Helm is what’s responsible for the display.) Evaluating a function makes it available in the global scope, which has all these functions and commands you can do. This makes it easy to iteratively develop your functions, because you can just execute things directly.
||Without (interactive), you can’t call functions with
M-x. You can use
M-: or put the call in your scratch buffer.
||pp-eval-last-sexp. Check out http://github.com/jwiegley/dot-emacs for other config things
e to evaluate within the current context. Also, stepping, quit.
C-u C-M-x. Interactive debugging.
SPC moves you forward, one Lisp form at a time. It shows you results in the minibuffer. You can descend into Lisp forms or go into functions.
? shows keybindings. Check out the Emacs Lisp chapter on EDebug, highly recommendeg.
||You can also use the (debug) form to go to the debugger.
||eldoc: Seeing arguments in the minibuffer as you type, because no one remembers all the arguments anyway.
eldoc-mode, or add
(turn-on-eldoc-mode) to your config.
||What functions should you call in the first place? What concepts? Emacs predates many standard terms, so that’s why things are a little confusing. Ex: “frames” and “windows” are not what you might think they are. OS window = frame. Area within Emacs = window. Opposite of HTML. Use the Emacs tutorial
||Read the Emacs Lisp intro, which you can get to with
C-h i (which lists the manuals that are available). Read the Emacs Lisp manual too.
||Other weird terms: point, mark, marker.
C-h f (
describe-function) shows the help for the function. Nearly all functions you’ll probably call are documented well. Lots of options. Check out
C-h f for
interactive, for example.
C-h v (
||More in-depth documentation:
C-h i, go to the Emacs Lisp manual, then use
i to view the index.
||info-lookmore shows you the Info documentation for the symbol under point. Works for other Lisps too (ex: Common Lisp)
||Sanity-checking paired parentheses with
M-x check-parens. Handy for adding to your
after-save-hook in Emacs Lisp mode.
||Paredit editing capabilities. Ex:
C-k kills the current sexp.
paredit-raise-sexp replaces the parent sexp with the following sexp. slurping and barfing. Barfing – spitting out an element from the list form.
C-} (with suggested keybindings).
C-) are slurping, which pulls forms in. Works for strings, too.
||Maximum barfage and slurpage. Useful for slurping everything in, for example. paredit-slurp-all-the-way-forward.
||redshank (companion to paredit) for refactoring. Ex:
redshank-condify-form converts an
if to a
cond for when you realize you’ve got more than two conditions.
M-1 M-( surround the next one thing with parens
||redshank: wrap a let, change if to a when, etc.
C-h k (
describe-key) shows what a keyboard shortcut or menu item will do.
||Took a while to get used to paredit, but you eventually get into the zen of paredit.
M-x elint-current-buffer. Loads every module that your code depends on (so the first time is slow), and then shows you style notes.
C-q for manually inserting parentheses
||Helm, which shows you all the other stuff that matches your query. Lets you select by regex, multiple patterns, etc. Much nicer and more interactive.
M-x elp-instrument-function, then call the function, then
elp-results will show you the time it took to execute. Results aggregate, and are reset when you call
||Measuring memory consumption. Also, internal representation of lists.
setcdr. This can greatly speed up your code, if you can avoid using the garbage collector. EmacsWiki –
memory-use-counts, but not particularly helpful? Another package that extends the Emacs Lisp profiler? Avoid premature optimization.
||elint and flycheck? flycheck’s designed for external processes, so that might be a challenge. Possibility: use
async to spawn another Emacs? Doesn’t seem to be available yet.
||testcover, coveralls.io, undercover.el
||Read Emacs Lisp manual, etc.
||Creating a mode. You don’t have to make it from scartch – start by copying someone else, and then strip away everything you don’t want.
||checkdoc – checks the style of your documentation strings.
||defining a minor mode
||when to define a major mode – structure of your buffer