I am getting a max-specdl-size error on only one .markdown file. I have increased the size via (setq max-specpdl-size 50000) to test, and I still get the error. This does not happen on any other .markdown files. I also tested it on .Rmarkdown and .R files, but it only happens on one particular file.

When I load the file, the file will be enabled without markdown-mode. However, if if I revert-buffer this seems to correct itself and the markdown-mode is re-enabled, but this does not always work either. I followed the advice here, but get a massive debug report (too big for the allowed limit to be posted here).

Any ideas why this is occurring? Please let me know if you need any more info.

This problem only happens when opening a file via projectile but not dired or directly form Finder.


This seems to be a problem on the contents of this particular file. I have copied the content to a new and renamed file, and still get the same issues. I also started using imenu-list and it does not provided an outline for this particular file, and reports an error (wrong-type-argment consp 31794). I've tested this file in other editors (Sublime Text, VSCode), and it works fine.

Any ideas are greatly appreciated.


I added (setq max-specpdl-size 50000) to my init file and the issue seems to have resolved.

  • What happens if you exit emacs and restart? Does opening the markdown file on another machine cause this failure? IOW, is the problem with the given emacs (in which case, restarting emacs solves the problem) or with emacs on the given machine (i.e. something wrong with the machine, so opening the file on a different machine works fine) or with emacs on any machine (i.e. a bug in emacs that is triggered by this particular file)? If the file is small enough, can you it or upload it somewhere (perhaps a public pastebin) and post a link? The same with the debug report: ... – NickD Jan 21 '20 at 11:58
  • 1
    ... can you post it or upload it and post a link? The usual cause of a max-specpdl-size error is a bottomless recursion, but I think more information than what you provide would be necessary to allow a diagnosis. – NickD Jan 21 '20 at 11:58
  • Thanks for your reply @NickD, however I cannot test it on other machines. However, I did just test it on different Emacs configs and it works fine, so seems it is something with my config. I posted the debug output here. Sorry, I cannot post the file as it is a draft of a manuscript. Thanks again for your help. – Atanas Janackovski Jan 21 '20 at 12:14
  • 1
    Check the value of markdown-fenced-block-pairs: how long is it? is it perhaps a circular list? Compare it with the setting in the configuration that works. If that does not bear fruit, you can always try bisecting your init file to figure out which part of it causes the problem. – NickD Jan 21 '20 at 12:28
  • 1
    Thx. I'll delete my comment. You might want to delete other comments also, integrating any useful info from them into the question. – Drew Jan 21 '20 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.