From: "Jarosław Rzeszótko" <jrzeszotko@gmail.com>
To: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: Making debugging possible on expressions executed from ielm
Date: Mon, 15 Jan 2018 20:22:48 +0100 [thread overview]
Message-ID: <CAO_X8WATaofe3U0Z-7Lmud_5RDXue6W97chgwtSbMeUO1_uMmQ@mail.gmail.com> (raw)
In-Reply-To: <CAO_X8WBhjU0J+v5owHu9BUsOdc+zNvrt_-yq2DWQWb=dHKzd=Q@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 2056 bytes --]
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 <jrzeszotko@gmail.com>
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 #1.2: Type: text/html, Size: 2576 bytes --]
[-- Attachment #2: ielm-with-debugger.el.diff --]
[-- Type: text/plain, Size: 1777 bytes --]
diff --git a/lisp/ielm.el b/lisp/ielm.el
index fb285e80f6..30d6515e69 100644
--- a/lisp/ielm.el
+++ b/lisp/ielm.el
@@ -354,7 +354,7 @@ nonempty, then flushes the buffer."
(wbuf ielm-working-buffer) ; current buffer after evaluation
(pmark (ielm-pm)))
(unless (ielm-is-whitespace-or-comment string)
- (condition-case err
+ (condition-case-unless-debug err
(let ((rout (read-from-string string)))
(setq form (car rout)
pos (cdr rout)))
@@ -384,7 +384,7 @@ nonempty, then flushes the buffer."
(set-match-data ielm-match-data)
(save-excursion
(with-temp-buffer
- (condition-case err
+ (condition-case-unless-debug err
(unwind-protect
;; The next let form creates default
;; bindings for *, ** and ***. But
@@ -436,7 +436,7 @@ nonempty, then flushes the buffer."
(goto-char pmark)
(unless error-type
- (condition-case nil
+ (condition-case-unless-debug nil
;; Self-referential objects cause loops in the printer, so
;; trap quits here. May as well do errors, too
(unless for-effect
@@ -517,9 +517,6 @@ causes output to be directed to the ielm buffer.
set to a different value during evaluation. You can use (princ
VALUE) or (pp VALUE) to write to the ielm buffer.
-Expressions evaluated by IELM are not subject to `debug-on-quit' or
-`debug-on-error'.
-
The behavior of IELM may be customized with the following variables:
* To stop beeping on error, set `ielm-noisy' to nil.
* If you don't like the prompt, you can change it by setting `ielm-prompt'.
next prev parent reply other threads:[~2018-01-15 19:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-13 9:22 Making debugging possible on expressions executed from ielm Jarosław Rzeszótko
2018-01-15 17:23 ` Stefan Monnier
2018-01-15 19:22 ` Jarosław Rzeszótko [this message]
2018-01-15 21:59 ` Stefan Monnier
2018-01-16 6:42 ` Jarosław Rzeszótko
2018-01-19 19:14 ` Jarosław Rzeszótko
2018-01-19 19:58 ` Eli Zaretskii
2018-01-20 17:55 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAO_X8WATaofe3U0Z-7Lmud_5RDXue6W97chgwtSbMeUO1_uMmQ@mail.gmail.com \
--to=jrzeszotko@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.