Skip to content

Instantly share code, notes, and snippets.

@roryk
Created December 15, 2012 06:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roryk/4291793 to your computer and use it in GitHub Desktop.
Save roryk/4291793 to your computer and use it in GitHub Desktop.
Steps through elisp to find an error.
; from http://newsgroups.derkeiler.com/Archive/Comp/comp.emacs/2005-12/msg00064.html saved for posterity
(defalias 'puffer-lesen 'eval-buffer-or-region-step-by-step)
(defun eval-buffer-or-region-step-by-step ()
"Stepps through region if activated, otherwise takes the whole buffer
evaluating last-sexp and messaging point. As `eval-last-sexp' exits
encountering an error, you may easily pick the last point.
Attention: Commands changing the current-buffer as `find-file' will
derail the check."
(interactive)
(let ((anfang (if mark-active
(region-beginning)
(point-min)))
(ende (if mark-active
(region-end)
(point-max))))
(goto-char anfang)
(while (and (not (eobp)) (< (point) ende))
(progn
(forward-sexp 1)
(message "point %s" (point))
(eval-last-sexp nil)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment