emacs-devel
[Top][All Lists]
Advanced

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

Re: Making debugging possible on expressions executed from ielm


From: Jarosław Rzeszótko
Subject: Re: Making debugging possible on expressions executed from ielm
Date: Mon, 15 Jan 2018 20:22:48 +0100

Stefan,

I did not know about condition-case-unless-debug, it indeed does make debugging possible with a simpler change and without any side effects. I attach the patch.

Cheers,
Jarosław Rzeszótko

On Sat, Jan 13, 2018 at 10:22 AM, Jarosław Rzeszótko <address@hidden> wrote:
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.

Cheers,
Jarosław Rzeszótko



Attachment: ielm-with-debugger.el.diff
Description: Text document


reply via email to

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