Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macrostep-expand fails with error on erroneous macros #10

Open
Tracked by #1
wasamasa opened this issue Jun 26, 2015 · 3 comments
Open
Tracked by #1

macrostep-expand fails with error on erroneous macros #10

wasamasa opened this issue Jun 26, 2015 · 3 comments

Comments

@wasamasa
Copy link

(defmacro my-bad ()
  `(1+ ,(/ 1 0)))

(my-bad)

Using macrostep-expand on the last form results in an arithmetic error. I'm not sure whether that's intended behaviour, but I'd expect a preview of the code instead. Any thoughts on this?

@fice-t
Copy link
Contributor

fice-t commented Nov 4, 2016

@wasamasa What should it expand to? (1+ (arith-error))?

@wasamasa
Copy link
Author

wasamasa commented Nov 4, 2016

Something like (1+ <error>), with <error> highlighted distinctly. That way one would immediately know what the problematic part is.

@joddie
Copy link
Owner

joddie commented Nov 20, 2016

It's a nice idea, but I'm not sure if it's feasible within Emacs Lisp. You need to be able to perform macroexpansion within a dynamic environment where you can trap error conditions without unwinding the stack, so that you can return some distinguished error-marker object instead. I think that requires something like Common Lisp's HANDLER-BIND mechanism, which Emacs Lisp lacks.

Maybe it could be done by binding the debugger variable? I'll try it next time I have a spare couple of hours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants