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

Error: (error "Lisp nesting exceeds ‘max-lisp-eval-depth’") #23

Open
dantecatalfamo opened this issue Nov 2, 2019 · 3 comments
Open
Labels
indentation Issues involving indentation

Comments

@dantecatalfamo
Copy link

dantecatalfamo commented Nov 2, 2019

This error seems to happen if you have a multi line block following a closing curly brace.

To reproduce:

{} {
<press tab here>
}

emacs perl6 error

The backtrace for this error seems to be the same SMIE functions called over and over again
  —  (117 x 67) 2019-11-01 21-22-58

@matiaslina matiaslina added the indentation Issues involving indentation label May 2, 2020
@gugod
Copy link

gugod commented Dec 30, 2020

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.

@gugod
Copy link

gugod commented Dec 30, 2020

With a bit luck, I found that without both of those 2 rules, the indentation of if - elsestatements 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.

@Altai-man
Copy link
Member

Hi! Can you please submit a PR?

gugod added a commit to gugod/raku-mode that referenced this issue Jan 2, 2021
Fix issue Raku#23

When indenting something like

    if %h{"foo"} {
        ....... (press tab here)
    }

This error happens.

    (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")

Note here that while the fix does makes the error go away, it is not
entirely certain whether it breaks the indentation for some other
cases.

But I think we could live with this until we found what's broken.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
indentation Issues involving indentation
Projects
None yet
Development

No branches or pull requests

4 participants