emacs-devel
[Top][All Lists]
Advanced

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

Re: Attaching context info to an error


From: João Távora
Subject: Re: Attaching context info to an error
Date: Sat, 23 Dec 2023 03:28:03 +0000

On Sat, Dec 23, 2023 at 3:02 AM João Távora <joaotavora@gmail.com> wrote:
> (defun pm/invoke-restart (restart)
>   (interactive
>    (some-read-from-minibuffer-or-somesuch))
>   (funcall (caadr restart)))
>
> (defun baz (sym)
>   (error "whoops, it happened again for %s" sym))
>
> (defun bar ()
>   (pm/with-retry-restart (:msg "Retry") (baz (gensym))))
>
> (defun foo ()
>   (bar))
>
> (foo)
>
> ;; Local Variables:
> ;; read-symbol-shorthands: (("pm/" . "poor-mans-restarts-"))
> ;; End:
>
> This very code works fine in Common Lisp (just add a WHILE
> macro to it)

Just to be clear what I meant by this to those unfamiliar with
Common Lisp and interactive restarts.  It means I can invoke
the restart interactively from the Common Lisp debugger that
is invoked as the last step of the non-returning error.

'baz' will be called again and again with different arguments
and always errors until I recompile it to something else that
doesn't error, which I can do while the debugger is active.

I expected to be able to do the same from the Emacs Lisp
debugger-mode/backtrace-mode *Backtrace* buffer, but I never
get one such buffer.

João



reply via email to

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