Groovy-Emacs-Modes / groovy-emacs-modes

A groovy major mode, grails minor mode, and a groovy inferior mode.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

max-lisp-eval-depth problem

hajovonta opened this issue · comments

Emacs version: 28.0.50

Sometimes when I open a groovy file, I get "File mode specification error: (error Lisp nesting exceeds 'max-lisp-eval-depth')" error in minibuffer.
Increased the max-lisp-eval-depth to 10000, but that didn't solve the problem.

Tried to debug, and the last function executed before the error was normal-mode, with something like "couldn't load files.el".

Due to the error, I don't get syntax coloring in groovy-mode. But if I M-x normal-mode after the error, I get my file colored (and another error message).

Please help investigating the problem.

Could you share an example file that has this problem?

This file below produces the error for me if I save it as 'test.groovy' and open it in Emacs.
Sensitive data redacted.

import com.company.ci.common.Context
import static com.company.ci.common.Params.*
import com.company.ci.common.jobname.CommonJobs
import groovy.transform.Field


@Field
Context ctx = new Context(sourceRepo: SourceRepo.REPO,
        buildType: BuildType.RELEASE,
        jenkinsSlave: JenkinsSlave.MY_LABEL,
        scriptName: this.class.name)


freeStyleJob(CommonJobs.SERVER_DEPLOYMENT.name) {
    with ctx.jobSetup()
    parameters ctx.gerritRefspecParam()
    scm ctx.sourceScm(ctx.scm_Gerrit_This_Patchset() + [clean: true])
    publishers {
        with ctx.postBuildSteps(RunPostBuildWhen.ALWAYS) {
            conditionalSteps {
                condition {
                    status('FAILURE','UNSTABLE')
                }
                runner('DontRun')
                steps {
                    with ctx.getDetectedAt()
                }
            }
        }
    }
}

The problem is that the error prevents the mode to run properly, e.g. some hooks and minor modes are not loaded

Strange, but I could make a workaround by evaluating these:

(add-hook 'groovy-mode-hook #'company-mode-hook)
(add-hook 'groovy-mode-hook #'company-mode)

This way it complains about company-mode-hook, but then loads company-mode fine, and I also get syntax coloring. If I leave the company-mode-hook out, then I get neither.

I'm unable to get an error with that file. Could you try M-x toggle-debug-on-error before opening the file, to get a traceback?

If you can get a traceback, please post it here.

I tried this, but I don't get a Backtrace window. The error is shown in the minibuffer and in the Messages but that's it.

What else is in your groovy-mode-hook and prog-mode-hook? Can you replicate the issue with emacs -q, loading groovy-mode.el and opening the test file you've shared?

groovy-mode-hook contains:
(inf-groovy-keys company-mode company-mode-hook groovy-mode)
and prog-mode-hook is nil.

I tried the procedure you insisted, but got the following error when trying to load groovy-mode.el:
*** Eval error *** Cannot open load file: No such file or directory, s
I'm sure it's some blatant but I'm not skilled in debugging emacs.

*** Eval error *** Cannot open load file: No such file or directory, s

Sorry, I should have mentioned. When you start with emacs -q, qou'll need to run M-x eval-buffer on dash.el and s.el first so you have the necessary dependencies.