[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Making debugging possible on expressions executed from ielm

From: Jarosław Rzeszótko
Subject: Making debugging possible on expressions executed from ielm
Date: Sat, 13 Jan 2018 10:22:25 +0100

I attach a patch for ielm.el that makes it possible to enter the debugger when executing expressions in ielm, and that makes ielm respect the debug-on-error and debug-on-exit flags. 

I guess that possibly the reason that was not originally done is that it is not obvious how to restore ielm to a usable state after the debugger has been entered. My patch makes use of the fact that unwind-protect unwind forms are still executed when user resumes execution from the debugger after an error.

Without the patch, ielm wraps the evaluation of the _expression_ given by the user in a condition case, and in case of an error, or exit, displays an appropriate message in its buffer, right under the evaluated _expression_, regardless of debug-on-error and debug-on-exit. 

With the patch, the message that ielm displays in its buffer will be a generic error message  regardless if there was an error in the evaluated form, or a quit. However:

- if debug-on-error is t, emacs will enter the debugger and show a stack trace, just like with almost any other evaluation method. When the user continues the execution from the debugger, ielm will correctly resume execution

- if debug-on-error is nil, emacs will display the specific error in the minibuffer anyway

Similar things are true for debug-on-quit.

I think this is an improvement over the current state of affairs. Of course ideally I would like to preserve the "nice" message in ielm buffer and make the improvements I made, but emacs does not seem to make it possible to do some handling of an error and then to re-raise it while preserving the original stack trace.

Jarosław Rzeszótko

Attachment: ielm-debug-on-error.el.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]