raku-mode
raku-mode copied to clipboard
Error: (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
This error seems to happen if you have a multi line block following a closing curly brace.
To reproduce:
{} {
<press tab here>
}
The backtrace for this error seems to be the same SMIE functions called over and over again
I ran into the same error and messed around with raku-indent.el
a little bit.
It looks like if we delete two rules in raku-smie-rules
at line 58 and line 62, this particular error no longer reproduces:
diff --git a/raku-indent.el b/raku-indent.el
index 517fcea..c75f8fd 100644
--- a/raku-indent.el
+++ b/raku-indent.el
@@ -55,12 +55,7 @@
(`(:elem . basic) raku-indent-offset)
(`(:elem . arg) 0)
(`(:list-intro . ,(or `";" `"")) t) ;"" stands for BOB (bug#15467).
- (`(:before . "{")
- (when (smie-rule-hanging-p)
- (smie-backward-sexp ";")
- (smie-indent-virtual)))
- (`(:before . ,(or "{" "("))
- (if (smie-rule-hanging-p) (smie-rule-parent 0)))))
+ ))
(provide 'raku-indent)
I'm guessing this also breakse something else though.
With a bit luck, I found that without both of those 2 rules, the indentation of if - else
statements is changed. From:
if %a{'foo'} {
foo();
} else {
baz();
}
... to:
if %a{'foo'} {
foo();
} else {
baz();
}
But if we keep the rule at line 62 and only remoes the one at line 58, that's good again.
diff --git a/raku-indent.el b/raku-indent.el
index 517fcea..d3c01f5 100644
--- a/raku-indent.el
+++ b/raku-indent.el
@@ -55,10 +55,6 @@
(`(:elem . basic) raku-indent-offset)
(`(:elem . arg) 0)
(`(:list-intro . ,(or `";" `"")) t) ;"" stands for BOB (bug#15467).
- (`(:before . "{")
- (when (smie-rule-hanging-p)
- (smie-backward-sexp ";")
- (smie-indent-virtual)))
(`(:before . ,(or "{" "("))
(if (smie-rule-hanging-p) (smie-rule-parent 0)))))
I've tested with my own code and some example code snippets from docs.raku.org and this seems to be good so far.
The way I tested it is via indent-region
, but perhaps that does not cover all cases.
Hi! Can you please submit a PR?