Skip to content

Instantly share code, notes, and snippets.

@southly
Created December 1, 2010 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save southly/723371 to your computer and use it in GitHub Desktop.
Save southly/723371 to your computer and use it in GitHub Desktop.
fix macroexpand. #xyzzy
diff --git a/src/eval.cc b/src/eval.cc
index 6d5d1d3..9203741 100644
--- a/src/eval.cc
+++ b/src/eval.cc
@@ -1523,10 +1523,15 @@ lisp
Fmacroexpand (lisp arg, lisp env)
{
protect_gc gcpro (arg);
- do
- arg = Fmacroexpand_1 (arg, env);
- while (multiple_value::value (1) != Qnil);
- multiple_value::clear ();
+ int n = 0;
+ while (1)
+ {
+ arg = Fmacroexpand_1 (arg, env);
+ if (multiple_value::value (1) == Qnil) break;
+ n++;
+ }
+ multiple_value::count () = 2;
+ multiple_value::value (1) = n > 0 ? Qt : Qnil;
return arg;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment