Short of building a debug version of emacs and adding break points.

Whats the best way to know whats happening during a 'pause' while emacs runs? (assuming the pause is long enough to manually run an operation)

Is there a way to press Ctrl-C in the terminal to get a stack trace or something similar?

  • Ended up having to use gdb with a debug emacs, problem was eldoc running command that took a long time.
    – ideasman42
    Mar 12, 2017 at 12:03

1 Answer 1


toggle-debug-on-quit is designed for this purpose.

(toggle-debug-on-quit &optional INTERACTIVELY)

Toggle whether to enter Lisp debugger when C-g is pressed. In an interactive call, record this option as a candidate for saving by "Save Options" in Custom buffers.

When you press C-g is will break the running code and display the stack trace. From there you can examine the state of execution and cancel/resume execution.

You can enable/disable it by M-x toggle-debug-on-quit or through the menu bar Options > Enter Debugger on Quit/C-g.

  • This is a good solution and I did try it, as it happened in my particular case, it didn't help in finding the root cause of the problem (a hanging external process).
    – ideasman42
    Mar 12, 2017 at 16:33
  • @ideasman42 Ah. In cases like that you might find strace helpful.
    – ebpa
    Mar 12, 2017 at 16:37
  • Ah, I've used strace, but didnt think to apply to this problem - thanks.
    – ideasman42
    Mar 12, 2017 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.