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

Self references in .yas-parents breaks Emacs #318

Closed
sheijk opened this issue Oct 22, 2012 · 5 comments
Closed

Self references in .yas-parents breaks Emacs #318

sheijk opened this issue Oct 22, 2012 · 5 comments
Labels

Comments

@sheijk
Copy link

sheijk commented Oct 22, 2012

cd /your/yasnippet/dir
mkdir -p snippets/sh-mode
echo "sh-mode" >> snippets/sh-mode/.yas-parents
emacs -Q -L . -l yasnippet.el -e yas-global-mode

Now do M-x sh-mode or open any file in sh-mode. This will cause an error in the post-command-hook which makes it impossible to still execute most commands. After this many commands will cause errors due to the post-command-hook function failing which makes it very hard to recover.

File mode specification error: (error "Lisp nesting exceeds max-lisp-eval-depth'") yas--all-parents: Lisp nesting exceedsmax-lisp-eval-depth'
Error in post-command-hook (yas-global-mode-check-buffers): (error "Lisp nesting exceeds `max-lisp-eval-depth'")

The issue is easily fixed by either deleting the .yas-parents file or fixing the invalid reference in the .yas-parents file. It would be a lot nicer to detect the error and issue an error message instead, though.

@sheijk
Copy link
Author

sheijk commented Oct 22, 2012

This happens at least with the most recent git version and the 0.8.0 snapshot. I have had this issue since a long time so most versions since changing to the .yas-parents system might have the issue. Also happens if no other plugins/config gets loaded. I've also been running into this on Windows (but have not reproduced it or checked the fix there).

Emacs version:

GNU Emacs 24.2.1 (x86_64-apple-darwin, NS apple-appkit-1038.36) of 2012-08-27 on bob.porkrind.org

@joaotavora
Copy link
Owner

OK I understand, and marked this a bug. Your recipe has an error, you probably meant cd /your/yasnippet/dir/snippets. Still it's a valid bug report and a good example on how to report bugs. I've edited your original report to make a good example.

@targzeta
Copy link

This fix introduces a new bug:

[yas] Cyclic parenthood: mode text-mode has already seen as a parent of mode emacs-lisp-mode
[yas] Loading for `emacs-lisp-mode', just-in-time: (yas--load-directory-1 /usr/share/emacs/site-lisp/snippets/emacs-lisp-mode (quote emacs-lisp-mode) (quote (text-mode)))!
[yas] Loading compiled snippets from /usr/share/emacs/site-lisp/snippets/emacs-lisp-mode
[yas] Loading for `text-mode', just-in-time: (yas--load-directory-1 /usr/share/emacs/site-lisp/snippets/text-mode (quote text-mode) (quote nil))!
[yas] Loading compiled snippets from /usr/share/emacs/site-lisp/snippets/text-mode
[yas] Loading for `text-mode', just-in-time: (yas--load-directory-1 /home/targzeta/.emacs.d/snippets/text-mode (quote text-mode) (quote (gpl)))!
[yas] Loading compiled snippets from /home/targzeta/.emacs.d/snippets/text-mode

And when I open a php file it shows again:

[yas] Cyclic parenthood: mode text-mode has already seen as a parent of mode emacs-lisp-mode

but the CPU grows to 100% and I have to kill emacs.

Best regards,
Emanuele

@joaotavora
Copy link
Owner

Thanks, I have just seen that happening. For now the workaround is not having cyclic dependencies in your snippet dirs.

@joaotavora joaotavora reopened this May 22, 2013
@targzeta
Copy link

Is there a cycling dependencies in these code?

$> grep . snippets/*/.yas-parents
snippets/sh-mode/.yas-parents:text-mode
snippets/text-mode/.yas-parents:gpl

I think the problem is because I have written a .yas-parent for text-mode where text-mode exists also in your default snippets. What do you think?

In effect, if I move my text-mode dir, I have:

[yas] Cyclic parenthood: mode text-mode has already seen as a parent of mode emacs-lisp-mode
[yas] Loading for `emacs-lisp-mode', just-in-time: (yas--load-directory-1 /usr/share/emacs/site-lisp/snippets/emacs-lisp-mode (quote emacs-lisp-mode) (quote (text-mode)))!
[yas] Loading compiled snippets from /usr/share/emacs/site-lisp/snippets/emacs-lisp-mode
[yas] Loading for `text-mode', just-in-time: (yas--load-directory-1 /usr/share/emacs/site-lisp/snippets/text-mode (quote text-mode) (quote nil))!
[yas] Loading compiled snippets from /usr/share/emacs/site-lisp/snippets/text-mode
For information about GNU Emacs and the GNU system, type C-h C-a.
(New file)
[yas] Cyclic parenthood: mode cc-mode has already seen as a parent of mode c-mode
[yas] Loading for `c-mode', just-in-time: (yas--load-directory-1 /usr/share/emacs/site-lisp/snippets/c-mode (quote c-mode) (quote (cc-mode)))!
[yas] Loading compiled snippets from /usr/share/emacs/site-lisp/snippets/c-mode
[yas] Loading for `php-mode', just-in-time: (yas--load-directory-1 /home/targzeta/.emacs.d/snippets/php-mode (quote php-mode) (quote nil))!
[yas] Loading compiled snippets from /home/targzeta/.emacs.d/snippets/php-mode
[yas] Loading for `cc-mode', just-in-time: (yas--load-directory-1 /usr/share/emacs/site-lisp/snippets/cc-mode (quote cc-mode) (quote (text-mode)))!
[yas] Loading compiled snippets from /usr/share/emacs/site-lisp/snippets/cc-mode

and, when I open a PHP file:

[yas] Cyclic parenthood: mode text-mode has already seen as a parent of mode html-mode
[yas] Loading for `html-mode', just-in-time: (yas--load-directory-1 /usr/share/emacs/site-lisp/snippets/html-mode (quote html-mode) (quote (text-mode)))!
[yas] Loading compiled snippets from /usr/share/emacs/site-lisp/snippets/html-mode

but, all works good, however.

Emanuele

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

No branches or pull requests

3 participants