elisp
Emacs ext: https://alphapapa.github.io/emacs-package-dev-handbook/
car
- the first element in a list cdr
- the rest of the list
Equality
eq
Check pointerequal
Check Value
Cons
2)
(setcar cons-name
;; Append lists
append '(1 2 3) 4) (
Alists
Alists are a list of cons cells - i.e. a HashMap
setq some-alist '((one . 1)
(2)
(two . 3)))
(three .
'one some-alist) ;; 1
(alist-get
'four 4) (map-put some-alist
Lists
;; Set idx 5 of the list
setf (alist) 5)
(
'one some-alist) (alist-get
Plists
Key/Value pairs with a flat list
1 two 2) 'one) (plist-get '(one
Plist vs. Alist
Debugger
M-x debug on entry
M-x toggle-debug-on-error
place (debug)
in your code to go into debug
mode - good for viewing locals
- v - expand local vars from that stack frame
- n, p - navigate stack frames
- + - pretty print
Edebug
SPC - step through edebug-goto-here
Continue to here Kill the \*backtrace\* buffer - it can stop the debugger from running
- i - step in
- n - step
- H - goto here
- c - continue
- d - view locals
- e - eval
Backtrace Buffer
- d - step through
Logic
cl-loop
is the most efficient- unless - runs if the var is nil
(progn)
- run a sequence of functions and return the last
Lispy
- Barf - < - send the paren forward
- w - move up (swap with paren above it)
- d - goto pair
- s - move down
- c - clone
- e - eval
- xf - lambda to defun
- xl - defun to lambda
- q - avy-paren
- Q - avy-char
- a - avy-symbol
- H - ace-symbol-replace