Skip to content

Latest commit

 

History

History
225 lines (154 loc) · 5.75 KB

elisp.org

File metadata and controls

225 lines (154 loc) · 5.75 KB

REPL

A-x ielm

Function definition

(defun foo () 5)
(foo) => 5

Functions you’ll call interactively, i.e. you can bind to a key sequence, the above function can only be called from other functions.

(defun foo () (interactive "r") 5)
~abc~

Debugger EDebug

Instrument your function with the function

edebug-eval-top-level-form
SPC(step) move through sexp’s, result displayed in mini-buffer
n(next)

SPC edebug-step-mode

  • negative-argument

= edebug-temp-display-freq-count ? edebug-help B edebug-next-breakpoint C edebug-Continue-fast-mode E edebug-visit-eval-list G edebug-Go-nonstop-mode I edebug-instrument-callee P edebug-view-outside Q edebug-top-level-nonstop S edebug-stop T edebug-Trace-fast-mode W edebug-toggle-save-windows X edebug-set-global-break-condition a abort-recursive-edit b edebug-set-breakpoint c edebug-continue-mode d edebug-backtrace e edebug-eval-expression f edebug-forward-sexp g edebug-go-mode h edebug-goto-here i edebug-step-in n edebug-next-mode o edebug-step-out p edebug-bounce-point q top-level r edebug-previous-result t edebug-trace-mode u edebug-unset-breakpoint v edebug-view-outside w edebug-where x edebug-set-conditional-breakpoint DEL backward-delete-char-untabify <emacs-state> Prefix Command <intercept-state> all <normal-state> Prefix Command <visual-state> Prefix Command

<emacs-state> , hydra-edebug-comma/body <emacs-state> i edebug-step-in <emacs-state> n edebug-step-mode <emacs-state> o edebug-step-out <emacs-state> q top-level

<visual-state> , hydra-edebug-comma/body <visual-state> i edebug-step-in <visual-state> n edebug-step-mode <visual-state> o edebug-step-out <visual-state> q top-level

<normal-state> , hydra-edebug-comma/body <normal-state> i edebug-step-in <normal-state> n edebug-step-mode <normal-state> o edebug-step-out <normal-state> q top-level

C-c C-c edebug-go-mode C-c C-d edebug-unset-breakpoint C-c C-l edebug-where C-c C-n edebug-next-mode C-c C-s edebug-step-mode C-c C-t ??

C-x C-a Prefix Command C-x C-e edebug-eval-last-sexp C-x SPC edebug-set-breakpoint

C-M-i completion-at-point C-M-q indent-pp-sexp C-M-x eval-defun

C-M-q indent-sexp (that binding is currently shadowed by another mode)

C-M-q prog-indent-sexp (that binding is currently shadowed by another mode)

C-x C-a C-c edebug-go-mode C-x C-a C-l edebug-where C-x C-a RET edebug-set-initial-mode C-x C-a C-n edebug-next-mode C-x C-a C-s edebug-step-mode

Global commands prefixed by ‘global-edebug-prefix’: key binding — -------

SPC edebug-step-mode = edebug-display-freq-count C edebug-Continue-fast-mode G edebug-Go-nonstop-mode Q edebug-top-level-nonstop T edebug-Trace-fast-mode W edebug-toggle-save-windows X edebug-set-global-break-condition a abort-recursive-edit b edebug-set-breakpoint c edebug-continue-mode g edebug-go-mode q top-level t edebug-trace-mode u edebug-unset-breakpoint w edebug-where x edebug-set-conditional-breakpoint

i (into)step into function call
ostep out
vtoggle local variables
qquit
g (go)go to end of func without quitting
h (go here)breakpoint to where cursor is
bset breakpoint here
Ggo and dont stop at breakpoints

re-eval function to uninstrument it

https://www.youtube.com/watch?v=odkYXXYOxpo

for macros use macrostep

Useful

Set a variable

:(setq a 123)

functiondescription
symbol-functionget definition of function

Function Reference

positions

line-beginning-position

the position of the beginning of the current line

point-max/point-min

the last/first point (position) in the buffer.

point

current point position

IELM

C-c C-b

Can select a buffer to bind the IELM to, so that functions such as (point) report the point in that buffer and not the ielm buffer.

Command Log Mode

Trace

With command log mode, it shows which functions are run.

Install:

(use-package command-log-mode)

Enable for current buffer:

M-x command-log-mode

Show the log:

M-x clm/open-command-log-buffer

Unit Tests

can run:

, t t

in either the impl file or test file and should run the tests that are loaded