Skip to main content
7 votes
Accepted

Signaling a breakpoint in Emacs Lisp

Add (debug) and you'll be thrown into a buffer showing you the backtrace and where you can examine the current state. See: Emacs Manual "Explicit Entry to the Debugger"
Stefan's user avatar
  • 26.5k
6 votes
Accepted

Examine function arguments after debug-on-error

The backtrace looks like this: signal(test-signal (1 2 3)) foo(123) (progn (foo 123)) eval((progn (foo 123)) t) elisp--eval-last-sexp(t) eval-last-sexp(t) eval-print-last-sexp(nil) ...
NickD's user avatar
  • 30.9k
6 votes
Accepted

Is it possible to edebug a lambda returned by a function?

Edebug does not support instrumenting code constructed at runtime. If you try to instrument create-function, then the stepping will occur when you evaluate (create-function 2), not when you execute ...
npostavs's user avatar
  • 9,213
5 votes
Accepted

Emacs is hanging on almost every word I type. How to identify the problem?

I would approach this a few ways: First, you'll want to identify if the problem reproduces in vanilla (i.e. non-configured, no Prelude) Emacs, or with your configurations. As Drew mentioned above, ...
Andy's user avatar
  • 398
5 votes

Debug pytests in emacs

I think that there are only the following solutions: Run tests outside of Emacs from your terminal emulator Run tests from realgud Run tests inside Emacs via eshell. But shell output may be corrupted,...
sivakov512's user avatar
4 votes
Accepted

How to force `condition-case` to activate the debugger

Try using condition-case-unless-debug instead of condition-case. You should be able to M-x debug-on-entry either foo or bar in this context: (defun foo () (condition-case-unless-debug nil (...
Drew's user avatar
  • 78k
4 votes
Accepted

How to navigate stack frames in Emacs debugger?

Simply move point in the *Backtrace* buffer to the corresponding line of the frame you're interested in. examine state of variables Then press v (debugger-toggle-locals) to show local variables in ...
npostavs's user avatar
  • 9,213
4 votes

Line numbers in backtrace?

It tells you that the function where the error was raised is tramp-error. Line numbers aren't available, and generally have no meaning. In particular, the Lisp code is usually byte-compiled. If you ...
Drew's user avatar
  • 78k
3 votes
Accepted

How can I apply `(toggle-debug-on-quit)` ignore ` Debugger entered Lisp error: (minibuffer-quit)`

Try adding minibuffer-quit to debug-ignored-errors. You can do this using: (add-to-list 'debug-ignored-errors 'minibuffer-quit)
Lindydancer's user avatar
  • 6,170
3 votes

How to automatically open the debugger whenever `kill-buffer` is invoked?

M-x debug-on-entry kill-buffer That opens the standard Emacs debugger whenever kill-buffer is invoked. It doesn't matter that it's a built-in (primitive, not coded in Lisp). See the Elisp manual, ...
Drew's user avatar
  • 78k
3 votes
Accepted

Emacs elisp debugger: How do i make the debugger jump to source when i press s?

s is bound to a new function that was recently added, and indeed it appears to be non–functional. I took a look at the source code, and it does attempt to pull file and line number from the stack ...
db48x's user avatar
  • 18.4k
3 votes
Accepted

When working on elisp where to show intermediate values?

If you are using messages to yourself while developing then: That's fine - nothing wrong with using message. You can also define a wrapper for such uses of message, which respects a global variable ...
Drew's user avatar
  • 78k
3 votes

What tools can help make the emacs debug output more readable?

Emacs 27: C-hig (elisp)Backtraces 18.1.7 Backtraces Debugger mode is derived from Backtrace mode, which is also used to show backtraces by Edebug and ERT. (*note Edebug::, and *note the ERT ...
phils's user avatar
  • 51.7k
3 votes
Accepted

Stack reflection in Emacs Lisp?

Short answer : the function backtrace-frame should be what you want. How did I find this ? Well, here are the steps : invoke the elisp info manual (my favourite way is C-h r TAB RET), then search ...
YoungFrog's user avatar
  • 3,526
3 votes

the Name of Function defined in C

Provide a reference (from the manual) for @phils's answer; Supplement the conversion convention for the name of the function. E.7 Writing Emacs Primitives: Here is a template for them: DEFUN (lname, ...
shynur's user avatar
  • 5,473
3 votes

Emacs 28 crashing when using triple quotes for docstrings

For others who have run into this in Emacs 28, and have spent hours frustrated by it, as I did, the problem is a known bug and is fixed in emacs 29. Follow this guide here: https://github.com/emacs-...
Marc Cenedella's user avatar
2 votes
Accepted

Autocompletion of a variable name while Python debugging

I have used M-x pdb on and off for quite some time now, and while I would love to be corrected on this, unfortunately I don't think it supports tab completion. I have recently started playing with ...
elethan's user avatar
  • 4,845
2 votes
Accepted

Debugging erratic error

You're probably using an old version of AUCTeX, which had indeed the bug you're reporting: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=22417 This was due to an error in the style/subfigure.el file ...
giordano's user avatar
  • 3,255
2 votes

Is it possible to edebug a lambda returned by a function?

Yes. M-x debug-on-entry RET square-two RET M-: (square-two) RET Debugger entered--entering a function: * square-two() eval((square-two) nil) eval-expression((square-two) nil nil 127) funcall-...
Drew's user avatar
  • 78k
2 votes
Accepted

Unable to load bookmarks list on emacs master

I had the same problem. Turned out there was a file ~/.emacs-bmk-bmenu-state.el that still contained the pesky symbol. I moved the file to a save directory, restarted Emacs, and now bookmark+ works ...
user207899's user avatar
2 votes

How to debug frequent emacs feezes

M-x toggle-debug-on-quit Hit C-g when running into the freeze ???? PROFIT Don't forget running M-x toggle-debug-on-quit again after successful debugging, it's rather annoying to have every C-g spawn ...
wasamasa's user avatar
  • 22.2k
2 votes
Accepted

the Name of Function defined in C

The C function name is Fvertical_motion. DEFUN is a macro defined in lisp.h. It is used to define C functions which are also visible as lisp functions. /* Define a built-in function for calling from ...
phils's user avatar
  • 51.7k
2 votes

Trouble setting up dap for python in Spacemacs

With help from the spacemacs gitter room I was able to get it working. Here is the solution: Spacemacs doesn't use ptvsd anymore and uses debugpy instead, so I did this: pip uninstall ptvsd pip ...
Airuno2L's user avatar
  • 141
1 vote
Accepted

Is it possible to save buffers right before emacs freezes?

Emacs doesn’t know that it is about to freeze. Therefore you cannot program it to save before freezing. You should work on solving the problem rather than trying to work around it. Most people do not ...
db48x's user avatar
  • 18.4k
1 vote
Accepted

--debug-init not showing enhanced information

A parse error while loading a Lisp file seems to prevent the debugger from firing. If you wonder why typex.el is loaded Add the following line at the top of typex.el: (debug) Then start Emacs ...
Gilles 'SO- stop being evil''s user avatar
1 vote

--debug-init not showing enhanced information

(What's the question?) Emacs told you that your file typex.el is syntactically incorrect - it reached the end of file (e.g., missing right parentheses) while trying to parse/read it. As it said: ...
Drew's user avatar
  • 78k
1 vote

--debug-init not showing enhanced information

You're not getting a run-time debugger because Emacs didn't get as far as running the code -- the error in question is End of file during parsing so it couldn't successfully read that file in the ...
phils's user avatar
  • 51.7k
1 vote

What tools can help make the emacs debug output more readable?

It's possible to format backtraces differently using mapbacktrace with a custom function. One such example is always printing the items as list, I've contributed a patch introducing the debugger-...
wasamasa's user avatar
  • 22.2k
1 vote
Accepted

Tools to develop and debug ELISP code

Here is the beginnings of a list of useful techniques culled from the comments. Please add any others that you find useful by editing this answer: The elisp analog of sprinkling printfs in a program ...
1 vote

Is it possible to edebug a lambda returned by a function?

BTW, while npostavs's solution is the better option for your example, in those cases where you really do need to build the code manually with backquotes (e.g. inside defmacro), you can try: (defun ...
Stefan's user avatar
  • 26.5k

Only top scored, non community-wiki answers of a minimum length are eligible